Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dependencies.forEach(dependency => {
addPackageJsonDependency(tree, dependency);
console.log(chalk.green(`✅️ Added ${dependency.name} to ${dependency.type}.`));
});
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)');
});
const dateAdapters: { [key: string]: string } = {
moment: momentVersion,
'date-fns': dateFnsVersion
};
const angularCalendarDependency: NodeDependency = nodeDependencyFactory(
'angular-calendar',
angularCalendarVersion
);
const dateAdapterLibrary = options.dateAdapter;
const dateAdapterLibraryDependency: NodeDependency = nodeDependencyFactory(
dateAdapterLibrary,
dateAdapters[dateAdapterLibrary]
);
addPackageJsonDependency(host, angularCalendarDependency);
context.logger.log(
'info',
`Added "${angularCalendarDependency.name}" into ${angularCalendarDependency.type}`
);
addPackageJsonDependency(host, dateAdapterLibraryDependency);
context.logger.log(
'info',
`Added "${dateAdapterLibraryDependency.name}" into ${dateAdapterLibraryDependency.type}`
);
return host;
};
}
'angular-calendar',
angularCalendarVersion
);
const dateAdapterLibrary = options.dateAdapter;
const dateAdapterLibraryDependency: NodeDependency = nodeDependencyFactory(
dateAdapterLibrary,
dateAdapters[dateAdapterLibrary]
);
addPackageJsonDependency(host, angularCalendarDependency);
context.logger.log(
'info',
`Added "${angularCalendarDependency.name}" into ${angularCalendarDependency.type}`
);
addPackageJsonDependency(host, dateAdapterLibraryDependency);
context.logger.log(
'info',
`Added "${dateAdapterLibraryDependency.name}" into ${dateAdapterLibraryDependency.type}`
);
return host;
};
}
dependencies.forEach(dependency => {
addPackageJsonDependency(tree, dependency);
context.logger.log(
'info',
`✅️ Added '${dependency.name}' into ${dependency.type}`
);
});
return (host: Tree) => {
addPackageJsonDependency(host, {
type: NodeDependencyType.Default,
name: '@nestjs/azure-storage',
version: '^1.0.0',
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Default,
name: '@azure/storage-blob',
version: '^10.4.0',
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Default,
name: 'dotenv',
version: '^8.0.0',
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Default,
function addDevExtremeDependency(host: Tree, options: any) {
addPackageJsonDependency(host, {
type: NodeDependencyType.Default,
name: 'devextreme',
version: options.dxversion || latestVersions['devextreme']
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Default,
name: 'devextreme-angular',
version: options.dxversion || latestVersions['devextreme-angular']
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Dev,
name: 'devextreme-cli',
version: latestVersions['devextreme-cli']
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Dev,
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',
version: '^3.1.0'
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Dev,
name: 'rimraf',
version: '^2.6.3'
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Dev,
name: 'nodemon',
version: '^1.18.11'
});
const pkgPath = '/package.json';
const buffer = host.read(pkgPath);
if (buffer === null) {
throw new SchematicsException('Could not find package.json');
}
return (host: Tree) => {
addPackageJsonDependency(host, {
type: NodeDependencyType.Default,
name: '@azure/functions',
version: '^1.0.3'
});
const pkgPath = '/package.json';
const buffer = host.read(pkgPath);
if (buffer === null) {
throw new SchematicsException('Could not find package.json');
}
const pkg = JSON.parse(buffer.toString());
pkg.scripts['start:azure'] = 'npm run build && func host start';
host.overwrite(pkgPath, JSON.stringify(pkg, null, 2));
return host;
};
return (host: Tree, context: SchematicContext) => {
if (!options.skipInstall) {
context.addTask(new NodePackageInstallTask());
}
addPackageJsonDependency(host, {
type: NodeDependencyType.Default,
name: '@nguniversal/express-engine',
version: '^0.0.0-PLACEHOLDER',
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Default,
name: 'express',
version: 'EXPRESS_VERSION',
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Dev,
name: '@types/express',
version: 'EXPRESS_TYPES_VERSION',
});
return host;
};
}