add absolute project parameter to copy script

pull/15797/head
muhammedaltug 3 years ago
parent a9a2267d3c
commit 1d0fe5b765

@ -38,7 +38,8 @@
"debug:schematics-dist": "./node_modules/.bin/ng g ./dist/packages/schematics/collection.json:proxy-add --module __default --apiName __default --source __default --target __default --url http://localhost:4300 --service-type application",
"ci": "yarn affected:lint && yarn affected:build && yarn affected:test",
"lerna": "lerna",
"migrate-nx": "yarn nx migrate --run-migrations"
"migrate-nx": "yarn nx migrate --run-migrations",
"copy-to:app": "cd scripts && yarn && yarn copy-to-templates -t app"
},
"private": true,
"devDependencies": {

@ -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() {

Loading…
Cancel
Save