|
@@ -14,16 +14,13 @@ const path = require( 'path' );
|
|
|
* 1. Ask for new plugin name.
|
|
* 1. Ask for new plugin name.
|
|
|
* 2. Ask for initial version.
|
|
* 2. Ask for initial version.
|
|
|
* 3. Ask for GitHub URL.
|
|
* 3. Ask for GitHub URL.
|
|
|
- * 4. Initialize repository
|
|
|
|
|
- * 4.1. Initialize Git repository.
|
|
|
|
|
- * 4.2. Fetch and merge boilerplate project.
|
|
|
|
|
- * 5. Copy template files.
|
|
|
|
|
|
|
+ * 4. Initialize repository.
|
|
|
|
|
+ * 5. Copy files to new repository.
|
|
|
* 6. Update package.json file in new plugin's repository.
|
|
* 6. Update package.json file in new plugin's repository.
|
|
|
* 7. Update package.json file in CKEditor5 repository.
|
|
* 7. Update package.json file in CKEditor5 repository.
|
|
|
* 8. Create initial commit.
|
|
* 8. Create initial commit.
|
|
|
* 9. Link new plugin.
|
|
* 9. Link new plugin.
|
|
|
* 10. Call `npm install` in plugin repository.
|
|
* 10. Call `npm install` in plugin repository.
|
|
|
- * 11. Install Git hooks in plugin repository.
|
|
|
|
|
*
|
|
*
|
|
|
* @param {String} ckeditor5Path Path to main CKEditor5 repository.
|
|
* @param {String} ckeditor5Path Path to main CKEditor5 repository.
|
|
|
* @param {String} workspaceRoot Relative path to workspace root.
|
|
* @param {String} workspaceRoot Relative path to workspace root.
|
|
@@ -32,6 +29,25 @@ const path = require( 'path' );
|
|
|
*/
|
|
*/
|
|
|
module.exports = ( ckeditor5Path, workspaceRoot, writeln ) => {
|
|
module.exports = ( ckeditor5Path, workspaceRoot, writeln ) => {
|
|
|
const workspaceAbsolutePath = path.join( ckeditor5Path, workspaceRoot );
|
|
const workspaceAbsolutePath = path.join( ckeditor5Path, workspaceRoot );
|
|
|
|
|
+ const fileStructure = {
|
|
|
|
|
+ './': [
|
|
|
|
|
+ '.editorconfig',
|
|
|
|
|
+ '.jshintrc',
|
|
|
|
|
+ '.jscsrc',
|
|
|
|
|
+ '.gitattributes',
|
|
|
|
|
+ './dev/tasks/dev/templates'
|
|
|
|
|
+ ],
|
|
|
|
|
+ 'tests/': [
|
|
|
|
|
+ 'tests/.jshintrc'
|
|
|
|
|
+ ],
|
|
|
|
|
+ 'dev/': [
|
|
|
|
|
+ 'dev/.jshintrc'
|
|
|
|
|
+ ],
|
|
|
|
|
+ 'dev/tasks/lint': [
|
|
|
|
|
+ 'dev/tasks/lint'
|
|
|
|
|
+ ]
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
let pluginName;
|
|
let pluginName;
|
|
|
let repositoryPath;
|
|
let repositoryPath;
|
|
|
let pluginVersion;
|
|
let pluginVersion;
|
|
@@ -55,8 +71,11 @@ module.exports = ( ckeditor5Path, workspaceRoot, writeln ) => {
|
|
|
writeln( `Initializing repository ${ repositoryPath }...` );
|
|
writeln( `Initializing repository ${ repositoryPath }...` );
|
|
|
git.initializeRepository( repositoryPath );
|
|
git.initializeRepository( repositoryPath );
|
|
|
|
|
|
|
|
- writeln( `Copying template files to ${ repositoryPath }...` );
|
|
|
|
|
- tools.copyTemplateFiles( repositoryPath );
|
|
|
|
|
|
|
+ writeln( `Copying files into ${ repositoryPath }...` );
|
|
|
|
|
+
|
|
|
|
|
+ for ( let destination in fileStructure ) {
|
|
|
|
|
+ tools.copy( fileStructure[ destination ], path.join( repositoryPath, destination ) );
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
writeln( `Updating package.json files...` );
|
|
writeln( `Updating package.json files...` );
|
|
|
tools.updateJSONFile( path.join( repositoryPath, 'package.json' ), ( json ) => {
|
|
tools.updateJSONFile( path.join( repositoryPath, 'package.json' ), ( json ) => {
|
|
@@ -83,8 +102,5 @@ module.exports = ( ckeditor5Path, workspaceRoot, writeln ) => {
|
|
|
|
|
|
|
|
writeln( `Running npm install in ${ pluginName }.` );
|
|
writeln( `Running npm install in ${ pluginName }.` );
|
|
|
tools.npmInstall( repositoryPath );
|
|
tools.npmInstall( repositoryPath );
|
|
|
-
|
|
|
|
|
- writeln( `Installing Git hooks in ${ pluginName }.` );
|
|
|
|
|
- tools.installGitHooks( repositoryPath );
|
|
|
|
|
} );
|
|
} );
|
|
|
};
|
|
};
|