Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* Set lib version depending on Angular version */
let packageVersion = packageVersionLatest;
/* Throw on unsupported versions */
if (angularMajorVersion >= 2 && angularMajorVersion <= 5) {
throw new SchematicsException('Angular versions < 6 are no longer supported.');
}
/* Manage LTS versions */
if (angularMajorVersion === 6 || angularMajorVersion === 7) {
packageVersion = packageVersionLTS;
}
addPackageJsonDependency(host, {
/* Default = prod dependency */
type: NodeDependencyType.Default,
name: packageName,
version: packageVersion,
/* Angular CLI will have pre-installed the package to get the schematics,
* so we need to overwrite to install the good versions */
overwrite: true,
});
return host;
};
}
it('should set static flag', async () => {
removePackageJsonDependency(appTree, '@angular/core');
addPackageJsonDependency(appTree, {
type: NodeDependencyType.Default,
name: '@angular/core',
version: '7.0.0'
});
const runner = new SchematicTestRunner('schematics', collectionPath);
const tree = await runner.runSchematicAsync('add-layout', options, appTree).toPromise();
const navigationMenu = tree.readContent(
'/src/app/shared/components/side-navigation-menu/side-navigation-menu.component.ts');
expect(navigationMenu).toContain('@ViewChild(DxTreeViewComponent)');
});
function nodeDependencyFactory(
packageName: string,
version: string
): NodeDependency {
return {
type: NodeDependencyType.Default,
name: packageName,
version,
overwrite: true
};
}
return (tree: Tree) => {
addDependencyToPackageJson(tree, options, {
type: NodeDependencyType.Default,
name: '@nguniversal/express-engine',
version: '^6.0.0'
});
addDependencyToPackageJson(tree, options, {
type: NodeDependencyType.Default,
name: '@nguniversal/module-map-ngfactory-loader',
version: '^6.0.0'
});
addDependencyToPackageJson(tree, options, {
type: NodeDependencyType.Default,
name: 'typescript-collections',
version: '^1.3.2'
});
addDependencyToPackageJson(tree, options, {
type: NodeDependencyType.Dev,
name: 'cp-cli',
version: '^1.1.0'
});
addDependencyToPackageJson(tree, options, {
type: NodeDependencyType.Dev,
name: 'cpy-cli',
version: '^1.0.1'
});
addDependencyToPackageJson(tree, options, {
type: NodeDependencyType.Default,
name: 'decompress',
type: NodeDependencyType.Default,
name: '@nguniversal/hapi-engine',
version: '^0.0.0-PLACEHOLDER',
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Default,
name: '@hapi/hapi',
version: 'HAPI_VERSION',
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Dev,
name: '@types/hapi__hapi',
version: '^18.2.5',
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Default,
name: '@hapi/inert',
version: '^5.2.0',
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Dev,
name: '@types/hapi__inert',
version: '^5.2.0',
});
return host;
};
}
return (host: Tree, context: SchematicContext) => {
let uiLibs: NodeDependency[] = [];
const core: NodeDependency[] = [
{type: NodeDependencyType.Default, version: '^7.0.0', name: '@ngx-metaui/rules'},
{type: NodeDependencyType.Default, version: '1.6.36', name: 'big-integer'},
{type: NodeDependencyType.Default, version: '1.3.0', name: 'object-hash'},
{type: NodeDependencyType.Default, version: '^0.11.4', name: 'object-path'},
{type: NodeDependencyType.Default, version: '^1.0.0', name: 'primeicons'},
{type: NodeDependencyType.Default, version: '7.0.0-beta.1', name: 'primeng'},
{type: NodeDependencyType.Default, version: '1.3.2', name: 'typescript-collections'},
{type: NodeDependencyType.Default, version: '1.3.6', name: 'quill'},
{type: NodeDependencyType.Default, version: '4.7.0', name: 'font-awesome'},
{type: NodeDependencyType.Dev, version: '^1.0.2', name: 'watch'}
];
if (options.uiLib === 'prime-ng') {
uiLibs = [
{type: NodeDependencyType.Default, version: '^7.0.0', name: '@ngx-metaui/primeng-rules'},
{type: NodeDependencyType.Default, version: '7.0.0-beta.1', name: 'primeng'},
{type: NodeDependencyType.Default, version: '1.3.6', name: 'quill'},
(tree: Tree, context: SchematicContext) => {
addPackageJsonDependency(tree, {
type: NodeDependencyType.Default,
name: '@fortawesome/fontawesome-svg-core',
version: svgCoreVersion,
});
addPackageJsonDependency(tree, {
type: NodeDependencyType.Default,
name: '@fortawesome/angular-fontawesome',
version: angularFontawesomeVersion,
});
const iconPackages = options.iconPackages != null ? options.iconPackages : ['free-solid'];
for (const pack of iconPackages) {
addPackageJsonDependency(tree, {
type: NodeDependencyType.Default,
name: `@fortawesome/${pack}-svg-icons`,
version: iconPackVersion,
return (host: Tree, context: SchematicContext) => {
if (!options.skipInstall) {
context.addTask(new NodePackageInstallTask());
}
addPackageJsonDependency(host, {
type: NodeDependencyType.Default,
name: '@nguniversal/hapi-engine',
version: '^0.0.0-PLACEHOLDER',
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Default,
name: '@hapi/hapi',
version: 'HAPI_VERSION',
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Dev,
name: '@types/hapi__hapi',
version: '^18.2.5',
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Default,
name: '@hapi/inert',
version: '^4.1.0',
name: '@ng-bootstrap/ng-bootstrap',
},
{
type: NodeDependencyType.Default,
version: '^2.13.2',
name: '@ng-select/ng-select',
},
{
type: NodeDependencyType.Default,
version: ngrxVersion,
name: '@ngrx/store',
},
{
type: NodeDependencyType.Default,
version: ngrxVersion,
name: '@ngrx/effects',
},
{
type: NodeDependencyType.Default,
version: ngrxVersion,
name: '@ngrx/router-store',
},
{
type: NodeDependencyType.Default,
version: '^4.2.1',
name: 'bootstrap',
},
{ type: NodeDependencyType.Default, version: '^15.0.6', name: 'i18next' },
{
type: NodeDependencyType.Default,
name: 'reflect-metadata',
version: '^0.1.13'
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Default,
name: '@nestjs/platform-express',
version: '^6.0.0'
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Default,
name: '@nguniversal/express-engine',
version: '^8.0.0'
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Default,
name: '@nguniversal/module-map-ngfactory-loader',
version: '^8.0.0'
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Dev,
name: 'ts-loader',
version: '^5.2.0'
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Dev,
name: 'wait-on',
version: '^3.2.0'
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Dev,
name: 'webpack-cli',