@@ -50,6 +50,8 @@ var regularPlunker = require(path.resolve(TOOLS_PATH, 'plunker-builder/regularPl
5050var embeddedPlunker = require ( path . resolve ( TOOLS_PATH , 'plunker-builder/embeddedPlunker' ) ) ;
5151var fsUtils = require ( path . resolve ( TOOLS_PATH , 'fs-utils/fsUtils' ) ) ;
5252
53+ const WWW = argv . page ? 'www-pages' : 'www'
54+
5355const isSilent = ! ! argv . silent ;
5456if ( isSilent ) gutil . log = gutil . noop ;
5557const _dgeniLogLevel = argv . dgeniLog || ( isSilent ? 'error' : 'info' ) ;
@@ -747,7 +749,7 @@ gulp.task('harp-serve', () => {
747749
748750gulp . task ( 'serve-www' , ( ) => {
749751 // Serve generated site.
750- return execPromise ( ' npm run live-server ./www' ) ;
752+ return execPromise ( ` npm run live-server ${ WWW } ` ) ;
751753} ) ;
752754
753755gulp . task ( 'build-compile' , [ 'build-docs' ] , function ( ) {
@@ -758,7 +760,7 @@ gulp.task('check-deploy', ['build-docs'], function() {
758760 return harpCompile ( ) . then ( function ( ) {
759761 gutil . log ( 'compile ok' ) ;
760762 gutil . log ( 'running live server ...' ) ;
761- execPromise ( ' npm run live-server ./www' ) ;
763+ execPromise ( ` npm run live-server ${ WWW } ` ) ;
762764 return askDeploy ( ) ;
763765 } ) . then ( function ( shouldDeploy ) {
764766 if ( shouldDeploy ) {
@@ -902,11 +904,13 @@ function harpCompile() {
902904 env ( { vars : { NODE_ENV : "production" } } ) ;
903905 gutil . log ( "NODE_ENV: " + process . env . NODE_ENV ) ;
904906
905- if ( skipLangs && fs . existsSync ( 'www' ) && backupApiHtmlFilesExist ( 'www' ) ) {
907+ if ( argv . page ) harpJsonSetJade2NgTo ( true ) ;
908+
909+ if ( skipLangs && fs . existsSync ( WWW ) && backupApiHtmlFilesExist ( WWW ) ) {
906910 gutil . log ( `Harp site recompile: skipping recompilation of API docs for [${ skipLangs } ]` ) ;
907- gutil . log ( `API docs will be copied from existing www folder.` )
908- del . sync ( 'www -backup' ) ; // remove existing backup if it exists
909- renameIfExistsSync ( 'www' , 'www -backup' ) ;
911+ gutil . log ( `API docs will be copied from existing ${ WWW } folder.` )
912+ del . sync ( ` ${ WWW } -backup` ) ; // remove existing backup if it exists
913+ renameIfExistsSync ( WWW , ` ${ WWW } -backup` ) ;
910914 } else {
911915 gutil . log ( `Harp full site compile, including API docs for all languages.` ) ;
912916 if ( skipLangs )
@@ -918,11 +922,12 @@ function harpCompile() {
918922 gutil . log ( 'running harp compile...' ) ;
919923 showHideExampleNodeModules ( 'hide' ) ;
920924 showHideApiDir ( 'hide' ) ;
921- var spawnInfo = spawnExt ( 'npm' , [ 'run' , 'harp' , '--' , 'compile' , '.' , './www' ] ) ;
925+ var spawnInfo = spawnExt ( 'npm' , [ 'run' , 'harp' , '--' , 'compile' , '.' , WWW ] ) ;
922926 spawnInfo . promise . then ( function ( x ) {
923927 gutil . log ( "NODE_ENV: " + process . env . NODE_ENV ) ;
924928 showHideExampleNodeModules ( 'show' ) ;
925929 showHideApiDir ( 'show' ) ;
930+ harpJsonSetJade2NgTo ( false ) ;
926931 if ( x !== 0 ) {
927932 deferred . reject ( x )
928933 } else {
@@ -933,6 +938,7 @@ function harpCompile() {
933938 gutil . log ( "NODE_ENV: " + process . env . NODE_ENV ) ;
934939 showHideExampleNodeModules ( 'show' ) ;
935940 showHideApiDir ( 'show' ) ;
941+ harpJsonSetJade2NgTo ( false ) ;
936942 deferred . reject ( e ) ;
937943 } ) ;
938944 return deferred . promise ;
@@ -1050,21 +1056,21 @@ function _showHideApiDir(lang, showOrHide) {
10501056 renameIfExistsSync ( ...args ) ;
10511057}
10521058
1053- // For each lang in skipLangs, copy the API dir from www -backup to www .
1059+ // For each lang in skipLangs, copy the API dir from ${WWW} -backup to WWW .
10541060function restoreApiHtml ( ) {
10551061 const vers = 'latest' ;
10561062 skipLangs . forEach ( lang => {
10571063 const relApiDir = path . join ( 'docs' , lang , vers , 'api' ) ;
1058- const wwwApiSubdir = path . join ( 'www' , relApiDir ) ;
1059- const backupApiSubdir = path . join ( 'www -backup' , relApiDir ) ;
1064+ const apiSubdir = path . join ( WWW , relApiDir ) ;
1065+ const backupApiSubdir = path . join ( ` ${ WWW } -backup` , relApiDir ) ;
10601066 if ( fs . existsSync ( backupApiSubdir ) || argv . forceSkipApi !== true ) {
1061- gutil . log ( `cp ${ backupApiSubdir } ${ wwwApiSubdir } ` )
1062- fs . copySync ( backupApiSubdir , wwwApiSubdir ) ;
1067+ gutil . log ( `cp ${ backupApiSubdir } ${ apiSubdir } ` )
1068+ fs . copySync ( backupApiSubdir , apiSubdir ) ;
10631069 }
10641070 } ) ;
10651071}
10661072
1067- // For each lang in skipLangs, ensure API dir exists in www-backup
1073+ // For each lang in skipLangs, ensure API dir exists in folderName
10681074function backupApiHtmlFilesExist ( folderName ) {
10691075 const vers = 'latest' ;
10701076 var result = 1 ;
@@ -1079,6 +1085,14 @@ function backupApiHtmlFilesExist(folderName) {
10791085 return result ;
10801086}
10811087
1088+ function harpJsonSetJade2NgTo ( v ) {
1089+ const execSync = require ( 'child_process' ) . execSync ;
1090+ const harpJsonPath = path . join ( ANGULAR_IO_PROJECT_PATH , 'harp.json' ) ;
1091+ execSync ( `perl -pi -e 's/("jade2ng": *)\\w+/$1${ v } /' ${ harpJsonPath } ` ) ;
1092+ const harpJson = require ( harpJsonPath ) ;
1093+ gutil . log ( `jade2ng: ${ harpJson . globals . jade2ng } ` ) ;
1094+ }
1095+
10821096// Copies fileNames into destPaths, setting the mode of the
10831097// files at the destination as optional_destFileMode if given.
10841098// returns a promise
0 commit comments