Skip to content

Commit

Permalink
misc(build): call close method on rollup builds (#13307)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark authored Nov 2, 2021
1 parent dfe7650 commit 8a29854
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
1 change: 1 addition & 0 deletions build/build-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ async function build(entryPath, distPath, opts = {minify: true}) {
format: 'iife',
sourcemap: DEBUG,
});
await bundle.close();
}

/**
Expand Down
1 change: 1 addition & 0 deletions build/build-lightrider-bundles.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ async function buildStaticServerBundle() {
file: 'dist/lightrider/static-server.js',
format: 'commonjs',
});
await bundle.close();
}

async function run() {
Expand Down
28 changes: 19 additions & 9 deletions build/build-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ async function buildStandaloneReport() {
file: 'dist/report/standalone.js',
format: 'iife',
});
await bundle.close();
}

async function buildFlowReport() {
Expand Down Expand Up @@ -87,6 +88,7 @@ async function buildFlowReport() {
file: 'dist/report/flow.js',
format: 'iife',
});
await bundle.close();
}

async function buildEsModulesBundle() {
Expand All @@ -101,6 +103,7 @@ async function buildEsModulesBundle() {
file: 'dist/report/bundle.esm.js',
format: 'esm',
});
await bundle.close();
}

async function buildUmdBundle() {
Expand All @@ -121,34 +124,41 @@ async function buildUmdBundle() {
format: 'umd',
name: 'report',
});
await bundle.close();
}

if (require.main === module) {
async function main() {
if (process.argv.length <= 2) {
buildStandaloneReport();
buildFlowReport();
buildEsModulesBundle();
buildUmdBundle();
await Promise.all([
buildStandaloneReport(),
buildFlowReport(),
buildEsModulesBundle(),
buildUmdBundle(),
]);
}

if (process.argv.includes('--psi')) {
console.error('--psi build removed. use --umd instead.');
process.exit(1);
}
if (process.argv.includes('--standalone')) {
buildStandaloneReport();
await buildStandaloneReport();
}
if (process.argv.includes('--flow')) {
buildFlowReport();
await buildFlowReport();
}
if (process.argv.includes('--esm')) {
buildEsModulesBundle();
await buildEsModulesBundle();
}
if (process.argv.includes('--umd')) {
buildUmdBundle();
await buildUmdBundle();
}
}

if (require.main === module) {
main();
}

module.exports = {
buildStandaloneReport,
buildFlowReport,
Expand Down
1 change: 1 addition & 0 deletions build/build-smokehouse-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ async function build() {
file: bundleOutFile,
format: 'commonjs',
});
await bundle.close();
}

build();

0 comments on commit 8a29854

Please sign in to comment.