Skip to content

Commit

Permalink
ci: add check for dependencies that need externalizing during bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
mingxuanzhangsfdx committed Oct 2, 2024
1 parent a5a9fc7 commit 3fea6d7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ jobs:
- name: Update for Bundling
run: |
node scripts/updateForBundling.js
- name: Generate Bundle
- name: Generate Bundle and Check if there is any dependency that needs to be externalized and is not in the whitelist.
run: |
yarn build
node scripts/build.js
node scripts/bundleWithCheck.js
- name: Post Bundling Update
run: |
node scripts/postBundlingUpdate.js
17 changes: 17 additions & 0 deletions scripts/bundleWithCheck.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const { exec } = require('child_process');

const commandToRun = 'yarn build && node ./scripts/build.js';

// Run the command
exec(commandToRun, (error, stdout, stderr) => {
// Combine stdout and stderr to check the entire output
const output = `${stdout}\n${stderr}`;
console.log('aaaa', output);
// Check if the output contains the error string of esbuild
if (output.includes('[require-resolve-not-external]')) {
console.error('Error: A dependency that has to be externalized in esbuild process is found. Please resolve it!');
process.exit(1); // Exit with an error code
} else {
process.exit(0); // Exit with success code
}
});

0 comments on commit 3fea6d7

Please sign in to comment.