-
Notifications
You must be signed in to change notification settings - Fork 14
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
Manifest builder improvements #401
Conversation
🦋 Changeset is good to goLatest commit: 5e0adf7 We got this. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The preview packages of this pull request have been published. @bigtest/agentInstall using the following command: $ npm install @bigtest/agent@manifest Or update your package.json file: {
"@bigtest/agent": "manifest"
} @bigtest/atomInstall using the following command: $ npm install @bigtest/atom@manifest Or update your package.json file: {
"@bigtest/atom": "manifest"
} @bigtest/bundlerInstall using the following command: $ npm install @bigtest/bundler@manifest Or update your package.json file: {
"@bigtest/bundler": "manifest"
} @bigtest/cliInstall using the following command: $ npm install @bigtest/cli@manifest Or update your package.json file: {
"@bigtest/cli": "manifest"
} @bigtest/interactorInstall using the following command: $ npm install @bigtest/interactor@manifest Or update your package.json file: {
"@bigtest/interactor": "manifest"
} @bigtest/serverInstall using the following command: $ npm install @bigtest/server@manifest Or update your package.json file: {
"@bigtest/server": "manifest"
} @bigtest/webdriverInstall using the following command: $ npm install @bigtest/webdriver@manifest Or update your package.json file: {
"@bigtest/webdriver": "manifest"
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice set of stability fixes! 🍷
packages/bundler/src/bundler.ts
Outdated
}); | ||
|
||
rollup = watch(prepareRollupOptions(bundles)); | ||
let events: ChainableSubscription<Array<RollupWatcherEvent>, undefined> = yield subscribe(on<Array<RollupWatcherEvent>>(rollup, 'event')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not quite sure why a try/catch won't catch the right thing. If you put it around 82-90, it will catch any exception raised therein.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what it was originally:
let rollup: RollupWatcher = watch(prepareRollupOptions(bundles));;
let events: ChainableSubscription<Array<RollupWatcherEvent>, undefined> = yield subscribe(on<Array<RollupWatcherEvent>>(rollup, 'event'));
let messages = events
.map(([event]) => event)
.filter(event => event.code === 'END' || event.code === 'ERROR')
.map(event => event.code === 'ERROR' ? { type: 'error', error: event.error } : { type: 'update' });
try {
yield messages.forEach(function*(message) {
bundler.channel.send(message as BundlerMessage);
});
} finally {
rollup.close();
}
Which is wrong I think, prompting me to make a change. However, rather than just wrap more in the try
block I thought ensure()
was the way to go, but now that you've explained that that's not the way to go I'll update to this:
let rollup: RollupWatcher = watch(prepareRollupOptions(bundles));;
try {
let events: ChainableSubscription<Array<RollupWatcherEvent>, undefined> = yield subscribe(on<Array<RollupWatcherEvent>>(rollup, 'event'));
let messages = events
.map(([event]) => event)
.filter(event => event.code === 'END' || event.code === 'ERROR')
.map(event => event.code === 'ERROR' ? { type: 'error', error: event.error } : { type: 'update' });
yield messages.forEach(function*(message) {
bundler.channel.send(message as BundlerMessage);
});
} finally {
rollup.close();
}
Motivation
I noticed a few things to clean up:
Bundler
try/finally
was not wrapping the code that needed itfs.promises.truncate()
that causes warnings fsPromises.truncate doesn't close fd. nodejs/node#34189Approach
ensure()
API instead oftry/finally
inBundler
ftruncate()
instead oftruncate()
until the fix is released