|
|
|
@ -1,7 +1,7 @@ |
|
|
|
import execa from 'execa'; |
|
|
|
import fse from 'fs-extra'; |
|
|
|
import fs from 'fs'; |
|
|
|
import program from 'commander'; |
|
|
|
import execa from "execa"; |
|
|
|
import fse from "fs-extra"; |
|
|
|
import fs from "fs"; |
|
|
|
import program from "commander"; |
|
|
|
|
|
|
|
const defaultTemplates = ['app', 'app-nolayers', 'module']; |
|
|
|
const defaultTemplatePath = '../../../templates'; |
|
|
|
@ -17,21 +17,32 @@ const packageMap = { |
|
|
|
'tenant-management': 'ng.tenant-management', |
|
|
|
'theme-basic': 'ng.theme.basic', |
|
|
|
'theme-shared': 'ng.theme.shared', |
|
|
|
'schematics':'ng.schematics', |
|
|
|
oauth:'ng.oauth' |
|
|
|
schematics: 'ng.schematics', |
|
|
|
oauth: 'ng.oauth', |
|
|
|
}; |
|
|
|
program.option('-t, --templates <templates>', 'template dirs', false); |
|
|
|
program.option('-p, --template-path <templatePath>', 'root template path', false); |
|
|
|
program.option( |
|
|
|
'-e, --use-existing-build <useExistingBuild>', |
|
|
|
"don't build packages if dist folder exists", |
|
|
|
false, |
|
|
|
); |
|
|
|
program.option('-i, --noInstall', 'skip package installation', false); |
|
|
|
program.option('-a, --absolute-dir <absoluteDir>', 'Absolute angular directory', 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:all'], { |
|
|
|
stdout: 'inherit', |
|
|
|
cwd:'../' |
|
|
|
}); |
|
|
|
if (!program.useExistingBuild) { |
|
|
|
await execa('yarn', ['build:all'], { |
|
|
|
stdout: 'inherit', |
|
|
|
cwd: '../', |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
await installPackages(); |
|
|
|
if (!program.noInstall) { |
|
|
|
await installPackages(); |
|
|
|
} |
|
|
|
|
|
|
|
await removeAbpPackages(); |
|
|
|
|
|
|
|
@ -41,11 +52,17 @@ const templateRootPath = program.templatePath ? program.templatePath : defaultTe |
|
|
|
async function runEachTemplate( |
|
|
|
handler: (template: string, templatePath?: string) => void | Promise<any>, |
|
|
|
) { |
|
|
|
for (var template of templates) { |
|
|
|
const templatePath = `${templateRootPath}/${template}/angular`; |
|
|
|
const result = handler(template, templatePath); |
|
|
|
if (program.absoluteDir) { |
|
|
|
const result = handler('', program.absoluteDir); |
|
|
|
result instanceof Promise ? await result : result; |
|
|
|
} else { |
|
|
|
for (var template of templates) { |
|
|
|
const templatePath = `${templateRootPath}/${template}/angular`; |
|
|
|
const result = handler(template, templatePath); |
|
|
|
result instanceof Promise ? await result : result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
async function installPackages() { |
|
|
|
|