Browse Source

Merge pull request #1273 from ckeditor/umberto-arguments

Internal: Cleaned up how and which params are passed to Umberto.
Maciej Bukowski 7 years ago
parent
commit
e5b8c5629b

+ 9 - 2
docs/framework/guides/contributing/development-environment.md

@@ -185,13 +185,20 @@ npm run docs
 
 The documentation will be available in `build/docs/`.
 
-This task accepts two arguments which can speed up the process:
+This task accepts the following arguments:
 
 * `--skip-api` – Skips building the API documentation (which takes the majority of the total time).
 * `--skip-snippets` – Skips building live snippets.
 * `--skip-validation` – Skips the final link validation.
+* `--watch` – Runs the documentation generator in a watch mode. It covers guides (it does not cover API docs).
+* `--production` – Minifies the assets and performs other actions which are unnecessary during CKEditor 5 development.
+* `--verbose` – Prints out more information.
 
-Note: These arguments must be passed after additional `--`: `npm run docs -- --skip-api`.
+Note: These arguments must be passed after additional `--`:
+
+```
+npm run docs -- --skip-api
+```
 
 ## Bisecting through a multi-repository
 

+ 16 - 24
scripts/docs/build-docs.js

@@ -14,40 +14,30 @@ const buildApiDocs = require( './buildapi' );
 const skipLiveSnippets = process.argv.includes( '--skip-snippets' );
 const skipApi = process.argv.includes( '--skip-api' );
 const skipValidation = process.argv.includes( '--skip-validation' );
-const dev = process.argv.includes( '--dev' );
 const production = process.argv.includes( '--production' );
+const watch = process.argv.includes( '--watch' );
+const verbose = process.argv.includes( '--verbose' );
 
 buildDocs();
 
 function buildDocs() {
-	if ( skipApi ) {
-		const fs = require( 'fs' );
-		const apiJsonPath = './docs/api/output.json';
-
-		if ( fs.existsSync( apiJsonPath ) ) {
-			fs.unlinkSync( apiJsonPath );
-		}
+	let promise;
 
-		runUmberto( {
-			skipLiveSnippets,
-			skipApi,
-			skipValidation,
-			dev,
-			production
-		} ).then( () => process.exit() );
-
-		return;
+	if ( skipApi ) {
+		promise = Promise.resolve();
+	} else {
+		promise = buildApiDocs();
 	}
 
-	// Simple way to reuse existing api/output.json:
-	// return Promise.resolve()
-	buildApiDocs()
+	promise
 		.then( () => {
 			return runUmberto( {
 				skipLiveSnippets,
+				skipApi,
 				skipValidation,
-				dev,
-				production
+				production,
+				watch,
+				verbose
 			} );
 		} );
 }
@@ -58,12 +48,14 @@ function runUmberto( options ) {
 	return umberto.buildSingleProject( {
 		configDir: 'docs',
 		clean: true,
-		dev: options.dev,
+		dev: !options.production,
 		skipLiveSnippets: options.skipLiveSnippets,
 		skipValidation: options.skipValidation,
 		snippetOptions: {
 			production: options.production
 		},
-		skipApi: options.skipApi
+		skipApi: options.skipApi,
+		verbose: options.verbose,
+		watch: options.watch
 	} );
 }