Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
};
}
type: NodeDependencyType.Default,
version: angularVersion || '~8.2.5',
name: '@angular/platform-server',
},
{
type: NodeDependencyType.Default,
version: '^8.1.1',
name: '@nguniversal/express-engine',
},
{
type: NodeDependencyType.Dev,
version: '^5.3.2',
name: 'ts-loader',
},
{
type: NodeDependencyType.Dev,
version: '^3.3.2',
name: 'webpack-cli',
},
];
dependencies.forEach(dependency => {
addPackageJsonDependency(tree, dependency);
context.logger.log(
'info',
`✅️ Added '${dependency.name}' into ${dependency.type}`
);
});
return tree;
};
}
rules.push((tree: Tree) => {
addDependencyToPackageJson(tree, options, {
type: NodeDependencyType.Dev,
name: 'ts-loader',
version: '4.2.0',
});
addDependencyToPackageJson(tree, options, {
type: NodeDependencyType.Dev,
name: 'webpack-cli',
version: '2.1.2'
});
addDependencyToPackageJson(tree, options, {
type: NodeDependencyType.Default,
name: 'cors',
version: '~2.8.4'
});
addDependencyToPackageJson(tree, options, {
type: NodeDependencyType.Default,
name: 'cp-cli',
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: '^5.2.0',
});
addPackageJsonDependency(host, {
type: NodeDependencyType.Dev,
name: '@types/hapi__inert',
version: '^5.2.0',
});
return 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;
};
}
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,
name: 'devextreme-themebuilder',
version: options.dxversion || latestVersions['devextreme']
});
return host;
}
type: NodeDependencyType.Default,
name: '@angular/cdk',
version: '^6.0.0'
});
addDependencyToPackageJson(tree, options, {
type: NodeDependencyType.Default,
name: '@angular/material',
version: '^6.0.0'
});
addDependencyToPackageJson(tree, options, {
type: NodeDependencyType.Default,
name: 'webpack-cli',
version: '2.1.2'
});
addDependencyToPackageJson(tree, options, {
type: NodeDependencyType.Dev,
name: 'ts-loader',
version: '4.2.0'
});
addDependencyToPackageJson(tree, options, {
type: NodeDependencyType.Default,
name: '@ngx-translate/core',
version: '^10.0.1'
});
addDependencyToPackageJson(tree, options, {
type: NodeDependencyType.Default,
name: '@ngx-translate/http-loader',
version: '^3.0.1'
});
return tree;
});
rules.push((tree: Tree) => {
return (tree: Tree) => {
addDependencyToPackageJson(tree, options, {
type: NodeDependencyType.Dev,
name: 'node-wget',
version: '^0.4.2'
});
addDependencyToPackageJson(tree, options, {
type: NodeDependencyType.Dev,
name: 'decompress',
version: '^4.2.0'
});
addDependencyToPackageJson(tree, options, {
type: NodeDependencyType.Dev,
name: 'decompress-targz',
version: '^4.1.1'
});
return tree;
}
}
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');
}
const pkg = JSON.parse(buffer.toString());
pkg.scripts['serve'] = 'node serve-script';
pkg.scripts['compile:server'] =
'webpack --config webpack.server.config.js --progress --colors';
pkg.scripts['serve:ssr'] = `node dist/server`;
pkg.scripts['build:ssr'] =