From db4f35b936c0bd33ccfe6628265567458b34ea64 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Tue, 5 Jan 2021 21:59:16 +0000 Subject: [PATCH] Generator: Added "npm run update" command --- packages/generator-joplin/README.md | 6 +++--- .../generators/app/templates/GENERATOR_DOC.md | 6 +++--- .../generator-joplin/generators/app/templates/README.md | 6 +++--- .../generators/app/templates/package_TEMPLATE.json | 3 ++- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/generator-joplin/README.md b/packages/generator-joplin/README.md index 86f573d148..5052e99e68 100644 --- a/packages/generator-joplin/README.md +++ b/packages/generator-joplin/README.md @@ -49,11 +49,11 @@ In general all this is done automatically by the plugin generator, which will se ## Updating the plugin framework -To update the plugin framework, run `npm install -g generator-joplin && yo joplin --update` +To update the plugin framework, run `npm run update`. -Keep in mind that doing so will overwrite all the framework-related files **outside of the "src/" directory** (your source code will not be touched). So if you have modified any of the framework-related files, such as package.json or .gitignore, make sure your code is under version control so that you can check the diff and re-apply your changes. +In general this command tries to do the right thing - in particular it's going to merge the changes in package.json and .gitignore instead of overwriting. It will also leave "/src" as well as README.md untouched. -For that reason, it's generally best not to change any of the framework files or to do so in a way that minimises the number of changes. For example, if you want to modify the Webpack config, create a new separate JavaScript file and include it in webpack.config.js. That way, when you update, you only have to restore the line that include your file. +The file that may cause problem is "webpack.config.js" because it's going to be overwritten. For that reason, if you want to change it, consider creating a separate JavaScript file and include it in webpack.config.js. That way, when you update, you only have to restore the line that include your file. ## Content scripts diff --git a/packages/generator-joplin/generators/app/templates/GENERATOR_DOC.md b/packages/generator-joplin/generators/app/templates/GENERATOR_DOC.md index 99957a24d4..5052e99e68 100644 --- a/packages/generator-joplin/generators/app/templates/GENERATOR_DOC.md +++ b/packages/generator-joplin/generators/app/templates/GENERATOR_DOC.md @@ -49,11 +49,11 @@ In general all this is done automatically by the plugin generator, which will se ## Updating the plugin framework -To update the plugin framework, run `yo joplin --update` +To update the plugin framework, run `npm run update`. -Keep in mind that doing so will overwrite all the framework-related files **outside of the "src/" directory** (your source code will not be touched). So if you have modified any of the framework-related files, such as package.json or .gitignore, make sure your code is under version control so that you can check the diff and re-apply your changes. +In general this command tries to do the right thing - in particular it's going to merge the changes in package.json and .gitignore instead of overwriting. It will also leave "/src" as well as README.md untouched. -For that reason, it's generally best not to change any of the framework files or to do so in a way that minimises the number of changes. For example, if you want to modify the Webpack config, create a new separate JavaScript file and include it in webpack.config.js. That way, when you update, you only have to restore the line that include your file. +The file that may cause problem is "webpack.config.js" because it's going to be overwritten. For that reason, if you want to change it, consider creating a separate JavaScript file and include it in webpack.config.js. That way, when you update, you only have to restore the line that include your file. ## Content scripts diff --git a/packages/generator-joplin/generators/app/templates/README.md b/packages/generator-joplin/generators/app/templates/README.md index 8841208722..b7f1e926fd 100644 --- a/packages/generator-joplin/generators/app/templates/README.md +++ b/packages/generator-joplin/generators/app/templates/README.md @@ -17,8 +17,8 @@ The project is setup to use TypeScript, although you can change the configuratio ## Updating the plugin framework -To update the plugin framework, run `yo joplin --update` +To update the plugin framework, run `npm run update`. -Keep in mind that doing so will overwrite all the framework-related files **outside of the "src/" directory** (your source code will not be touched). So if you have modified any of the framework-related files, such as package.json or .gitignore, make sure your code is under version control so that you can check the diff and re-apply your changes. +In general this command tries to do the right thing - in particular it's going to merge the changes in package.json and .gitignore instead of overwriting. It will also leave "/src" as well as README.md untouched. -For that reason, it's generally best not to change any of the framework files or to do so in a way that minimises the number of changes. For example, if you want to modify the Webpack config, create a new separate JavaScript file and include it in webpack.config.js. That way, when you update, you only have to restore the line that include your file. \ No newline at end of file +The file that may cause problem is "webpack.config.js" because it's going to be overwritten. For that reason, if you want to change it, consider creating a separate JavaScript file and include it in webpack.config.js. That way, when you update, you only have to restore the line that include your file. diff --git a/packages/generator-joplin/generators/app/templates/package_TEMPLATE.json b/packages/generator-joplin/generators/app/templates/package_TEMPLATE.json index 2cd9fe9c3c..7c0a7222fb 100644 --- a/packages/generator-joplin/generators/app/templates/package_TEMPLATE.json +++ b/packages/generator-joplin/generators/app/templates/package_TEMPLATE.json @@ -3,7 +3,8 @@ "version": "1.0.0", "scripts": { "dist": "webpack", - "prepare": "npm run dist" + "prepare": "npm run dist", + "update": "npm install -g generator-joplin && yo joplin --update" }, "license": "MIT", "keywords": [