diff --git a/npm/ng-packs/scripts/copy-packages-to-templates.ts b/npm/ng-packs/scripts/copy-packages-to-templates.ts index c611c1109a..42aa7e5eff 100644 --- a/npm/ng-packs/scripts/copy-packages-to-templates.ts +++ b/npm/ng-packs/scripts/copy-packages-to-templates.ts @@ -1,8 +1,10 @@ import execa from 'execa'; import fse from 'fs-extra'; import fs from 'fs'; +import program from 'commander'; -const templates = ['app', 'app-nolayers', 'module']; +const defaultTemplates = ['app', 'app-nolayers', 'module']; +const defaultTemplatePath = '../../../templates'; const packageMap = { account: 'ng.account', 'account-core': 'ng.account.core', @@ -16,7 +18,11 @@ const packageMap = { 'theme-basic': 'ng.theme.basic', 'theme-shared': 'ng.theme.shared', }; - +program.option('-t, --templates ', 'template dirs', false); +program.option('-p, --template-path ', 'root template path', false); +program.parse(process.argv); +const templates = program.templates ? program.templates.split(',') : defaultTemplates; +const templateRootPath = program.templatePath ? program.templatePath : defaultTemplatePath; (async () => { await execa('yarn', ['build'], { stdout: 'inherit', @@ -33,7 +39,7 @@ async function runEachTemplate( handler: (template: string, templatePath?: string) => void | Promise, ) { for (var template of templates) { - const templatePath = `../../../templates/${template}/angular`; + const templatePath = `${templateRootPath}/${template}/angular`; const result = handler(template, templatePath); result instanceof Promise ? await result : result; }