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

[kbn/optimizer] Fix windows support #57592

Merged
merged 10 commits into from
Feb 14, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ export function findKibanaPlatformPlugins(scanDirs: string[], paths: string[]) {
absolute: true,
}
)
.map(path => readKibanaPlatformPlugin(path));
.map(path =>
// absolute paths returned from globby are using normalize or something so the path separators are `/` even on windows, Path.resolve solves this
readKibanaPlatformPlugin(Path.resolve(path))
);
}

function readKibanaPlatformPlugin(manifestPath: string): KibanaPlatformPlugin {
Expand Down
49 changes: 21 additions & 28 deletions packages/kbn-optimizer/src/worker/run_worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/

import * as Rx from 'rxjs';
import { mergeMap } from 'rxjs/operators';

import { parseBundles, parseWorkerConfig, WorkerMsg, isWorkerMsg, WorkerMsgs } from '../common';

Expand Down Expand Up @@ -75,33 +74,27 @@ setInterval(() => {
}, 1000).unref();

Rx.defer(() => {
return Rx.of({
workerConfig: parseWorkerConfig(process.argv[2]),
bundles: parseBundles(process.argv[3]),
});
})
.pipe(
mergeMap(({ workerConfig, bundles }) => {
// set BROWSERSLIST_ENV so that style/babel loaders see it before running compilers
process.env.BROWSERSLIST_ENV = workerConfig.browserslistEnv;
const workerConfig = parseWorkerConfig(process.argv[2]);
const bundles = parseBundles(process.argv[3]);

return runCompilers(workerConfig, bundles);
})
)
.subscribe(
msg => {
send(msg);
},
error => {
if (isWorkerMsg(error)) {
send(error);
} else {
send(workerMsgs.error(error));
}
// set BROWSERSLIST_ENV so that style/babel loaders see it before running compilers
process.env.BROWSERSLIST_ENV = workerConfig.browserslistEnv;

exit(1);
},
() => {
exit(0);
return runCompilers(workerConfig, bundles);
}).subscribe(
msg => {
send(msg);
},
error => {
if (isWorkerMsg(error)) {
send(error);
} else {
send(workerMsgs.error(error));
}
);

exit(1);
},
() => {
exit(0);
}
);