8
0
Pārlūkot izejas kodu

Merge branch 'master' into release

Piotrek Koszuliński 5 gadi atpakaļ
vecāks
revīzija
8640e70d70

+ 10 - 3
docs/builds/guides/development/custom-builds.md

@@ -35,16 +35,23 @@ In order to start developing CKEditor 5 you will require:
 
 ## Forking an existing build
 
-Start with [forking](https://help.github.com/articles/fork-a-repo/) one of the official builds (it will serve as the starting point for your custom one) and then clone your fork:
+Start with [forking](https://help.github.com/articles/fork-a-repo/) [the main `ckeditor5` repository](https://github.com/ckeditor/ckeditor5) (it will serve as the starting point for your customizations) and then clone your fork:
 
 ```bash
-git clone -b stable git@github.com:<your-username>/ckeditor5-build-classic.git
+git clone -b stable git@github.com:<your-username>/ckeditor5.git
+```
+
+Builds are available in the `packages/` directory. The directories are named `ckeditor5-build-*`.
+For example, use the following command to get to the classic build:
+
+```bash
+cd packages/ckeditor5-build-classic
 ```
 
 To make updating easier you may optionally add the original build repository to your Git remotes:
 
 ```bash
-git remote add upstream https://github.com/ckeditor/ckeditor5-build-classic.git
+git remote add upstream https://github.com/ckeditor/ckeditor5.git
 ```
 
 <info-box hint>

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 5 - 5
docs/builds/guides/integration/advanced-setup.md


+ 3 - 1
docs/framework/guides/contributing/development-environment.md

@@ -95,7 +95,9 @@ This task accepts the following arguments:
 
 * `--skip-api` &ndash; Skips building the API documentation (which takes the majority of the total time).
 * `--skip-snippets` &ndash; Skips building live snippets.
-* `--snippets=snippet-name` &ndash; Whitelists snippets to build (accepts glob patterns).
+* `--snippets=snippet-name` &ndash; Snippets to build (accepts glob patterns). If a snippet that you want to build uses another snippet as a source that provides an editor instance, you need to specify both snippets. See examples:
+    - `--snippets=features/*` - all snippets that starts with `features/` in their names will be built,
+    - `--snippets=classic-editor,build-classic-source` - all snippets that contains the specified strings in their names will be built.
 * `--skip-validation` &ndash; Skips the final link validation.
 * `--watch` &ndash; Runs the documentation generator in a watch mode. It covers guides but it does not cover API docs.
 * `--production` &ndash; Minifies the assets and performs other actions which are unnecessary during CKEditor 5 development.

+ 2 - 2
scripts/docs/build-docs.js

@@ -17,7 +17,7 @@ const skipValidation = process.argv.includes( '--skip-validation' );
 const production = process.argv.includes( '--production' );
 const watch = process.argv.includes( '--watch' );
 const verbose = process.argv.includes( '--verbose' );
-const whitelistedSnippets = process.argv.find( item => item.startsWith( '--snippets=' ) );
+const allowedSnippets = process.argv.find( item => item.startsWith( '--snippets=' ) );
 
 buildDocs();
 
@@ -59,7 +59,7 @@ function runUmberto( options ) {
 		skipValidation: options.skipValidation,
 		snippetOptions: {
 			production: options.production,
-			whitelistedSnippets: whitelistedSnippets ? whitelistedSnippets.replace( '--snippets=', '' ).split( ',' ) : []
+			allowedSnippets: allowedSnippets ? allowedSnippets.replace( '--snippets=', '' ).split( ',' ) : []
 		},
 		skipApi: options.skipApi,
 		verbose: options.verbose,

+ 25 - 11
scripts/docs/snippetadapter.js

@@ -22,7 +22,7 @@ const MULTI_LANGUAGE = 'multi-language';
  * @param {Set.<Snippet>} snippets Snippet collection extracted from documentation files.
  * @param {Object} options
  * @param {Boolean} options.production Whether to build snippets in production mode.
- * @param {Array.<String>|undefined} options.whitelistedSnippets An array that contains glob patterns.
+ * @param {Array.<String>|undefined} options.allowedSnippets An array that contains glob patterns.
  * @param {Object.<String, Function>} umbertoHelpers
  * @returns {Promise}
  */
@@ -80,12 +80,16 @@ module.exports = function snippetAdapter( snippets, options, umbertoHelpers ) {
 		snippets.add( snippetData );
 	}
 
-	// Remove snippets that do not match to patterns specified in `options.whitelistedSnippets`.
-	if ( options.whitelistedSnippets ) {
-		filterWhitelistedSnippets( snippets, options.whitelistedSnippets );
+	// Remove snippets that do not match to patterns specified in `options.allowedSnippets`.
+	if ( options.allowedSnippets ) {
+		filterAllowedSnippets( snippets, options.allowedSnippets );
 	}
 
-	console.log( `Building ${ snippets.size } snippets...` );
+	if ( options.allowedSnippets.length ) {
+		console.log( `Found ${ snippets.size } matching {@snippet} tags.` );
+	}
+
+	console.log( `Building ${ countUniqueSnippets( snippets ) } snippets...` );
 
 	const groupedSnippetsByLanguage = {};
 
@@ -209,18 +213,18 @@ module.exports = function snippetAdapter( snippets, options, umbertoHelpers ) {
 			}
 		} )
 		.then( () => {
-			console.log( `Finished building ${ snippets.size } snippets.` );
+			console.log( 'Finished building snippets.' );
 		} );
 };
 
 /**
- * Removes snippets that names do not match to patterns specified in `whitelistedSnippets` array.
+ * Removes snippets that names do not match to patterns specified in `allowedSnippets` array.
  *
  * @param {Set.<Snippet>} snippets Snippet collection extracted from documentation files.
- * @param {Array.<String>|undefined} whitelistedSnippets Snippet patterns that should be built.
+ * @param {Array.<String>|undefined} allowedSnippets Snippet patterns that should be built.
  */
-function filterWhitelistedSnippets( snippets, whitelistedSnippets ) {
-	if ( !whitelistedSnippets.length ) {
+function filterAllowedSnippets( snippets, allowedSnippets ) {
+	if ( !allowedSnippets.length ) {
 		return;
 	}
 
@@ -228,7 +232,7 @@ function filterWhitelistedSnippets( snippets, whitelistedSnippets ) {
 
 	// Find all snippets that matched to specified criteria.
 	for ( const snippetData of snippets ) {
-		const shouldBeBuilt = whitelistedSnippets.some( pattern => {
+		const shouldBeBuilt = allowedSnippets.some( pattern => {
 			return minimatch( snippetData.snippetName, pattern ) || snippetData.snippetName.includes( pattern );
 		} );
 
@@ -452,6 +456,16 @@ function getHTMLImports( files, mapFunction ) {
 }
 
 /**
+ * Returns a number of unique snippet names that will be built.
+ *
+ * @param {Set.<Snippet>} snippets Snippet collection extracted from documentation files.
+ * @returns {Number}
+ */
+function countUniqueSnippets( snippets ) {
+	return new Set( Array.from( snippets, snippet => snippet.snippetName ) ).size;
+}
+
+/**
  * @typedef {Object} Snippet
  *
  * @property {SnippetSource} snippetSources Sources of the snippet.