tsbundle/ts/tsbundle.class.tsbundle.ts

42 lines
1.3 KiB
TypeScript
Raw Normal View History

2019-06-16 15:02:38 +00:00
import * as plugins from './tsbundle.plugins';
import { logger } from './tsbundle.logging';
export class TsBundle {
2021-07-23 13:45:23 +00:00
public async buildTest(cwdArg: string, fromArg: string, toArg: string, bundlerArg: 'rollup' | 'parcel') {
const done = plugins.smartpromise.defer();
const threadsimple = new plugins.smartspawn.ThreadSimple(plugins.path.join(__dirname, './tsbundle.class.tsbundleprocess.js'), [], {
env: {
...process.env,
tsbundleMode: 'test',
tsbundleCwd: cwdArg,
tsbundleFrom: fromArg,
tsbundleTo: toArg,
tsbundleBundler: bundlerArg
}
})
const childProcess = await threadsimple.start();
childProcess.on('exit', (status) => {
done.resolve();
})
await done.promise;
};
2021-07-22 19:55:08 +00:00
public async buildProduction(cwdArg: string, fromArg: string, toArg: string) {
2021-07-23 13:45:23 +00:00
const done = plugins.smartpromise.defer();
const threadsimple = new plugins.smartspawn.ThreadSimple(plugins.path.join(__dirname, './tsbundle.class.tsbundleprocess.js'), [], {
env: {
...process.env,
tsbundleMode: 'production',
tsbundleCwd: cwdArg,
tsbundleFrom: fromArg,
tsbundleTo: toArg
}
})
const childProcess = await threadsimple.start();
childProcess.on('exit', (status) => {
done.resolve();
})
await done.promise;
};
2019-06-16 15:02:38 +00:00
}