@@ -13,11 +13,11 @@ const requirejs = require('requirejs');
1313const util = require ( './util' ) ;
1414const config = require ( './config' ) ;
1515
16- const npmCopy = require ( './npmCopyConfig ' ) ;
16+ const npmCopy = require ( './npmCopy ' ) ;
1717const mainJsInjector = require ( './mainJsInjector' ) ;
1818const indexHtmlInjector = require ( './indexHtmlInjector' ) ;
19- const CONSTANTS = require ( './constants' ) ;
2019const svg = require ( './svg' ) ;
20+ const CONSTANTS = require ( './constants' ) ;
2121
2222function _getUglyCode ( file , uglifyOptions ) {
2323 const code = fs . readFileSync ( file , 'utf-8' ) ;
@@ -138,7 +138,7 @@ function _copyFilesExcludeScss(srcBase, destBase) {
138138 } ) ;
139139 }
140140 } catch ( err ) {
141- console . log ( err ) ;
141+ util . log ( err ) ;
142142 }
143143}
144144
@@ -228,7 +228,7 @@ function _renameNlsDirs() {
228228
229229module . exports = {
230230 clean : function _clean ( context ) {
231- console . log ( 'cleaning staging path.... .' ) ;
231+ util . log ( 'Cleaning staging path.' ) ;
232232 const opts = context . opts ;
233233 const stagingPath = opts . stagingPath ;
234234 const filePath = util . destPath ( stagingPath ) ;
@@ -242,83 +242,95 @@ module.exports = {
242242 } ,
243243
244244 copy : function _copySrcToStaging ( context ) {
245- console . log ( 'copy files to staging directory.... .' ) ;
245+ util . log ( 'Copy files to staging directory.' ) ;
246246 const fileResult = util . getFileList ( context . buildType , context . opts . copySrcToStaging . fileList ) ;
247247 return _copyFileToStaging ( fileResult )
248248 . then ( ( ) => {
249- console . log ( 'copy finished.. .' ) ;
249+ util . log ( 'Copy finished.' ) ;
250250 return context ;
251251 } ) ;
252252 } ,
253253
254254 copyLibs : function _copyLibsToStaging ( context ) {
255- console . log ( 'copy library files to staging directory.... .' ) ;
255+ util . log ( 'Copy library files to staging directory.' ) ;
256256 const opts = context . opts ;
257257 const buildType = context . buildType ;
258258 const platform = context . platform ;
259- const ojetLibs = npmCopy . getCopyLibFileList ( platform , buildType ) ;
260- const thirdPartyLibs = util . getFileList ( buildType , opts . copyLibsToStaging . fileList ) ;
259+ const pathMappingLibs = util . getFileList ( buildType ,
260+ npmCopy . getMappingLibsList ( buildType , platform ) ) ;
261+ const nonMappingLibs = npmCopy . getNonMappingFileList ( buildType , platform ) ;
261262 const customLibs = util . getFileList ( buildType , opts . copyCustomLibsToStaging . fileList ) ;
262- return _copyFileToStaging ( ojetLibs . concat ( thirdPartyLibs , customLibs ) )
263+ return _copyFileToStaging ( nonMappingLibs . concat ( pathMappingLibs , customLibs ) )
263264 . then ( ( ) => {
264- console . log ( 'copy finished.. .' ) ;
265+ util . log ( 'Copy finished.' ) ;
265266 npmCopy . renameAltaThemeFiles ( config ( 'paths' ) ) ;
266267 return context ;
267268 } ) ;
268269 } ,
269270
270271 injectPaths : function _injectMainPaths ( context ) {
271- console . log ( 'running injection task.... .' ) ;
272+ util . log ( 'Running injection tasks .' ) ;
272273 return new Promise ( ( resolve , reject ) => {
273274 mainJsInjector . injectPaths ( context )
274275 . then ( ( ) => {
275- console . log ( 'mainJs paths injection finished. .' ) ;
276+ util . log ( 'Task main.js paths injection finished.' ) ;
276277 resolve ( context ) ;
277278 } )
278279 . catch ( err => reject ( err ) ) ;
279280 } ) ;
280281 } ,
281282
282283 injectLocalhostCspRule : function _injectLocalhostCspRule ( context ) {
283- console . log ( 'running localhost csp rule injection task.... .' ) ;
284+ util . log ( 'Running localhost csp rule injection task.' ) ;
284285
285286 return new Promise ( ( resolve , reject ) => {
286287 indexHtmlInjector . injectLocalhostCspRule ( context )
287288 . then ( ( ) => {
288- console . log ( 'indexHtml localhost csp rule injection finished..' ) ;
289+ util . log ( 'Task index.html localhost csp rule injection finished.' ) ;
290+ resolve ( context ) ;
291+ } )
292+ . catch ( err => reject ( err ) ) ;
293+ } ) ;
294+ } ,
295+
296+ injectCdnBundleScript : function _injectCdnBundleScript ( context ) {
297+ return new Promise ( ( resolve , reject ) => {
298+ indexHtmlInjector . injectCdnBundleScript ( context )
299+ . then ( ( ) => {
300+ util . log ( 'Task index.html cdn bundle injection finished.' ) ;
289301 resolve ( context ) ;
290302 } )
291303 . catch ( err => reject ( err ) ) ;
292304 } ) ;
293305 } ,
294306
295307 injectTheme : function _injectTheme ( context ) {
296- console . log ( 'running theme injection task.... .' ) ;
308+ util . log ( 'Running theme injection task.' ) ;
297309
298310 return new Promise ( ( resolve , reject ) => {
299311 indexHtmlInjector . injectThemePath ( context )
300312 . then ( ( ) => {
301- console . log ( 'indexHtml theme path injection finished. .' ) ;
313+ util . log ( 'Task index.html theme path injection finished.' ) ;
302314 resolve ( context ) ;
303315 } )
304316 . catch ( err => reject ( err ) ) ;
305317 } ) ;
306318 } ,
307319
308320 copyThemes : function _copyThemes ( context ) {
309- console . log ( 'running theme copy task.... .' ) ;
321+ util . log ( 'Running theme copy task.' ) ;
310322 return new Promise ( ( resolve , reject ) => {
311323 _copyThemesToStaging ( context )
312324 . then ( ( ) => {
313- console . log ( 'theme copy finished.. .' ) ;
325+ util . log ( 'Theme copy task finished.' ) ;
314326 resolve ( context ) ;
315327 } )
316328 . catch ( err => reject ( err ) ) ;
317329 } ) ;
318330 } ,
319331
320332 uglify : function _uglify ( context ) {
321- console . log ( 'running uglify tasks.... .' ) ;
333+ util . log ( 'Running uglify task .' ) ;
322334
323335 const opts = context . opts ;
324336 const buildType = context . buildType ;
@@ -329,44 +341,44 @@ module.exports = {
329341 return new Promise ( ( resolve , reject ) => {
330342 _writeUglyCodeToFile ( fileResult , uglifyConfig . options )
331343 . then ( ( ) => {
332- console . log ( 'uglify finished.. .' ) ;
344+ util . log ( 'Task uglify finished.' ) ;
333345 resolve ( context ) ;
334346 } )
335347 . catch ( err => reject ( err ) ) ;
336348 } ) ;
337349 } ,
338350
339351 requireJs : function _requireJs ( context ) {
340- console . log ( 'running requirejs tasks.... .' ) ;
352+ util . log ( 'Running requirejs task .' ) ;
341353
342354 const opts = context . opts ;
343355 const requireConfig = opts . requireJs ;
344356
345357 return new Promise ( ( resolve , reject ) => {
346358 requirejs . optimize ( requireConfig , ( ) => {
347- console . log ( 'requireJs finished.. .' ) ;
359+ util . log ( 'Task requirejs finished.' ) ;
348360 resolve ( context ) ;
349361 } , ( err ) => {
350- console . log ( err ) ;
362+ util . log ( err ) ;
351363 reject ( err ) ;
352364 } ) ;
353365 } ) ;
354366 } ,
355367
356368 sass : function _compileSass ( context ) {
357- console . log ( 'compiling sass... .' ) ;
369+ util . log ( 'Compiling sass.' ) ;
358370
359371 return new Promise ( ( resolve , reject ) => {
360372 if ( context . opts . sassCompile === false && svg !== true ) {
361- console . log ( 'sass compile skipped.. .' ) ;
373+ util . log ( 'Sass compile skipped.' ) ;
362374 resolve ( context ) ;
363375 } else {
364376 // require sass here to avoid depency error if node-sass is not installed
365377 const sass = require ( './sass' ) ; // eslint-disable-line global-require
366378 const sassPromises = sass . getPromises ( context ) ;
367379 Promise . all ( sassPromises )
368380 . then ( ( ) => {
369- console . log ( 'sass compile finished.. .' ) ;
381+ util . log ( 'Sass compile finished.' ) ;
370382 resolve ( context ) ;
371383 } )
372384 . catch ( err => reject ( err ) ) ;
@@ -375,7 +387,7 @@ module.exports = {
375387 } ,
376388
377389 cleanTemp : function _cleanTemp ( context ) {
378- console . log ( 'cleaning mainTemp.... .' ) ;
390+ util . log ( 'Cleaning mainTemp.' ) ;
379391 const opts = context . opts ;
380392 let tempPath = opts . stagingPath ;
381393 let tempName = opts . injectPaths ;
@@ -387,18 +399,18 @@ module.exports = {
387399 fs . remove ( filePath , ( err ) => {
388400 if ( err ) reject ( err ) ;
389401 } ) ;
390- console . log ( 'cleanMainTemp task finished.. .' ) ;
402+ util . log ( 'Task cleanMainTemp finished.' ) ;
391403 resolve ( context ) ;
392404 } ) ;
393405 } ,
394406
395407 spriteSvg : function _spriteSvg ( context ) {
396- console . log ( 'optimizing svg into SVG sprites.... .' ) ;
408+ util . log ( 'Optimizing svg into SVG sprites.' ) ;
397409 return new Promise ( ( resolve , reject ) => {
398410 svg . spriteSvg ( context , ( err ) => {
399411 if ( err ) reject ( err ) ;
400412 } ) ;
401- console . log ( 'svg task finished.. .' ) ;
413+ util . log ( 'Svg optimisation task finished.' ) ;
402414 resolve ( context ) ;
403415 } ) ;
404416 } ,
0 commit comments