diff --git a/packages/canon/package.json b/packages/canon/package.json index 0929111546..d08f660e7d 100644 --- a/packages/canon/package.json +++ b/packages/canon/package.json @@ -27,10 +27,8 @@ "dist" ], "scripts": { - "build": "yarn build:app && yarn build:css", + "build": "backstage-cli package build", "build-storybook": "storybook build", - "build:app": "backstage-cli package build", - "build:css": "node scripts/build-css.mjs", "clean": "backstage-cli package clean", "lint": "backstage-cli package lint", "prepack": "backstage-cli package prepack", diff --git a/packages/canon/scripts/build-css.mjs b/packages/canon/scripts/build-css.mjs deleted file mode 100644 index 221d483e03..0000000000 --- a/packages/canon/scripts/build-css.mjs +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* eslint-disable no-restricted-imports */ -import { transform, bundle } from 'lightningcss'; -import fs from 'fs'; -import path from 'path'; -/* eslint-enable no-restricted-imports */ - -// Check if core.css and components.css exist -const cssFiles = ['src/css/core.css', 'src/css/components.css']; -const distDir = 'dist/css'; - -cssFiles.forEach(file => { - if (!fs.existsSync(file)) { - console.error(`${file} does not exist`); - process.exit(1); - } -}); - -// Ensure the dist/css directory exists -if (!fs.existsSync(distDir)) { - fs.mkdirSync(distDir, { recursive: true }); -} - -cssFiles.forEach(file => { - let { code: bundleCode } = bundle({ - filename: file, - }); - - let { code, map } = transform({ - filename: `${distDir}/${path.basename(file)}`, - code: bundleCode, - minify: true, - sourceMap: true, - }); - - fs.writeFileSync(`${distDir}/${path.basename(file)}`, code); - fs.writeFileSync(`${distDir}/${path.basename(file)}.map`, map); - - // Clear the content of the original CSS file - fs.writeFileSync(file, ''); -});