浏览代码

Merge branch 't/757'

Internal: Added script for bumping the year up and executed it. Closes #757.
Piotrek Koszuliński 8 年之前
父节点
当前提交
9246dd4f7a

+ 1 - 1
docs/_snippets/build-classic-source.js

@@ -1,5 +1,5 @@
 /**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  * For licensing, see LICENSE.md.
  */
 

+ 1 - 1
docs/_snippets/examples/balloon-editor.js

@@ -1,5 +1,5 @@
 /**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  * For licensing, see LICENSE.md.
  */
 

+ 1 - 1
docs/_snippets/examples/classic-editor-short.js

@@ -1,5 +1,5 @@
 /**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  * For licensing, see LICENSE.md.
  */
 

+ 1 - 1
docs/_snippets/examples/classic-editor.js

@@ -1,5 +1,5 @@
 /**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  * For licensing, see LICENSE.md.
  */
 

+ 1 - 1
docs/_snippets/examples/inline-editor.js

@@ -1,5 +1,5 @@
 /**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  * For licensing, see LICENSE.md.
  */
 

+ 1 - 1
docs/_snippets/features/read-only.js

@@ -1,5 +1,5 @@
 /**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  * For licensing, see LICENSE.md.
  */
 

+ 1 - 1
docs/_snippets/features/ui-language.js

@@ -1,5 +1,5 @@
 /**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  * For licensing, see LICENSE.md.
  */
 

+ 1 - 1
docs/assets/snippet-styles.css

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  */
 
 .ck-editor {

+ 1 - 1
docs/builds/guides/support/license-and-legal.md

@@ -10,7 +10,7 @@ order: 20
 
 The following legal notices apply to CKEditor 5 Builds and all software from the CKEditor 5 Ecosystem included with it.
 
-Copyright (c) 2003-2017, CKSource Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2018, CKSource Frederico Knabben. All rights reserved.
 
 Licensed under the terms of any of the following licenses at your choice:
 

+ 1 - 1
docs/framework/guides/support/license-and-legal.md

@@ -10,7 +10,7 @@ order: 20
 
 The following legal notices apply to CKEditor 5 Framework and all software from the CKEditor 5 Ecosystem included with it.
 
-Copyright (c) 2003-2017, CKSource Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2018, CKSource Frederico Knabben. All rights reserved.
 
 Licensed under the terms of any of the following licenses at your choice:
 

+ 1 - 1
docs/umberto.json

@@ -5,7 +5,7 @@
 	"path": "docs",
 	"observablesdocs": "module:utils/observablemixin~ObservableMixin",
 	"scripts": {
-		"snippet-adapter": "../scripts/docs/snippet-adapter/snippetadapter",
+		"snippet-adapter": "../scripts/docs/snippetadapter",
 		"import-path": "../scripts/docs/getrealimportpath"
 	},
 	"docsearch": {

+ 16 - 5
package.json

@@ -47,13 +47,25 @@
   },
   "devDependencies": {
     "@ckeditor/ckeditor5-dev-docs": "^8.0.0",
+    "@ckeditor/ckeditor5-dev-env": "^8.0.4",
     "@ckeditor/ckeditor5-dev-tests": "^10.0.0",
+    "@ckeditor/ckeditor5-dev-webpack-plugin": "^3.0.4",
+    "babel-minify-webpack-plugin": "^0.2.0",
     "eslint": "^4.8.0",
     "eslint-config-ckeditor5": "^1.0.7",
+    "extract-text-webpack-plugin": "^3.0.2",
+    "glob": "^7.1.2",
     "husky": "^0.14.3",
-    "lint-staged": "^4.2.3",
     "lerna": "^2.2.0",
-    "mgit2": "^0.7.2"
+    "lint-staged": "^4.2.3",
+    "mgit2": "^0.7.2",
+    "minimatch": "^3.0.4",
+    "postcss-loader": "^2.0.10",
+    "raw-loader": "^0.5.1",
+    "style-loader": "^0.19.1",
+    "umberto": "^0.3.46",
+    "webpack": "^3.10.0",
+    "webpack-sources": "^1.1.0"
   },
   "engines": {
     "node": ">=6.0.0",
@@ -74,14 +86,13 @@
     "test:manual": "node --max_old_space_size=4096 node_modules/@ckeditor/ckeditor5-dev-tests/bin/test-manual.js",
     "docs": "node ./scripts/docs/build-docs.js",
     "docs:api": "node ./scripts/docs/build-api-docs.js",
+    "docs:build-and-publish": "node ./scripts/docs/build-and-publish.js",
     "translations:collect": "ckeditor5-dev-env-translations collect",
     "translations:download": "ckeditor5-dev-env-translations download",
     "translations:upload": "ckeditor5-dev-env-translations upload",
     "changelog": "node ./scripts/release/changelog.js",
     "release:dependencies": "node ./scripts/release/release-dependencies.js",
-    "install-optional-dependencies": "sh ./scripts/install-optional-dependencies.sh",
-    "switch-to-dev-dev": "sh ./scripts/switch-to-dev-dev.sh",
-    "build-and-publish-docs": "node ./scripts/docs/build-and-publish.js"
+    "switch-to-dev-dev": "sh ./scripts/switch-to-dev-dev.sh"
   },
   "lint-staged": {
     "**/*.js": [

+ 61 - 0
scripts/bump-year.js

@@ -0,0 +1,61 @@
+#!/usr/bin/env node
+
+/**
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* eslint-env node */
+
+/*
+
+Usage:
+mgit exec 'node ../../scripts/bump-year.js'
+node scripts/bump-year.js
+
+Full command to update the entire project:
+git pull && mgit update && mgit exec 'node ../../scripts/bump-year.js' && node scripts/bump-year.js
+
+And after reviewing the changes:
+mgit exec 'git commit -am "Internal: Bumped the year. [skip ci]" && git push' && git commit -am "Internal: Bumped the year." && git push
+
+*/
+
+const glob = require( 'glob' );
+const minimatch = require( 'minimatch' );
+const fs = require( 'fs' );
+
+glob( '!(node_modules|build|coverage|packages)/**/*', ( err, fileNames ) => {
+	const filteredFileNames = fileNames.filter( fileName => {
+		// Filter out stuff from ckeditor5-utils/src/lib.
+		if ( minimatch( fileName, '**/src/lib/**' ) ) {
+			return false;
+		}
+
+		if ( fs.statSync( fileName ).isDirectory() ) {
+			return false;
+		}
+
+		return true;
+	} );
+
+	filteredFileNames.forEach( fileName => {
+		fs.readFile( fileName, ( err, data ) => {
+			data = data.toString();
+
+			const year = new Date().getFullYear();
+			const regexp = /Copyright \(c\) 2003-\d{4}/;
+			const updatedData = data.replace( regexp, 'Copyright (c) 2003-' + year );
+
+			if ( data == updatedData ) {
+				// License headers are only required in JS files.
+				// Also, the file might have already been updated.
+				if ( fileName.endsWith( '.js' ) && !data.match( regexp ) ) {
+					console.warn( `The file "${ fileName }" misses a license header.` );
+				}
+			} else {
+				fs.writeFile( fileName, updatedData );
+			}
+		} );
+	} );
+} );

+ 1 - 1
scripts/docs/build-and-publish.js

@@ -1,7 +1,7 @@
 #!/usr/bin/env node
 
 /**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  * For licensing, see LICENSE.md.
  */
 

+ 1 - 1
scripts/docs/build-api-docs.js

@@ -1,7 +1,7 @@
 #!/usr/bin/env node
 
 /**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  * For licensing, see LICENSE.md.
  */
 

+ 1 - 3
scripts/docs/build-docs.js

@@ -1,7 +1,7 @@
 #!/usr/bin/env node
 
 /**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  * For licensing, see LICENSE.md.
  */
 
@@ -9,7 +9,6 @@
 
 'use strict';
 
-const assertIsInstalled = require( './../utils/assertisinstalled' );
 const buildApiDocs = require( './buildapi' );
 
 const skipLiveSnippets = process.argv.includes( '--skip-snippets' );
@@ -51,7 +50,6 @@ function buildDocs() {
 }
 
 function runUmberto( options ) {
-	assertIsInstalled( 'umberto' );
 	const umberto = require( 'umberto' );
 
 	return umberto.buildSingleProject( {

+ 1 - 5
scripts/docs/buildapi.js

@@ -1,5 +1,5 @@
 /**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  * For licensing, see LICENSE.md.
  */
 
@@ -9,11 +9,7 @@
 
 const path = require( 'path' );
 
-const assertIsInstalled = require( './../utils/assertisinstalled' );
-
 module.exports = function buildApiDocs() {
-	assertIsInstalled( '@ckeditor/ckeditor5-dev-docs' );
-
 	const ckeditor5Docs = require( '@ckeditor/ckeditor5-dev-docs' );
 
 	return ckeditor5Docs

+ 1 - 1
scripts/docs/getrealimportpath.js

@@ -1,5 +1,5 @@
 /**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  * For licensing, see LICENSE.md.
  */
 

+ 0 - 14
scripts/docs/snippet-adapter/package.json

@@ -1,14 +0,0 @@
-{
-  "name": "ckeditor5-snippet-adapter",
-  "private": true,
-  "dependencies": {
-    "@ckeditor/ckeditor5-dev-webpack-plugin": "^3.0.0",
-    "babel-minify-webpack-plugin": "^0.2.0",
-    "extract-text-webpack-plugin": "^3.0.0",
-    "raw-loader": "^0.5.1",
-    "postcss-loader": "^2.0.8",
-    "style-loader": "^0.18.2",
-    "webpack": "^3.6.0",
-    "webpack-sources": "1.0.1"
-  }
-}

+ 1 - 1
scripts/docs/snippet-adapter/snippetadapter.js

@@ -1,5 +1,5 @@
 /**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  * For licensing, see LICENSE.md.
  */
 

+ 0 - 20
scripts/install-optional-dependencies.sh

@@ -1,20 +0,0 @@
-#!/bin/sh
-
-# @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
-# For licensing, see LICENSE.md.
-
-# Installs optional dev dependencies.
-# They are required by the following tasks:
-#
-# * npm run docs
-# * npm run changelog:dependencies
-# * npm run release:dependencies
-# * npm run translations:*
-
-set -e
-
-npm i @ckeditor/ckeditor5-dev-env umberto
-
-cd scripts/docs/snippet-adapter
-npm i
-cd ../..

+ 1 - 5
scripts/release/changelog.js

@@ -1,7 +1,7 @@
 #!/usr/bin/env node
 
 /**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  * For licensing, see LICENSE.md.
  */
 
@@ -9,10 +9,6 @@
 
 'use strict';
 
-const assertIsInstalled = require( './../utils/assertisinstalled' );
-
-assertIsInstalled( '@ckeditor/ckeditor5-dev-env' );
-
 const devEnv = require( '@ckeditor/ckeditor5-dev-env' );
 const commonOptions = {
 	cwd: process.cwd(),

+ 1 - 5
scripts/release/release-dependencies.js

@@ -1,7 +1,7 @@
 #!/usr/bin/env node
 
 /**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  * For licensing, see LICENSE.md.
  */
 
@@ -9,10 +9,6 @@
 
 'use strict';
 
-const assertIsInstalled = require( './../utils/assertisinstalled' );
-
-assertIsInstalled( '@ckeditor/ckeditor5-dev-env' );
-
 require( '@ckeditor/ckeditor5-dev-env' )
 	.releaseSubRepositories( {
 		cwd: process.cwd(),

+ 1 - 1
scripts/switch-to-dev-dev.sh

@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+# @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
 # For licensing, see LICENSE.md.
 
 # Symlinks packages from https://github.com/ckeditor/ckeditor5-dev in ckeditor5's node_modules.

+ 0 - 20
scripts/utils/assertisinstalled.js

@@ -1,20 +0,0 @@
-/**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-/* eslint-env node */
-
-'use strict';
-
-module.exports = function assertIsInstalled( packageName ) {
-	try {
-		require( packageName + '/package.json' );
-	} catch ( err ) {
-		console.error( `Error: Cannot find package '${ packageName }'.\n` );
-		console.error( 'You need to install optional dependencies.' );
-		console.error( 'Run: \'npm run install-optional-dependencies\'.' );
-
-		process.exit( 1 );
-	}
-};