瀏覽代碼

Fixed scripts that build the documentation.

Kamil Piechaczek 7 年之前
父節點
當前提交
a5d875e421
共有 2 個文件被更改,包括 25 次插入6 次删除
  1. 12 3
      scripts/docs/build-and-publish-nightly.js
  2. 13 3
      scripts/docs/build-and-publish.js

+ 12 - 3
scripts/docs/build-and-publish-nightly.js

@@ -50,9 +50,12 @@ exec( 'rm -rf ckeditor5.github.io/docs/nightly/ckeditor5/latest' );
 // Copy built documentation to the new destination.
 // Copy built documentation to the new destination.
 exec( 'cp -R build/docs/* ckeditor5.github.io/docs/nightly/' );
 exec( 'cp -R build/docs/* ckeditor5.github.io/docs/nightly/' );
 
 
+// Umberto makes a symlink between the latest version (`projectVersion`) and "latest/" directory.
+// The symlink must be deleted in order to copy a documentation for `projectVersion` as `latest`.
+exec( 'rm -rf ckeditor5.github.io/docs/nightly/ckeditor5/latest' );
+
 // Copy the versioned documentation to latest/.
 // Copy the versioned documentation to latest/.
-exec( 'mkdir ckeditor5.github.io/docs/nightly/ckeditor5/latest' );
-exec( `cp -R ckeditor5.github.io/docs/nightly/ckeditor5/${ projectVersion }/* ckeditor5.github.io/docs/nightly/ckeditor5/latest` );
+exec( `cp -R ckeditor5.github.io/docs/nightly/ckeditor5/${ projectVersion } ckeditor5.github.io/docs/nightly/ckeditor5/latest` );
 
 
 // Change work directory in order to make a commit in CKEditor 5 page's repository.
 // Change work directory in order to make a commit in CKEditor 5 page's repository.
 process.chdir( path.join( process.cwd(), 'ckeditor5.github.io' ) );
 process.chdir( path.join( process.cwd(), 'ckeditor5.github.io' ) );
@@ -73,5 +76,11 @@ if ( exec( 'git diff --name-only docs/' ).trim().length ) {
 }
 }
 
 
 function exec( command ) {
 function exec( command ) {
-	return tools.shExec( command, { verbosity: 'error' } );
+	try {
+		return tools.shExec( command, { verbosity: 'error' } );
+	}
+	catch ( error ) {
+		console.error( error );
+		process.exit( 1 );
+	}
 }
 }

+ 13 - 3
scripts/docs/build-and-publish.js

@@ -40,9 +40,12 @@ exec( 'rm -rf ../ckeditor5.github.io/docs/nightly/ckeditor5/latest' );
 // Copy built documentation to the new destination.
 // Copy built documentation to the new destination.
 exec( 'cp -R build/docs/* ../ckeditor5.github.io/docs/nightly/' );
 exec( 'cp -R build/docs/* ../ckeditor5.github.io/docs/nightly/' );
 
 
+// Umberto makes a symlink between the latest version (`projectVersion`) and "latest/" directory.
+// The symlink must be deleted in order to copy a documentation for `projectVersion` as `latest`.
+exec( 'rm -rf ../ckeditor5.github.io/docs/nightly/ckeditor5/latest' );
+
 // Copy the versioned documentation to latest/.
 // Copy the versioned documentation to latest/.
-exec( 'mkdir ../ckeditor5.github.io/docs/nightly/ckeditor5/latest' );
-exec( `cp -R ../ckeditor5.github.io/docs/nightly/ckeditor5/${ projectVersion }/* ../ckeditor5.github.io/docs/nightly/ckeditor5/latest` );
+exec( `cp -R ../ckeditor5.github.io/docs/nightly/ckeditor5/${ projectVersion } ../ckeditor5.github.io/docs/nightly/ckeditor5/latest` );
 
 
 process.chdir( path.join( process.cwd(), '..', 'ckeditor5.github.io' ) );
 process.chdir( path.join( process.cwd(), '..', 'ckeditor5.github.io' ) );
 
 
@@ -61,5 +64,12 @@ if ( exec( 'git diff --name-only docs/' ).trim().length ) {
 process.chdir( path.join( process.cwd(), '..', 'ckeditor5' ) );
 process.chdir( path.join( process.cwd(), '..', 'ckeditor5' ) );
 
 
 function exec( command ) {
 function exec( command ) {
-	return tools.shExec( command, { verbosity: 'error' } );
+	try {
+		return tools.shExec( command, { verbosity: 'error' } );
+	}
+	catch ( error ) {
+		console.error( error );
+
+		process.exit( 1 );
+	}
 }
 }