Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const nxJson = getJsonFromFile(tree, nxConfigPath);
const npmScope = nxJson.npmScope;
const appsDir = tree.getDir('apps');
const appFolders = appsDir.subdirs;
// console.log("npmScope:", npmScope);
// console.log("prefix:", prefix);
// update {N} apps and configs
for (const dir of appFolders) {
// console.log(dir);
if (dir.indexOf('nativescript-') === 0) {
const appDir = `${appsDir.path}/${dir}`;
// console.log('appDir:', appDir);
createOrUpdate(tree, `${appDir}/tsconfig.esm.json`, getTsConfigESM());
createOrUpdate(tree, `${appDir}/tsconfig.json`, getTsConfig(npmScope));
}
}
return tree;
}
cwd,
'node_modules/@nstudio/schematics/src/app.nativescript/_files/app/app.module.ngfactory.d.ts'
);
// console.log('webpackConfigPath:', webpackConfigPath);
const ngAppFactory = fs.readFileSync(ngAppFactoryPath, 'UTF-8');
// update {N} apps and configs
for (const dir of appFolders) {
// console.log(dir);
if (dir.indexOf('nativescript-') === 0) {
const appDir = `${appsDir.path}/${dir}`;
// console.log('appDir:', appDir);
createOrUpdate(tree, `${appDir}/webpack.config.js`, webpackConfig);
createOrUpdate(
tree,
`${appDir}/app/app.module.ngfactory.d.ts`,
ngAppFactory
);
// update {N} app deps
const packagePath = `${appDir}/package.json`;
const packageJson = getJsonFromFile(tree, packagePath);
if (packageJson) {
packageJson.dependencies = packageJson.dependencies || {};
packageJson.devDependencies = packageJson.devDependencies || {};
packageJson.devDependencies = {
...packageJson.devDependencies,
'@angular/compiler-cli':
const npmScope = nxJson.npmScope;
const appsDir = tree.getDir('apps');
const appFolders = appsDir.subdirs;
// console.log("npmScope:", npmScope);
// console.log("prefix:", prefix);
// update {N} apps and configs
for (const dir of appFolders) {
// console.log(dir);
if (dir.indexOf('nativescript-') === 0) {
const appDir = `${appsDir.path}/${dir}`;
// console.log('appDir:', appDir);
createOrUpdate(tree, `${appDir}/tsconfig.esm.json`, getTsConfigESM());
createOrUpdate(tree, `${appDir}/tsconfig.json`, getTsConfig(npmScope));
}
}
return tree;
}
const cwd = process.cwd();
const webpackConfigPath = join(
cwd,
'node_modules/@nstudio/schematics/src/app.nativescript/_files/webpack.config.js'
);
// console.log('webpackConfigPath:', webpackConfigPath);
const webpackConfig = fs.readFileSync(webpackConfigPath, 'UTF-8');
// update {N} apps and configs
for (const dir of appFolders) {
// console.log(dir);
if (dir.indexOf('nativescript-') === 0) {
const appDir = `${appsDir.path}/${dir}`;
// console.log('appDir:', appDir);
createOrUpdate(tree, `${appDir}/webpack.config.js`, webpackConfig);
// update {N} app deps
const packagePath = `${appDir}/package.json`;
const packageJson = getJsonFromFile(tree, packagePath);
if (packageJson) {
packageJson.dependencies = packageJson.dependencies || {};
packageJson.devDependencies = packageJson.devDependencies || {};
packageJson.devDependencies = {
...packageJson.devDependencies,
'@angular/compiler-cli': '~6.1.1',
'nativescript-dev-webpack': '~0.15.0',
'@ngtools/webpack': '~6.1.1'
};
'node_modules/@nstudio/schematics/src/app.nativescript/_files/webpack.config.js'
);
// console.log('webpackConfigPath:', webpackConfigPath);
const webpackConfig = fs.readFileSync(webpackConfigPath, 'UTF-8');
// update {N} apps and configs
for (const dir of appFolders) {
// console.log(dir);
if (
dir.indexOf('nativescript-') === 0 ||
dir.indexOf('-nativescript') === 0
) {
const appDir = `${appsDir.path}/${dir}`;
// console.log('appDir:', appDir);
createOrUpdate(tree, `${appDir}/webpack.config.js`, webpackConfig);
createOrUpdate(tree, `${appDir}/app/main.ts`, mainFile);
// update {N} app deps
const packagePath = `${appDir}/package.json`;
const packageJson = getJsonFromFile(tree, packagePath);
if (packageJson) {
packageJson.dependencies = packageJson.dependencies || {};
packageJson.devDependencies = packageJson.devDependencies || {};
packageJson.devDependencies = {
...packageJson.devDependencies,
'@angular/compiler-cli': '~7.2.0',
'@ngtools/webpack': '~7.2.0',
'nativescript-dev-webpack': '~0.20.0',
'terser-webpack-plugin':
cwd,
'node_modules/@nstudio/schematics/src/app.nativescript/_files/app/main.ts'
);
// console.log('webpackConfigPath:', webpackConfigPath);
const mainFile = fs.readFileSync(mainPath, 'UTF-8');
// update {N} apps and configs
for (const dir of appFolders) {
// console.log(dir);
if (dir.indexOf('nativescript-') === 0) {
const appDir = `${appsDir.path}/${dir}`;
// console.log('appDir:', appDir);
createOrUpdate(tree, `${appDir}/webpack.config.js`, webpackConfig);
createOrUpdate(tree, `${appDir}/app/main.ts`, mainFile);
// update {N} app deps
const packagePath = `${appDir}/package.json`;
const packageJson = getJsonFromFile(tree, packagePath);
if (packageJson) {
packageJson.dependencies = packageJson.dependencies || {};
packageJson.devDependencies = packageJson.devDependencies || {};
packageJson.devDependencies = {
...packageJson.devDependencies,
'@angular/compiler-cli': '~7.0.0',
'@ngtools/webpack': '~7.0.0',
'nativescript-dev-webpack': '~0.18.0'
};
);
let hmrNavigation = fs.readFileSync(hmrNavigationPath, 'UTF-8');
// update {N} apps and configs
for (const dir of appFolders) {
// console.log(dir);
if (dir.indexOf('nativescript-') === 0) {
const appDir = `${appsDir.path}/${dir}`;
// console.log('appDir:', appDir);
createOrUpdate(tree, `${appDir}/app/main.ts`, mainFile);
}
}
if (tree.exists('xplat/nativescript')) {
createOrUpdate(
tree,
`xplat/nativescript/utils/livesync-navigation.ts`,
hmrNavigation
);
const utilsTreePath = 'xplat/nativescript/utils/index.ts';
const utilsFullPath = join(cwd, utilsTreePath);
let utilsIndex;
if (fs.existsSync(utilsFullPath)) {
utilsIndex = fs.readFileSync(utilsFullPath, 'UTF-8');
utilsIndex += `\nexport * from './livesync-navigation';`;
createOrUpdate(tree, utilsTreePath, utilsIndex);
}
}
return tree;
}
// console.log('webpackConfig:',webpackConfig);
const mainPath = join(
cwd,
'node_modules/@nstudio/schematics/src/app.nativescript/_files/app/main.ts'
);
// console.log('webpackConfigPath:', webpackConfigPath);
const mainFile = fs.readFileSync(mainPath, 'UTF-8');
// update {N} apps and configs
for (const dir of appFolders) {
// console.log(dir);
if (dir.indexOf('nativescript-') === 0) {
const appDir = `${appsDir.path}/${dir}`;
// console.log('appDir:', appDir);
createOrUpdate(tree, `${appDir}/webpack.config.js`, webpackConfig);
createOrUpdate(tree, `${appDir}/app/main.ts`, mainFile);
// update {N} app deps
const packagePath = `${appDir}/package.json`;
const packageJson = getJsonFromFile(tree, packagePath);
if (packageJson) {
packageJson.dependencies = packageJson.dependencies || {};
packageJson.devDependencies = packageJson.devDependencies || {};
packageJson.devDependencies = {
...packageJson.devDependencies,
'@angular/compiler-cli': '~7.0.0',
'@ngtools/webpack': '~7.0.0',
'nativescript-dev-webpack': '~0.18.0'
const tsConfigPath = join(
cwd,
'node_modules/@nstudio/schematics/src/app.electron/_files/tsconfig.json'
);
// console.log('tsConfigPath:', tsConfigPath);
const tsConfig = fs.readFileSync(tsConfigPath, 'UTF-8');
// console.log('tsConfig:',tsConfig);
// update electron apps
for (const dir of appFolders) {
// console.log(dir);
if (dir.indexOf('electron-') === 0 || dir.indexOf('-electron') > -1) {
const appDir = `${appsDir.path}/${dir}`;
// console.log('appDir:', appDir);
createOrUpdate(tree, `${appDir}/tsconfig.json`, tsConfig);
}
}
return tree;
}
schematics: {
'@schematics/angular:component': {
styleext: 'scss'
}
}
};
}
if (nxJson && nxJson.projects) {
nxJson.projects[dir] = {
tags: []
};
}
createOrUpdate(tree, `${appDir}/tsconfig.esm.json`, getTsConfigESM());
createOrUpdate(tree, `${appDir}/webpack.config.js`, getWebpackConfig());
createOrUpdate(
tree,
`${appDir}/tools/xplat-before-watch.js`,
getxPlatBeforeWatch(npmScope)
);
createOrUpdate(
tree,
`${appDir}/tools/xplat-postinstall.js`,
getxPlatPostinstall()
);
// update {N} app deps
const packagePath = `${appDir}/package.json`;
const packageJson = getJsonFromFile(tree, packagePath);