mirror of https://github.com/abpframework/abp.git
Browse Source
* update feature management project references * remove logo customization from app nolayers angular styles * add script for copy abp packages to templates' node_modules folder * remove logo customization from app template's stylepull/13362/head
committed by
GitHub
11 changed files with 110 additions and 39 deletions
@ -0,0 +1,82 @@ |
|||
import execa from 'execa'; |
|||
import fse from 'fs-extra'; |
|||
import fs from 'fs'; |
|||
|
|||
const templates = ['app', 'app-nolayers', 'module']; |
|||
const packageMap = { |
|||
account: 'ng.account', |
|||
'account-core': 'ng.account.core', |
|||
components: 'ng.components', |
|||
core: 'ng.core', |
|||
'feature-management': 'ng.feature-management', |
|||
identity: 'ng.identity', |
|||
'permission-management': 'ng.permission-management', |
|||
'setting-management': 'ng.setting-management', |
|||
'tenant-management': 'ng.tenant-management', |
|||
'theme-basic': 'ng.theme.basic', |
|||
'theme-shared': 'ng.theme.shared', |
|||
}; |
|||
|
|||
(async () => { |
|||
await execa('yarn', ['build'], { |
|||
stdout: 'inherit', |
|||
}); |
|||
|
|||
await installPackages(); |
|||
|
|||
await removeAbpPackages(); |
|||
|
|||
await copyBuildedPackagesFromDistFolder(); |
|||
})(); |
|||
|
|||
async function runEachTemplate( |
|||
handler: (template: string, templatePath?: string) => void | Promise<any>, |
|||
) { |
|||
for (var template of templates) { |
|||
const templatePath = `../../../templates/${template}/angular`; |
|||
const result = handler(template, templatePath); |
|||
result instanceof Promise ? await result : result; |
|||
} |
|||
} |
|||
|
|||
async function installPackages() { |
|||
await runEachTemplate(async (template, templatePath) => { |
|||
if (fse.existsSync(`${templatePath}/yarn.lock`)) { |
|||
fse.removeSync(`${templatePath}/yarn.lock`); |
|||
} |
|||
await execa('yarn', ['install', '--ignore-scripts'], { |
|||
stdout: 'inherit', |
|||
cwd: templatePath, |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
async function removeAbpPackages() { |
|||
await runEachTemplate(async (template, templatePath) => { |
|||
Object.values(packageMap).forEach(value => { |
|||
const path = `${templatePath}/node_modules/@abp/${value}`; |
|||
if (fs.existsSync(path)) { |
|||
fse.removeSync(path); |
|||
} |
|||
}); |
|||
if (fs.existsSync(`${templatePath}/.angular`)) { |
|||
fse.removeSync(`${templatePath}/.angular`); |
|||
} |
|||
}); |
|||
} |
|||
function createFolderIfNotExists(destination: string) { |
|||
destination.split('/').reduce((acc, dir) => { |
|||
if (!fs.existsSync(acc)) { |
|||
fs.mkdirSync(acc); |
|||
} |
|||
return `${acc}/${dir}`; |
|||
}); |
|||
} |
|||
async function copyBuildedPackagesFromDistFolder() { |
|||
await runEachTemplate(async (template, templatePath) => { |
|||
Object.entries(packageMap).forEach(([key, value]) => { |
|||
createFolderIfNotExists(`${templatePath}/node_modules/@abp/${value}`); |
|||
fse.copySync(`../dist/packages/${key}/`, `${templatePath}/node_modules/@abp/${value}`); |
|||
}); |
|||
}); |
|||
} |
|||
Loading…
Reference in new issue