Przeglądaj źródła

Merge branch 'master' into release

Piotrek Koszuliński 5 lat temu
rodzic
commit
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
 ## 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
 ```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:
 To make updating easier you may optionally add the original build repository to your Git remotes:
 
 
 ```bash
 ```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>
 <info-box hint>

+ 5 - 5
docs/builds/guides/integration/advanced-setup.md

@@ -66,7 +66,7 @@ This scenario allows you to fully control the building process of CKEditor. This
 	Similar results to what this method allows can be achieved by {@link builds/guides/development/custom-builds customizing an existing build} and integrating your custom build like in scenario 1. This will give faster build times (since CKEditor will be built once and committed), however, it requires maintaining a separate repository and installing the code from that repository into your project (e.g. by publishing a new npm package or using tools like [Lerna](https://github.com/lerna/lerna)). This makes it less convenient than the method described in this scenario.
 	Similar results to what this method allows can be achieved by {@link builds/guides/development/custom-builds customizing an existing build} and integrating your custom build like in scenario 1. This will give faster build times (since CKEditor will be built once and committed), however, it requires maintaining a separate repository and installing the code from that repository into your project (e.g. by publishing a new npm package or using tools like [Lerna](https://github.com/lerna/lerna)). This makes it less convenient than the method described in this scenario.
 </info-box>
 </info-box>
 
 
-First of all, you need to install source packages that you will use. If you base your integration on one of the existing builds, you can take them from that build's `package.json` file (see e.g. [classic build's `package.json`](https://github.com/ckeditor/ckeditor5-build-classic/tree/master/package.json)). At this moment you can choose the editor creator and the features you want.
+First of all, you need to install source packages that you will use. If you base your integration on one of the existing builds, you can take them from that build's `package.json` file (see e.g. [classic build's `package.json`](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-build-classic/package.json)). At this moment you can choose the editor creator and the features you want.
 
 
 Copy these dependencies to your `package.json` and call `npm install` to install them. The `dependencies` (or `devDependencies`) section of `package.json` should look more or less like this:
 Copy these dependencies to your `package.json` and call `npm install` to install them. The `dependencies` (or `devDependencies`) section of `package.json` should look more or less like this:
 
 
@@ -376,7 +376,7 @@ Webpack 4 introduced the [concept of modes](https://webpack.js.org/concepts/mode
 
 
 <info-box>
 <info-box>
 	Prior to version 1.2.7 `uglifyjs-webpack-plugin` had a bug which caused webpack to crash with the following error: `TypeError: Assignment to constant variable.`. If you experienced this error, make sure that your `node_modules` contains an up-to-date version of this package (and that webpack uses this version).
 	Prior to version 1.2.7 `uglifyjs-webpack-plugin` had a bug which caused webpack to crash with the following error: `TypeError: Assignment to constant variable.`. If you experienced this error, make sure that your `node_modules` contains an up-to-date version of this package (and that webpack uses this version).
-	
+
 	CKEditor 5 Builds use [`Terser`](https://github.com/terser/terser) instead of `uglifyjs-webpack-plugin` because [the later one seems to be unsupported anymore](https://github.com/ckeditor/ckeditor5/issues/1353).
 	CKEditor 5 Builds use [`Terser`](https://github.com/terser/terser) instead of `uglifyjs-webpack-plugin` because [the later one seems to be unsupported anymore](https://github.com/ckeditor/ckeditor5/issues/1353).
 </info-box>
 </info-box>
 
 
@@ -513,11 +513,11 @@ If you want to load two different editors on one page you need to make sure that
 
 
 There is no limit for how many editor classes a single build can export. By default, the official builds export a single editor class only. However, they can easily import more.
 There is no limit for how many editor classes a single build can export. By default, the official builds export a single editor class only. However, they can easily import more.
 
 
-You can start from forking (or copying) an existing build like in the {@link builds/guides/development/custom-builds "Creating custom builds"} guide. Let's say you forked and cloned the [`ckeditor5-build-classic`](http://github.com/ckeditor/ckeditor5-build-classic) repository and want to add {@link module:editor-inline/inlineeditor~InlineEditor} to it:
+You can start from forking (or copying) an existing build like in the {@link builds/guides/development/custom-builds "Creating custom builds"} guide. Let's say you forked and cloned the [`ckeditor5`](http://github.com/ckeditor /ckeditor5) repository and want to add {@link module:editor-inline/inlineeditor~InlineEditor} to the classic build:
 
 
 ```bash
 ```bash
-git clone -b stable git@github.com:<your-username>/ckeditor5-build-classic.git
-cd ckeditor5-build-classic
+git clone -b stable git@github.com:<your-username>/ckeditor5.git
+cd ckeditor5/packages/ckeditor5-build-classic
 npm install
 npm install
 ```
 ```
 
 

+ 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-api` &ndash; Skips building the API documentation (which takes the majority of the total time).
 * `--skip-snippets` &ndash; Skips building live snippets.
 * `--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.
 * `--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.
 * `--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.
 * `--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 production = process.argv.includes( '--production' );
 const watch = process.argv.includes( '--watch' );
 const watch = process.argv.includes( '--watch' );
 const verbose = process.argv.includes( '--verbose' );
 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();
 buildDocs();
 
 
@@ -59,7 +59,7 @@ function runUmberto( options ) {
 		skipValidation: options.skipValidation,
 		skipValidation: options.skipValidation,
 		snippetOptions: {
 		snippetOptions: {
 			production: options.production,
 			production: options.production,
-			whitelistedSnippets: whitelistedSnippets ? whitelistedSnippets.replace( '--snippets=', '' ).split( ',' ) : []
+			allowedSnippets: allowedSnippets ? allowedSnippets.replace( '--snippets=', '' ).split( ',' ) : []
 		},
 		},
 		skipApi: options.skipApi,
 		skipApi: options.skipApi,
 		verbose: options.verbose,
 		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 {Set.<Snippet>} snippets Snippet collection extracted from documentation files.
  * @param {Object} options
  * @param {Object} options
  * @param {Boolean} options.production Whether to build snippets in production mode.
  * @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
  * @param {Object.<String, Function>} umbertoHelpers
  * @returns {Promise}
  * @returns {Promise}
  */
  */
@@ -80,12 +80,16 @@ module.exports = function snippetAdapter( snippets, options, umbertoHelpers ) {
 		snippets.add( snippetData );
 		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 = {};
 	const groupedSnippetsByLanguage = {};
 
 
@@ -209,18 +213,18 @@ module.exports = function snippetAdapter( snippets, options, umbertoHelpers ) {
 			}
 			}
 		} )
 		} )
 		.then( () => {
 		.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 {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;
 		return;
 	}
 	}
 
 
@@ -228,7 +232,7 @@ function filterWhitelistedSnippets( snippets, whitelistedSnippets ) {
 
 
 	// Find all snippets that matched to specified criteria.
 	// Find all snippets that matched to specified criteria.
 	for ( const snippetData of snippets ) {
 	for ( const snippetData of snippets ) {
-		const shouldBeBuilt = whitelistedSnippets.some( pattern => {
+		const shouldBeBuilt = allowedSnippets.some( pattern => {
 			return minimatch( snippetData.snippetName, pattern ) || snippetData.snippetName.includes( pattern );
 			return minimatch( snippetData.snippetName, pattern ) || snippetData.snippetName.includes( pattern );
 		} );
 		} );
 
 
@@ -451,6 +455,16 @@ function getHTMLImports( files, mapFunction ) {
 		.replace( /^\s+/, '' );
 		.replace( /^\s+/, '' );
 }
 }
 
 
+/**
+ * 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
  * @typedef {Object} Snippet
  *
  *