diff --git a/packages/toolpad-core/package.json b/packages/toolpad-core/package.json index 604d8a528ec..65e1f5599dd 100644 --- a/packages/toolpad-core/package.json +++ b/packages/toolpad-core/package.json @@ -38,7 +38,7 @@ }, "homepage": "https://github.com/mui/toolpad#readme", "scripts": { - "clean": "rimraf build", + "clean": "rimraf --glob build \"*.tsbuildinfo\"", "prebuild": "pnpm clean", "build": "pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", "build:node": "node ../../scripts/build.mjs node", diff --git a/scripts/copyFiles.mjs b/scripts/copyFiles.mjs index 6959e516352..24c6136fb70 100644 --- a/scripts/copyFiles.mjs +++ b/scripts/copyFiles.mjs @@ -1,5 +1,6 @@ /* eslint-disable no-console */ import path from 'path'; +import { $ } from 'execa'; import { createPackageFile, includeFileInBuild, @@ -7,6 +8,8 @@ import { typescriptCopy, } from './copyFilesUtils.mjs'; +const $$ = $({ stdio: 'inherit' }); + const packagePath = process.cwd(); const buildPath = path.join(packagePath, './build'); const srcPath = path.join(packagePath, './src'); @@ -37,21 +40,25 @@ async function addLicense(packageData) { ); } +async function removeBuildArtefacts() { + await $$`rimraf --glob ${buildPath}/*.tsbuildinfo`; +} + async function run() { const extraFiles = process.argv.slice(2); try { // TypeScript await typescriptCopy({ from: srcPath, to: buildPath }); - const packageData = await createPackageFile(); - await Promise.all( ['./README.md', '../../CHANGELOG.md', '../../LICENSE', ...extraFiles].map((file) => includeFileInBuild(file), ), ); + const packageData = await createPackageFile(); await addLicense(packageData); + await removeBuildArtefacts(); } catch (err) { console.error(err); process.exit(1);