Every line of 'ng build --prod' 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.
81 async function prodBuild(env) { 82 let config = await clientConfig(env); 83 await transformConfig(env, config); 84 85 if (env.prerender) { 86 let ssrConfig = serverConfig(env); 87 await transformConfig(env, ssrConfig, true); 88 let serverCompiler = webpack(ssrConfig); 89 await runCompiler(serverCompiler); 90 } 91 92 let clientCompiler = webpack(config); 93 let stats = await runCompiler(clientCompiler); 94 95 // Timeout for plugins that work on `after-emit` event of webpack 96 await new Promise(r => setTimeout(r, 20)); 97 98 return showStats(stats); 99 }
167 get prodBuilder(): Observable { 168 return Observable.fromPromise(rollup.rollup({ 169 entry: path.resolve(__dirname, '../../aot/src/main.aot.js'), 170 context: 'this', 171 plugins: [ 172 angular({ 173 preprocessors: { 174 style: (scss: string, path: string) => { 175 return sass.renderSync({ file: path, outputStyle: 'compressed' }).css; 176 } 177 } 178 }), 179 commonjs(), 180 nodeResolve({ jsnext: true, main: true, browser: true }), 181 buble(), 182 uglify(), 183 progress() 184 ] 185 })); 186 };
24 testBuild () { 25 this.output = path.resolve('./test/lib') 26 27 this.clean() 28 29 this.tasks.add(`Generate test files in ${this.output}`, next => { 30 let excluded = [] 31 let ui = new this.Table() 32 33 ui.div({ 34 text: this.COLORS.subtle('Generated Files:'), 35 padding: [1, 0, 0, 5] 36 }) 37 38 console.log(ui.toString()) 39 40 this.walk(this.source).forEach(filepath => { 41 let content = this.readFileSync(filepath) 42 43 // If the file is a partial, exclude it 44 if (this.exclusion.test(content)) { 45 this.PARTIALS[filepath] = content 46 excluded.push(this.relativePath(filepath)) 47 } else { 48 this.writeFileSync(this.outputDirectory(filepath), this.includePartials(filepath, content)) 49 this.success(` ${this.relativePath(filepath)}`) 50 } 51 }) 52 53 ui = new this.Table() 54 55 ui.div({ 56 text: this.COLORS.subtle('Partials Identified:') + '\n' + this.COLORS.info(excluded.join('\n')), 57 padding: [1, 0, 1, 5] 58 }) 59 60 console.log(ui.toString()) 61 62 next() 63 }) 64 }
134 function devBuild() { 135 var target = gulp.src(__dirname + '/index.html'); 136 var sources = gulp.src([__dirname + '/app/**/**.js'], {read: true}); 137 var styles = gulp.src([__dirname + '/app/**/**.css'], {read: false}); 138 139 return target 140 .pipe(gulpInject(gulp.src(mainBowerFiles(), {read: false}), {name: 'bower'})) 141 .pipe(gulpInject(sources.pipe(angularFilesort()))) 142 .pipe(gulpInject(styles)) 143 .pipe(gulp.dest(__dirname)); 144 }
48 function browserifyBuild (isStandalone, useDebug) { 49 return function () { 50 return new Promise(function (resolve, reject) { 51 var b = browserify('./lib/specs.js', { 52 debug: useDebug, 53 standalone: 'SwaggerTools.specs' 54 }); 55 56 if (!isStandalone) { 57 // Expose Bower modules so they can be required 58 exposify.config = { 59 'async': 'async', 60 'debug': 'debug', 61 'json-refs': 'JsonRefs', 62 'js-yaml': 'jsyaml', 63 'lodash': '_', 64 'spark-md5': 'SparkMD5', 65 'swagger-converter': 'SwaggerConverter.convert', 66 'traverse': 'traverse', 67 'z-schema': 'ZSchema' 68 }; 69 70 b.transform('exposify'); 71 } 72 73 b.bundle() 74 .pipe(source('swagger-tools' + (isStandalone ? '-standalone' : '') + (!useDebug ? '-min' : '') + '.js')) 75 .pipe($.if(!useDebug, buffer())) 76 .pipe($.if(!useDebug, $.uglify())) 77 .pipe(gulp.dest('browser/')) 78 .on('error', reject) 79 .on('end', resolve); 80 }); 81 }; 82 }
51 async function runNgsscbuild(options: Options) { 52 // A "run" can have multiple outputs, and contains progress information. 53 const run = await architect.scheduleBuilder( 54 'angular-server-side-configuration:ngsscbuild', options, { logger }); 55 56 // The "result" member (of type BuilderOutput) is the next output. 57 const output = await run.result; 58 59 // Stop the builder from running. This stops Architect from keeping 60 // the builder-associated states in memory, since builders keep waiting 61 // to be scheduled. 62 await run.stop(); 63 return output; 64 }
31 public static doBuild(buildContext: BuildContext): void { 32 console.log(`[clean]: Starting`); 33 const tscPath: string = path.join(buildContext.projectFolder, 'node_modules/.bin/rush-tsc'); 34 child_process.execSync(tscPath, { stdio: 'inherit' }); 35 console.log(`[clean]: Finished`); 36 }
270 function build ( config, done ) { 271 272 log( `Building ${config.input}` ) 273 274 rollup.rollup( config ) 275 .then( ( bundle ) => { 276 277 bundle.write( config.output ) 278 .then( ( r ) => { 279 done() 280 } ) 281 .catch( ( error ) => { 282 log( red( error ) ) 283 done() 284 } ) 285 286 } ) 287 .catch( ( error ) => { 288 log( red( error ) ) 289 done() 290 } ) 291 292 }
54 build(env, options) { 55 const config = utils.initWebpackConfig(this.program, { env, cliDevtool : options.devtool}, { speed: options.speed }); 56 // 编译完成, 启动 HTTP Server 访问静态页面 57 if (options.server) { 58 const done = config.config.done; 59 config.config.done = (multiCompiler, compilation) => { 60 done && done(multiCompiler, compilation); 61 const compiler = multiCompiler.compilers.find(item => { 62 return item.options.target === 'web'; 63 }); 64 if (compiler) { // 自动解析 output.path 65 const dist = compiler.options.output.path; 66 const port = options.server === true ? undefined : options.server; 67 tool.httpServer({ 68 dist, 69 port 70 }); 71 } 72 }; 73 } 74 builder.build(config); 75 }
12 async function build() { 13 const env = getEnv() 14 await run(clean) 15 await run(copyEnvConfig, env) 16 await run(copyPublic) 17 await run(copyPkg) 18 await run(buildClient, env) 19 await run(copyAssets) 20 await run(buildServer, env) 21 }