Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Improve release #4573

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/toolpad-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"homepage": "https://github.com/mui/toolpad#readme",
"scripts": {
"clean": "rimraf build",
"clean": "rimraf --glob build \"*.tsbuildinfo\"",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two changes in this PR feel like they're at conflict with each other. Either we generate tsbuildinfo files in the build folder and then the old clean command would suffice. Or we generate them outside of the build folder and then we don't remove them during the copy script. But maybe there are reasons to keep this? I know there are differences in build between studio packages and core packages.

"prebuild": "pnpm clean",
"build": "pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files",
"build:node": "node ../../scripts/build.mjs node",
Expand Down
11 changes: 9 additions & 2 deletions scripts/copyFiles.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/* eslint-disable no-console */
import path from 'path';
import { $ } from 'execa';
import {
createPackageFile,
includeFileInBuild,
prepend,
typescriptCopy,
} from './copyFilesUtils.mjs';

const $$ = $({ stdio: 'inherit' });

const packagePath = process.cwd();
const buildPath = path.join(packagePath, './build');
const srcPath = path.join(packagePath, './src');
Expand Down Expand Up @@ -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);
Expand Down
Loading