life-sciences-portal-cli
Version:
A CLI to generate and manage life sciences portals.
44 lines (43 loc) • 4.24 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.lifeSciencesPortalVisualFramework = void 0;
const core_1 = require("@angular-devkit/core");
function lifeSciencesPortalVisualFramework(_options) {
return (tree, _context) => {
const packageJsonFileName = (0, core_1.normalize)(`/${_options.path ? _options.path + '/' : ''}package.json`);
const packageJsonBuffer = tree.read(packageJsonFileName);
if (packageJsonBuffer !== null) {
const packageJson = JSON.parse(packageJsonBuffer.toString());
packageJson.devDependencies = Object.assign(Object.assign({}, packageJson.devDependencies), { '@visual-framework/ebi-header-footer': '^2.0.3', '@visual-framework/embl-conditional-edit': '^1.0.3', '@visual-framework/embl-content-hub-loader': '^1.1.0', '@visual-framework/embl-grid': '2.1.2', '@visual-framework/embl-notifications': '^1.1.0', '@visual-framework/vf-analytics-google': '1.0.4', '@visual-framework/vf-badge': '2.0.1', '@visual-framework/vf-banner': '1.9.0', '@visual-framework/vf-body': '1.2.0', '@visual-framework/vf-box': '2.3.1', '@visual-framework/vf-breadcrumbs': '^2.0.4', '@visual-framework/vf-button': '2.0.0-alpha.0', '@visual-framework/vf-card': '2.5.7', '@visual-framework/vf-card-container': '3.1.2', '@visual-framework/vf-cluster': '1.0.2', '@visual-framework/vf-code-example': '^1.3.0', '@visual-framework/vf-content': '1.5.6', '@visual-framework/vf-design-tokens': '3.6.0', '@visual-framework/vf-footer': '1.1.1', '@visual-framework/vf-form__core': '1.1.2', '@visual-framework/vf-global-header': '3.1.2', '@visual-framework/vf-grid': '1.4.1', '@visual-framework/vf-header': '2.0.2', '@visual-framework/vf-heading': '1.0.1', '@visual-framework/vf-hero': '3.2.3', '@visual-framework/vf-intro': '1.5.0', '@visual-framework/vf-lede': '1.0.1', '@visual-framework/vf-link': '2.0.0', '@visual-framework/vf-link-list': '1.3.4', '@visual-framework/vf-list': '1.0.0', '@visual-framework/vf-logo': '1.5.1', '@visual-framework/vf-navigation': '3.0.0-beta.1', "@visual-framework/vf-news-container": "^1.0.0", '@visual-framework/vf-page-header': '1.1.2', '@visual-framework/vf-pagination': '1.1.0', '@visual-framework/vf-sass-config': '2.6.1', '@visual-framework/vf-sass-starter': '0.1.20', '@visual-framework/vf-search': '^3.0.0-alpha.0', '@visual-framework/vf-section-header': '1.5.1', '@visual-framework/vf-sidebar': '^1.0.0-alpha.2', '@visual-framework/vf-stack': '^2.1.1', '@visual-framework/vf-summary': '1.5.0', '@visual-framework/vf-table': '1.2.0-rc.2', '@visual-framework/vf-tabs': '2.0.0', '@visual-framework/vf-text': '1.0.2', '@visual-framework/vf-u-fullbleed': '1.2.2', '@visual-framework/vf-utility-classes': '2.0.0' });
tree.overwrite(packageJsonFileName, JSON.stringify(packageJson, null, 2));
}
const angularJsonFileName = (0, core_1.normalize)(`/${_options.path ? _options.path + '/' : ''}angular.json`);
const angularJsonBuffer = tree.read(angularJsonFileName);
if (angularJsonBuffer !== null) {
const angularJson = JSON.parse(angularJsonBuffer.toString());
const projectName = Object.keys(angularJson.projects)[0];
const build = angularJson.projects[projectName].architect.build;
build.options.assets = build.options.assets.concat([
{
glob: '**/*',
input: './node_modules/@visual-framework/vf-font-plex-mono/assets/IBM-Plex-Mono',
output: './assets/fonts/IBM-Plex-Mono',
},
{
glob: '**/*',
input: './node_modules/@visual-framework/vf-font-plex-sans/assets/IBM-Plex-Sans',
output: './assets/fonts/IBM-Plex-Sans',
},
]);
build.options.stylePreprocessorOptions = {
includePaths: [
'node_modules/@visual-framework/',
'src/styles',
],
};
tree.overwrite(angularJsonFileName, JSON.stringify(angularJson, null, 2));
}
return tree;
};
}
exports.lifeSciencesPortalVisualFramework = lifeSciencesPortalVisualFramework;