Every line of 'update typescript angular' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
27 function updateAngularJsonFile(shellappPath) { 28 const angularJsonPath = `${shellappPath}/angular.json`; 29 console.log(`Updating ${angularJsonPath}`); 30 //Modify the copied angular.json file 31 const angularJsonDistFile = filesystem.readFileSync(angularJsonPath); 32 const AngularJsonDistData = JSON.parse(angularJsonDistFile); 33 const storefrontAppConfig = { 34 storefrontapp: AngularJsonDistData.projects.storefrontapp 35 }; 36 console.log(` Removing all projects except "storefrontapp".`); 37 AngularJsonDistData['projects'] = {}; 38 AngularJsonDistData.projects = storefrontAppConfig; 39 40 //Save changes to the copied Angular.json file 41 filesystem.writeFileSync( 42 angularJsonPath, 43 JSON.stringify(AngularJsonDistData, null, 2), 44 err => { 45 if (err) { 46 return console.error(err); 47 } 48 console.log(`Done.`); 49 } 50 ); 51 }
122 private updateAngularSources( 123 folder: string, 124 name: string 125 ) { 126 return new Promise(async (resolve, reject) => { 127 try { 128 const envFiles = [ 129 resolvePath(folder, 'apps', name, 'src', 'environments', 'environment.prod.ts'), 130 resolvePath(folder, 'apps', name, 'src', 'environments', 'environment-server.prod.ts') 131 ]; 132 envFiles.forEach(envFile => { 133 const data = readFileSync(envFile, 'utf8').toString(); 134 const newData = data.replace( 135 'https://rucken-core-nestjs.now.sh', 136 '' 137 ); 138 writeFileSync(envFile, newData, 'utf8'); 139 }); 140 resolve(); 141 } catch (error) { 142 reject(error); 143 } 144 }); 145 }
12 function updateMain(angularJsImport: string, options: Schema): Rule { 13 return (host: Tree) => { 14 const { 15 mainPath, 16 moduleClassName, 17 moduleSpec, 18 bootstrapComponentClassName, 19 bootstrapComponentFileName 20 } = readBootstrapInfo(host, options.project); 21 22 host.overwrite( 23 mainPath, 24 // prettier-ignore 25 `import { enableProdMode, StaticProvider } from '@angular/core'; 26 import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 27 28 import * as angular from 'angular'; 29 import { downgradeComponent, downgradeModule, setAngularJSGlobal } from '@angular/upgrade/static'; 30 31 import { ${moduleClassName} } from '${moduleSpec}'; 32 import { environment } from './environments/environment'; 33 import '${angularJsImport}'; 34 import { ${bootstrapComponentClassName} } from '${bootstrapComponentFileName}'; 35 36 export function bootstrapAngular(extra: StaticProvider[]): any { 37 setAngularJSGlobal(angular); 38 if (environment.production) { 39 enableProdMode(); 40 } 41 return platformBrowserDynamic(extra) 42 .bootstrapModule(${moduleClassName}) 43 .catch(err => console.log(err)); 44 } 45 46 const downgraded = angular 47 .module('downgraded', [downgradeModule(bootstrapAngular)]) 48 .directive('appRoot', downgradeComponent({ component: ${bootstrapComponentClassName}, propagateDigest: false })); 49 50 angular.bootstrap(document, ['${options.name}', downgraded.name]);` 51 ); 52 53 return host; 54 }; 55 }