tsbuild/ts/tsbuild.cli.ts

41 lines
1003 B
TypeScript
Raw Permalink Normal View History

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
*/
tsbuildCli.standardTask().subscribe(argvArg => {
if (process.env.CLI_CALL_TSBUILD === 'true') {
tsbuild.compileGlobStringObject(
{
'./ts/**/*.ts': './dist'
},
{},
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
*/
tsbuildCli.addCommand('custom').subscribe(argvArg => {
const listedDirectories = argvArg._;
listedDirectories.shift();
const compilationCommandObject: {[key: string]: string} = {};
for (const directory of listedDirectories) {
compilationCommandObject[`./${directory}/**/*.ts`] = `./dist_${directory}`;
2019-01-27 01:42:58 +00:00
};
tsbuild.compileGlobStringObject(
compilationCommandObject,
{},
process.cwd(),
argvArg
);
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();