| THEME_NPM_NAME |
Default value : `@backbase/ui-ang`
|
| appModulePath |
Default value : `apps/${appName}/src/app/app.module.ts`
|
| appName |
Type : string
|
Default value : 'my-example-app'
|
| appName |
Type : string
|
Default value : 'web-app'
|
| collectionPath |
Type : string
|
Default value : 'src/collection.json'
|
| componentPath |
Default value : `/apps/${appName}/src/app/app.component.ts`
|
| options |
Type : Schema
|
Default value : {
name: appName,
skipPackageJson: false,
}
|
| schematicName |
Type : string
|
Default value : 'app'
|
| templatePath |
Default value : `/apps/${appName}/src/app/app.component.html`
|
| bbAng |
Type : object
|
Default value : {
name: '@bb-cli/bb-ang',
version: '~3.2.0',
}
|
| newScripts |
Type : []
|
Default value : [
{
command: 'bb-ang check-api',
name: 'api:check',
},
{
command: 'bb-ang extract-api',
name: 'api:extract',
},
]
|
| BBCoreModuleName |
Type : string
|
Default value : 'BackbaseCoreModule'
|
| bundleDefinitionExport |
Type : string
|
Default value : 'bundlesDefinition'
|
| writer |
Type : Writer
|
Default value : (
bundlesConfig: Array<BundleConfig>,
moduleDefinition: ModuleDefinition,
options: Partial<{ project: string }> = {},
): Rule => {
let bundleNumber = 1;
const generateBundleHash = () => bundleNumber++;
return async (tree: Tree): Promise<void> => {
const workspace = await getWorkspace(tree);
const projectName = options.project || workspace.extensions.defaultProject;
if (!projectName) {
throw new SchematicsException(`Couldn't find a default project`);
}
const project = workspace.projects.get(projectName);
if (!project?.sourceRoot) {
throw new SchematicsException('Project missing required "sourceRoot" property in angular.json');
}
const appModuleFilePath = join(normalize(project.sourceRoot), 'app', 'app.module.ts');
const existingAppModule = tree.read(appModuleFilePath);
if (!existingAppModule) {
throw new SchematicsException(`App module not found at ${appModuleFilePath}`);
}
const appModuleFile = createSourceFile(appModuleFilePath, existingAppModule.toString('utf-8'));
const bundles = new Map<string, { file: string; components: Set<string> }>();
const bundledModules = new Set<string>();
const addToBundle = (module: string, file: string, component: string): void => {
const bundle = bundles.get(module) || { file, components: new Set() };
if (bundle.file !== file) {
throw new SchematicsException(`Multiple sources of ${module} - ${bundle.file} / ${file}`);
}
bundle.components.add(component);
bundles.set(module, bundle);
};
bundlesConfig.forEach((bundleConfig) => {
const bundleHash = generateBundleHash();
const bundleFile = `bundle-${bundleHash}`;
const bundlePath = join(normalize(<string>project.sourceRoot), 'bundles', `${bundleFile}.ts`);
const bundleModuleName = `Bundle${bundleHash}Module`;
const ngModules = new Set<string>();
const imports = new Map<string, Set<string>>();
bundleConfig.forEach((classId) => {
const module = moduleDefinition.get(classId);
if (!module) {
throw new SchematicsException(`No module found for component with classId ${classId}`);
}
ngModules.add(module.ngModule.name);
bundledModules.add(module.ngModule.name);
const ngModulesFromImport = imports.get(module.importPath) || new Set<string>();
imports.set(module.importPath, ngModulesFromImport.add(module.ngModule.name));
addToBundle(bundleModuleName, bundleFile, classId);
});
tree.create(bundlePath, bundleContent(bundlePath, bundleModuleName, imports, ngModules));
});
const bundleDefinitionPath = join(normalize(project.sourceRoot), 'app', 'bundles-definition.ts');
tree.create(bundleDefinitionPath, configContent(bundles));
removeUnusedImports(appModuleFile, bundledModules);
appModuleFile.addImportDeclaration({
namedImports: [{ name: 'bundlesDefinition' }],
moduleSpecifier: './bundles-definition',
});
removeModuleImports(appModuleFile, 'AppModule', bundledModules);
updateImportConfig(appModuleFile, 'AppModule', BBCoreModuleName, [
{
key: 'lazyModules',
value: bundleDefinitionExport,
},
]);
tree.overwrite(appModuleFilePath, appModuleFile.getFullText());
};
}
|
| collectionPath |
Type : string
|
Default value : 'src/collection.json'
|
| componentTsPath |
Default value : `/libs/${widgetName}/src/${widgetName}.component.ts`
|
| options |
Type : Schema
|
Default value : {
name: widgetName,
project: projectName,
}
|
| projectName |
Type : string
|
Default value : 'test'
|
| schematicName |
Type : string
|
Default value : 'widget'
|
| templatePath |
Default value : `/libs/${widgetName}/src/${widgetName}.component.html`
|
| widgetName |
Type : string
|
Default value : 'test-widget'
|
| DESIGN_SYSTEM_DEFAULT_RUN_SCRIPT_NAME |
Type : string
|
Default value : 'design-system'
|
| DESIGN_SYSTEM_NPM_PACKAGE_NAME |
Type : string
|
Default value : '@backbase/design-system-ang'
|
| DESIGN_SYSTEM_NPM_VERSION |
Type : string
|
Default value : '^1.0.0'
|
| foundationAng |
Type : object
|
Default value : {
name: '@backbase/foundation-ang',
version: '^4.34.0',
}
|
| foundationAng |
Type : object
|
Default value : {
name: '@backbase/foundation-ang',
version: '^4.12.0',
}
|
| ngBootstrap |
Type : object
|
Default value : {
name: '@ng-bootstrap/ng-bootstrap',
version: '5.1.1',
}
|
| isNamedImportSpecifier |
Default value : (namedImport: string) => (importSpecifier: ImportSpecifier) =>
importSpecifier.getName() === namedImport
|
| manualProcess |
Default value : `
## Add tslint file inside each library folder
In each library folder add "tslint.json" file next to "public_api.ts" file with the following content:
${libraryRules}
`
|
| schematicsVersion |
Type : string
|
Default value : '2.10.2'
|
| newCompilerOptions |
Type : object
|
Default value : { module: 'esNext' }
|
| tsConfigFileName |
Type : string
|
Default value : 'tsconfig.app.json'
|
| newCompilerOptions |
Type : object
|
Default value : { module: 'es2015' }
|
| tsConfigFileName |
Type : string
|
Default value : 'tsconfig.app.json'
|
| NEW_MODULE |
Type : string
|
Default value : '@backbase/ui-ang'
|
| OLD_MODULE |
Type : string
|
Default value : '@backbase/foundation-ang/ui'
|
| uiAng |
Type : object
|
Default value : {
name: '@backbase/ui-ang',
version: '4.152.0',
}
|
| updateEngines |
Type : Rule
|
Default value : chain([
updatePackageJson(assocPath(['engines', 'node'], '^10.13.0 || ^12.16.1')),
updatePackageJson(assocPath(['engines', 'npm'], '^6.11.0')),
])
|
| manualProcess |
Default value : `
## Please update "module" in tsconfig.spec.json to "ES2020"
So your file should look like this:
{
...
"compilerOptions": {
...,
"module": "ES2020"
},
...
}
`
|
| tsConfigFilePath |
Type : string
|
Default value : './tsconfig.spec.json'
|
| uiAng |
Type : object
|
Default value : {
name: '@backbase/ui-ang',
version: '^7.5.0',
}
|