2018-12-05 22:29:01 +00:00
|
|
|
import * as plugins from './tsbuild.plugins';
|
|
|
|
import * as tsbuild from './tsbuild.exports';
|
|
|
|
|
|
|
|
const tsbuildCli = new plugins.smartcli.Smartcli();
|
|
|
|
|
2019-01-27 01:42:58 +00:00
|
|
|
/**
|
|
|
|
* the standard task compiles anything in ts/ directory to dist directory
|
|
|
|
*/
|
2020-03-09 15:14:06 +00:00
|
|
|
tsbuildCli.standardTask().subscribe(async argvArg => {
|
2018-12-05 22:29:01 +00:00
|
|
|
if (process.env.CLI_CALL_TSBUILD === 'true') {
|
|
|
|
tsbuild.compileGlobStringObject(
|
|
|
|
{
|
2020-03-13 19:23:01 +00:00
|
|
|
'./ts/**/*.ts': './dist_ts'
|
2018-12-05 22:29:01 +00:00
|
|
|
},
|
|
|
|
{},
|
|
|
|
process.cwd(),
|
|
|
|
argvArg
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
2018-12-05 22:32:27 +00:00
|
|
|
|
2019-01-27 01:42:58 +00:00
|
|
|
/**
|
|
|
|
* the custom command compiles any customDir to dist_customDir
|
|
|
|
*/
|
2020-03-09 15:14:06 +00:00
|
|
|
tsbuildCli.addCommand('custom').subscribe(async argvArg => {
|
2019-01-27 01:42:58 +00:00
|
|
|
const listedDirectories = argvArg._;
|
|
|
|
listedDirectories.shift();
|
2019-08-26 14:28:03 +00:00
|
|
|
const compilationCommandObject: { [key: string]: string } = {};
|
2019-01-27 01:42:58 +00:00
|
|
|
for (const directory of listedDirectories) {
|
2019-01-27 18:21:07 +00:00
|
|
|
compilationCommandObject[`./${directory}/**/*.ts`] = `./dist_${directory}`;
|
2019-08-26 14:28:03 +00:00
|
|
|
}
|
2020-03-09 15:14:06 +00:00
|
|
|
await tsbuild.compileGlobStringObject(compilationCommandObject, {}, process.cwd(), argvArg);
|
|
|
|
});
|
|
|
|
|
|
|
|
tsbuildCli.addCommand('element').subscribe(async argvArg => {
|
2020-03-13 19:23:01 +00:00
|
|
|
await tsbuild.compileGlobStringObject(
|
|
|
|
{
|
|
|
|
'./ts_web/**/*.ts': 'dist_ts_web'
|
|
|
|
},
|
|
|
|
{},
|
|
|
|
process.cwd(),
|
|
|
|
{ web: true }
|
|
|
|
);
|
2019-06-21 07:49:37 +00:00
|
|
|
});
|
2019-01-27 01:42:58 +00:00
|
|
|
|
2018-12-05 22:32:27 +00:00
|
|
|
tsbuildCli.startParse();
|