From 37ad583f3728992f0882cb1a3ca8f23d60173256 Mon Sep 17 00:00:00 2001 From: Raruto Date: Wed, 18 Jan 2023 11:54:27 +0100 Subject: [PATCH 01/14] Add gulp task `clone:default_plugins` Add the aforementioned task in order to make sure that core client plugins are there before starting develop: - [submodule "src/plugins/qplotly"] <-- https://github.com/g3w-suite/g3w-client-plugin-qplotly.git - [submodule "src/plugins/qtimeseries"] <-- https://github.com/g3w-suite/g3w-client-plugin-qtimeseries.git - [submodule "src/plugins/editing"] <-- https://github.com/g3w-suite/g3w-client-plugin-editing.git --- gulpfile.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index da60f9128..8681ae401 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -321,6 +321,29 @@ gulp.task('browser-sync', function() { }); }); +/** + * Make sure that core client plugins are there + * + * [submodule "src/plugins/qplotly"] <-- https://github.com/g3w-suite/g3w-client-plugin-qplotly.git + * [submodule "src/plugins/qtimeseries"] <-- https://github.com/g3w-suite/g3w-client-plugin-qtimeseries.git + * [submodule "src/plugins/editing"] <-- https://github.com/g3w-suite/g3w-client-plugin-editing.git + */ +gulp.task('clone:default_plugins', function() { + const { execSync } = require('child_process'); + return new Promise(async done => { + for (const pluginName of ['editing', 'qplotly', 'qtimeseries']) { + if (!fs.existsSync(`${g3w.pluginsFolder}/${pluginName}/.git`)) { + execSync(`git clone https://github.com/g3w-suite/g3w-client-plugin-${pluginName}.git ${g3w.pluginsFolder}/${pluginName}`); + } + /** @TODO understand why the terminal hangs here (now you must run this 3 times to make it work) */ + // if (!fs.existsSync(`${g3w.pluginsFolder}/${pluginName}/plugin.js`)) { + // execSync(`npx gulp --gulpfile ${g3w.pluginsFolder}/${pluginName}/gulpfile.js browserify`); + // } + } + done(); + }); +}); + /** * Ask the developer which plugins wants to deploy */ @@ -382,7 +405,7 @@ gulp.task('deploy-plugins', function() { /** * Deploy local developed plugins (src/plugins) */ -gulp.task('build:plugins', (done) => runSequence('select-plugins', 'deploy-plugins', done)); +gulp.task('build:plugins', (done) => runSequence('clone:default_plugins', 'select-plugins', 'deploy-plugins', done)); /** * Compile and deploy local developed client file assets (static and templates) @@ -399,6 +422,7 @@ gulp.task('build', done => runSequence( 'production', 'clean:admin', 'clean:overrides', + 'clone:default_plugins', 'build:client', done ) @@ -413,6 +437,7 @@ gulp.task('build', done => runSequence( gulp.task('dev', done => runSequence( 'clean:admin', 'clean:overrides', + 'clone:default_plugins', 'build:client', 'browser-sync', done From 5f3858de96d328607650d174bc4b81d252df02c2 Mon Sep 17 00:00:00 2001 From: volterra79 Date: Thu, 19 Jan 2023 12:36:12 +0100 Subject: [PATCH 02/14] Add --task name --- gulpfile.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 8681ae401..6797656bc 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -336,9 +336,9 @@ gulp.task('clone:default_plugins', function() { execSync(`git clone https://github.com/g3w-suite/g3w-client-plugin-${pluginName}.git ${g3w.pluginsFolder}/${pluginName}`); } /** @TODO understand why the terminal hangs here (now you must run this 3 times to make it work) */ - // if (!fs.existsSync(`${g3w.pluginsFolder}/${pluginName}/plugin.js`)) { - // execSync(`npx gulp --gulpfile ${g3w.pluginsFolder}/${pluginName}/gulpfile.js browserify`); - // } + if (!fs.existsSync(`${g3w.pluginsFolder}/${pluginName}/plugin.js`)) { + execSync(`gulp --gulpfile ${g3w.pluginsFolder}/${pluginName}/gulpfile.js --task watch`); + } } done(); }); From cc991f1fb45536dc012bfc6a694e069f3afc3d13 Mon Sep 17 00:00:00 2001 From: Raruto Date: Thu, 19 Jan 2023 16:25:37 +0100 Subject: [PATCH 03/14] remove `clean:admin` from tasks chain (`build` and `dev`) --- gulpfile.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 6797656bc..dd2e95d68 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -420,9 +420,8 @@ gulp.task('build:client', ['browserify:app', 'concatenate:vendor_js', 'concatena */ gulp.task('build', done => runSequence( 'production', - 'clean:admin', + // 'clean:admin', 'clean:overrides', - 'clone:default_plugins', 'build:client', done ) @@ -435,9 +434,8 @@ gulp.task('build', done => runSequence( * outputFolder = g3w.admin_overrides_folder */ gulp.task('dev', done => runSequence( - 'clean:admin', + // 'clean:admin', 'clean:overrides', - 'clone:default_plugins', 'build:client', 'browser-sync', done From 31402ff402c6e3c3a75741bea6d6e12a9e6651aa Mon Sep 17 00:00:00 2001 From: Raruto Date: Thu, 19 Jan 2023 16:25:57 +0100 Subject: [PATCH 04/14] outdated comment --- gulpfile.js | 1 - 1 file changed, 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index dd2e95d68..71e24abcd 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -335,7 +335,6 @@ gulp.task('clone:default_plugins', function() { if (!fs.existsSync(`${g3w.pluginsFolder}/${pluginName}/.git`)) { execSync(`git clone https://github.com/g3w-suite/g3w-client-plugin-${pluginName}.git ${g3w.pluginsFolder}/${pluginName}`); } - /** @TODO understand why the terminal hangs here (now you must run this 3 times to make it work) */ if (!fs.existsSync(`${g3w.pluginsFolder}/${pluginName}/plugin.js`)) { execSync(`gulp --gulpfile ${g3w.pluginsFolder}/${pluginName}/gulpfile.js --task watch`); } From da4890c112a35df98e5ec1e39242a8476c672ebe Mon Sep 17 00:00:00 2001 From: Raruto Date: Thu, 19 Jan 2023 16:27:19 +0100 Subject: [PATCH 05/14] restore `clone:default_plugins` --- gulpfile.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gulpfile.js b/gulpfile.js index 71e24abcd..bef1947a5 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -421,6 +421,7 @@ gulp.task('build', done => runSequence( 'production', // 'clean:admin', 'clean:overrides', + 'clone:default_plugins', 'build:client', done ) @@ -435,6 +436,7 @@ gulp.task('build', done => runSequence( gulp.task('dev', done => runSequence( // 'clean:admin', 'clean:overrides', + 'clone:default_plugins', 'build:client', 'browser-sync', done From 71e12e2c1711a6c58c4f564ff995b4632ddc3ff6 Mon Sep 17 00:00:00 2001 From: Raruto Date: Fri, 20 Jan 2023 08:22:51 +0100 Subject: [PATCH 06/14] remove unusued tasks `build:static` and `'build:templates` --- gulpfile.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index bef1947a5..5f5f98f82 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -494,11 +494,7 @@ gulp.task('version', function () { // Backward compatibilities (v3.x) gulp.task('g3w-admin', ['build']); gulp.task('g3w-admin-plugins-select', ['build:plugins']); -gulp.task('g3w-admin-client:static', ['build:static']); -gulp.task('g3w-admin-client:template', ['build:templates']); gulp.task('g3w-admin-client', ['g3w-admin']); gulp.task('g3w-admin:plugins', ['build:plugins']); -gulp.task('g3w-admin:static', ['build:static']); -gulp.task('g3w-admin:templates', ['build:templates']); gulp.task('serve', ['dev']); gulp.task('default', ['dev']); \ No newline at end of file From 37ac42e718d9dfd797b9128451d6ab4bc284f084 Mon Sep 17 00:00:00 2001 From: Raruto Date: Mon, 30 Jan 2023 11:55:51 +0100 Subject: [PATCH 07/14] add `build:dev_plugins` task --- gulpfile.js | 47 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 5f5f98f82..513c61c00 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -45,9 +45,20 @@ const g3w = require('./config'); let production = false; let outputFolder = g3w.admin_overrides_folder; +// ANSI color codes +const H1__ = "\n\n\033[0;32m\#\#\# "; +const __H1 = " \#\#\# \033[0m\n"; + // Retrieve project dependencies ("g3w-client") const dependencies = Object.keys(packageJSON.dependencies).filter(dep => dep !== 'vue'); +// Bult-in client plugins +const default_plugins = [ + 'editing', + 'qplotly', + 'qtimeseries' +]; + // production const to set environmental variable function setNODE_ENV() { process.env.NODE_ENV = production ? 'production' : 'development'; @@ -324,25 +335,52 @@ gulp.task('browser-sync', function() { /** * Make sure that core client plugins are there * + * [submodule "src/plugins/editing"] <-- https://github.com/g3w-suite/g3w-client-plugin-editing.git * [submodule "src/plugins/qplotly"] <-- https://github.com/g3w-suite/g3w-client-plugin-qplotly.git * [submodule "src/plugins/qtimeseries"] <-- https://github.com/g3w-suite/g3w-client-plugin-qtimeseries.git - * [submodule "src/plugins/editing"] <-- https://github.com/g3w-suite/g3w-client-plugin-editing.git */ gulp.task('clone:default_plugins', function() { const { execSync } = require('child_process'); return new Promise(async done => { - for (const pluginName of ['editing', 'qplotly', 'qtimeseries']) { + console.log(H1__ + `Cloning default plugins` + __H1); + for (const pluginName of default_plugins) { if (!fs.existsSync(`${g3w.pluginsFolder}/${pluginName}/.git`)) { - execSync(`git clone https://github.com/g3w-suite/g3w-client-plugin-${pluginName}.git ${g3w.pluginsFolder}/${pluginName}`); + execSync(`git clone https://github.com/g3w-suite/g3w-client-plugin-${pluginName}.git ${g3w.pluginsFolder}/${pluginName}`, {stdio: 'inherit'}); } if (!fs.existsSync(`${g3w.pluginsFolder}/${pluginName}/plugin.js`)) { - execSync(`gulp --gulpfile ${g3w.pluginsFolder}/${pluginName}/gulpfile.js --task watch`); + execSync(`gulp --gulpfile ${g3w.pluginsFolder}/${pluginName}/gulpfile.js default`, {stdio: 'inherit'}); } } done(); }); }); +/** + * Make sure that all g3w.plugins bundles are there + * + * CORE PLUGINS: + * - [submodule "src/plugins/editing"] --> src/plugins/editing/plugin.js + * - [submodule "src/plugins/qplotly"] --> src/plugins/qplotly/plugin.js + * - [submodule "src/plugins/qtimeseries"] --> src/plugins/qtimeseries/plugin.js + * + * CUSTOM PLUGINS: + * - [submodule "src/plugins/eleprofile"] --> src/plugins/eleprofile/plugin.js + * - [submodule "src/plugins/sidebar"] --> src/plugins/sidebar/plugin.js + */ +gulp.task('build:dev_plugins', function() { + const { execSync } = require('child_process'); + const dev_plugins = Array.from(new Set(default_plugins.concat(g3w.plugins instanceof Array ? plugins : Object.keys(g3w.plugins)))); + return new Promise(async done => { + for (const pluginName of dev_plugins) { + console.log(H1__ + `Building plugin: ${g3w.pluginsFolder}/${pluginName}/plugin.js` + __H1); + try { + execSync(`gulp --gulpfile ${g3w.pluginsFolder}/${pluginName}/gulpfile.js default`, {stdio: 'inherit'}); + } catch(e) { /* fails silently */ } + } + done(); + }); +}); + /** * Ask the developer which plugins wants to deploy */ @@ -437,6 +475,7 @@ gulp.task('dev', done => runSequence( // 'clean:admin', 'clean:overrides', 'clone:default_plugins', + 'build:dev_plugins', 'build:client', 'browser-sync', done From be92f79afdd9f408f1ee046e6d02e2d998611d6b Mon Sep 17 00:00:00 2001 From: Raruto Date: Mon, 30 Jan 2023 12:17:47 +0100 Subject: [PATCH 08/14] add `watch:plugins` task --- gulpfile.js | 33 ++++++++++++++++++++++++++++++--- package.json | 1 + 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 513c61c00..c4c8f8029 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -46,8 +46,11 @@ let production = false; let outputFolder = g3w.admin_overrides_folder; // ANSI color codes -const H1__ = "\n\n\033[0;32m\#\#\# "; -const __H1 = " \#\#\# \033[0m\n"; +const INFO__ = "\033[0;32m\#\#\# "; +const __INFO = " \#\#\# \033[0m"; +const H1__ = "\n\n" + INFO__; +const __H1 = __INFO + "\n"; + // Retrieve project dependencies ("g3w-client") const dependencies = Object.keys(packageJSON.dependencies).filter(dep => dep !== 'vue'); @@ -356,7 +359,7 @@ gulp.task('clone:default_plugins', function() { }); /** - * Make sure that all g3w.plugins bundles are there + * Make sure that all g3w.plugins bundles are there (NB: without watching them) * * CORE PLUGINS: * - [submodule "src/plugins/editing"] --> src/plugins/editing/plugin.js @@ -381,6 +384,30 @@ gulp.task('build:dev_plugins', function() { }); }); +/** + * Run `gulp watch` on each g3w.plugin folder + */ +gulp.task('watch:plugins', function() { + const { exec } = require('child_process'); + const dev_plugins = Array.from(new Set(default_plugins.concat(g3w.plugins instanceof Array ? plugins : Object.keys(g3w.plugins)))); + return new Promise(async done => { + for (const pluginName of dev_plugins) { + console.log(INFO__ + `Watching plugin: ${g3w.pluginsFolder}/${pluginName}/plugin.js` + __INFO); + exec(`gulp --gulpfile ${g3w.pluginsFolder}/${pluginName}/gulpfile.js watch`, + (error, stdout, stderr) => { + if (error) { + console.error(`exec error: ${error}`); + return; + } + console.log(`stdout: ${stdout}`); + console.error(`stderr: ${stderr}`); + } + ); + } + // done(); + }); +}); + /** * Ask the developer which plugins wants to deploy */ diff --git a/package.json b/package.json index 7d9830529..0b0194845 100755 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "preinstall": "npx npm-force-resolutions", "build": "gulp version && gulp build --max-old-space-size=2048", "build:plugins": "gulp version && gulp build:plugins", + "watch:plugins": "gulp version && gulp watch:plugins", "dev": "gulp dev --max-old-space-size=2048", "docker": "docker compose --env-file ../g3w-suite-docker/.env --file ../g3w-suite-docker/docker-compose-dev.yml --project-name g3w-suite-docker --project-directory ../g3w-suite-docker", "docker:pull": "npm run docker pull", From 6d6421b235a9000b21ea000ac658ab24b5e3e5e3 Mon Sep 17 00:00:00 2001 From: Raruto Date: Mon, 30 Jan 2023 14:21:41 +0100 Subject: [PATCH 09/14] remove useful promises --- gulpfile.js | 75 +++++++++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 43 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index c4c8f8029..ead9f6229 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -18,6 +18,8 @@ const buffer = require('vinyl-buffer'); const source = require('vinyl-source-stream'); // Node.js +const exec = require('child_process').exec; +const execSync = require('child_process').execSync; const del = require('del'); const fs = require('fs'); const path = require('path'); @@ -55,12 +57,16 @@ const __H1 = __INFO + "\n"; // Retrieve project dependencies ("g3w-client") const dependencies = Object.keys(packageJSON.dependencies).filter(dep => dep !== 'vue'); -// Bult-in client plugins +// Built-in client plugins const default_plugins = [ 'editing', 'qplotly', 'qtimeseries' ]; +// Locally developed client plugins = [ default_plugins ] + [ g3w.plugins ] +const dev_plugins = Array.from(new Set( + default_plugins.concat(g3w.plugins instanceof Array ? plugins : Object.keys(g3w.plugins)) +)); // production const to set environmental variable function setNODE_ENV() { @@ -343,19 +349,15 @@ gulp.task('browser-sync', function() { * [submodule "src/plugins/qtimeseries"] <-- https://github.com/g3w-suite/g3w-client-plugin-qtimeseries.git */ gulp.task('clone:default_plugins', function() { - const { execSync } = require('child_process'); - return new Promise(async done => { - console.log(H1__ + `Cloning default plugins` + __H1); - for (const pluginName of default_plugins) { - if (!fs.existsSync(`${g3w.pluginsFolder}/${pluginName}/.git`)) { - execSync(`git clone https://github.com/g3w-suite/g3w-client-plugin-${pluginName}.git ${g3w.pluginsFolder}/${pluginName}`, {stdio: 'inherit'}); - } - if (!fs.existsSync(`${g3w.pluginsFolder}/${pluginName}/plugin.js`)) { - execSync(`gulp --gulpfile ${g3w.pluginsFolder}/${pluginName}/gulpfile.js default`, {stdio: 'inherit'}); - } + console.log(H1__ + `Cloning default plugins` + __H1); + for (const pluginName of default_plugins) { + if (!fs.existsSync(`${g3w.pluginsFolder}/${pluginName}/.git`)) { + execSync(`git clone https://github.com/g3w-suite/g3w-client-plugin-${pluginName}.git ${g3w.pluginsFolder}/${pluginName}`, {stdio: 'inherit'}); } - done(); - }); + if (!fs.existsSync(`${g3w.pluginsFolder}/${pluginName}/plugin.js`)) { + execSync(`gulp --gulpfile ${g3w.pluginsFolder}/${pluginName}/gulpfile.js default`, {stdio: 'inherit'}); + } + } }); /** @@ -371,41 +373,28 @@ gulp.task('clone:default_plugins', function() { * - [submodule "src/plugins/sidebar"] --> src/plugins/sidebar/plugin.js */ gulp.task('build:dev_plugins', function() { - const { execSync } = require('child_process'); - const dev_plugins = Array.from(new Set(default_plugins.concat(g3w.plugins instanceof Array ? plugins : Object.keys(g3w.plugins)))); - return new Promise(async done => { - for (const pluginName of dev_plugins) { - console.log(H1__ + `Building plugin: ${g3w.pluginsFolder}/${pluginName}/plugin.js` + __H1); - try { - execSync(`gulp --gulpfile ${g3w.pluginsFolder}/${pluginName}/gulpfile.js default`, {stdio: 'inherit'}); - } catch(e) { /* fails silently */ } - } - done(); - }); + for (const pluginName of dev_plugins) { + console.log(H1__ + `Building plugin: ${g3w.pluginsFolder}/${pluginName}/plugin.js` + __H1); + try { + execSync(`gulp --gulpfile ${g3w.pluginsFolder}/${pluginName}/gulpfile.js default`, {stdio: 'inherit'}); + } catch(e) { /* soft fails on missing `gulp default` task */ } + } }); /** - * Run `gulp watch` on each g3w.plugin folder + * Run `gulp watch` on each g3w.plugins folder */ gulp.task('watch:plugins', function() { - const { exec } = require('child_process'); - const dev_plugins = Array.from(new Set(default_plugins.concat(g3w.plugins instanceof Array ? plugins : Object.keys(g3w.plugins)))); - return new Promise(async done => { - for (const pluginName of dev_plugins) { - console.log(INFO__ + `Watching plugin: ${g3w.pluginsFolder}/${pluginName}/plugin.js` + __INFO); - exec(`gulp --gulpfile ${g3w.pluginsFolder}/${pluginName}/gulpfile.js watch`, - (error, stdout, stderr) => { - if (error) { - console.error(`exec error: ${error}`); - return; - } - console.log(`stdout: ${stdout}`); - console.error(`stderr: ${stderr}`); - } - ); - } - // done(); - }); + for (const pluginName of dev_plugins) { + console.log(INFO__ + `Watching plugin: ${g3w.pluginsFolder}/${pluginName}/plugin.js` + __INFO); + exec(`gulp --gulpfile ${g3w.pluginsFolder}/${pluginName}/gulpfile.js watch`, + (error, stdout, stderr) => { + if (error) { console.error(`exec error: ${error}`); return; } + console.log(`stdout: ${stdout}`); + console.error(`stderr: ${stderr}`); + } + ); + } }); /** From abf2dfe0cf5eb9871274977670888bf25b82ab25 Mon Sep 17 00:00:00 2001 From: Raruto Date: Mon, 30 Jan 2023 16:49:00 +0100 Subject: [PATCH 10/14] update `README.md` (plugins development) --- README.md | 61 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 747bf4b96..d5561567c 100755 --- a/README.md +++ b/README.md @@ -93,11 +93,9 @@ cd ./g3w-client You can start the built-in development servers by using the following: ```sh -npm run docker:up # backend server (g3w-admin) -``` - -```sh -npm run dev # frontend server (g3w-client) +npm run docker:up # backend server (g3w-admin) +npm run dev # frontend server (g3w-client) +npm run watch:plugins # built-in plugins (editing, qplotly, qtimeseries) ``` If everything went fine, you can now visit you local development server URL to see changes, the following rules are applied: @@ -124,16 +122,31 @@ http://localhost:3000/en/map/eleprofile/qdjango/2 # g3w-client (development) ### Plugins -If you want develop custom plugins you need to place them in the [`src/plugins`](https://github.com/g3w-suite/g3w-client/blob/dev/src/plugins) folder, below you can see some examples: +If you want develop client plugins you need place them in the [`src/plugins`](https://github.com/g3w-suite/g3w-client/blob/dev/src/plugins) folder and then update your [`config.js`](https://github.com/g3w-suite/g3w-client/blob/dev/config.template.js) file accordinly: + +```sh +. +└── src/ + └── plugins/ + ├── base + ├── eleprofile + ├── sidebar + └── ... +``` + +```js +const G3W_PLUGINS = [ 'base', 'eleprofile', 'sidebar', /* ... */ ]; // overrides `window.initConfig.group.plugins` +``` + +And then restart client development servers: + +```sh +npm run docker:up # backend server (g3w-admin) +npm run dev # frontend server (g3w-client) +npm run watch:plugins # built-in plugins + custom plugins (base, eleprofile, sidebar) +``` -- [base-template](https://github.com/g3w-suite/g3w-client-plugin-base-template) -- [editing](https://github.com/g3w-suite/g3w-client-plugin-editing) -- [eleprofile](https://github.com/g3w-suite/g3w-client-plugin-elevation-profile) -- [openrouteservice](https://github.com/g3w-suite/g3w-client-plugin-openrouteservice) -- [qplotly](https://github.com/g3w-suite/g3w-client-plugin-qplotly) -- [qtimeseries](https://github.com/g3w-suite/g3w-client-plugin-qtimeseries) -- [queryresult-template](https://github.com/g3w-suite/g3w-client-plugin-queryresult-template) -- [sidebar-template](https://github.com/g3w-suite/g3w-client-plugin-sidebar-template) +For further information about plugin development, see also: [`src/plugins/README.md`](https://github.com/g3w-suite/g3w-client/blob/dev/src/src/plugins/README.md) --- @@ -214,7 +227,25 @@ For more info:
-3. How can I translate this project? +3. How can I keep client plugins updated ? + +Currently the built-in and custom plugins are managed with several "independent" git repositories, so there is currently no automated task to achieve this. + +You can use the following commands to get the latest changes of built-in plugins: + +```sh +cd /g3w-client/src/plugins/editing && git pull editing +cd /g3w-client/src/plugins/qplotly && git pull qplotly +cd /g3w-client/src/plugins/qtimeseries && git pull qtimeseries +``` + +If you are looking for an alternative workflow, also try to take a look at [git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) or [git subtrees](https://www.atlassian.com/git/tutorials/git-subtree) + +
+ +
+ +4. How can I translate this project? Depending on your current project version, you can edit one of the following files and then submit a [pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request): From 4f299e3a140b5bba37698747dfba33df580ab4df Mon Sep 17 00:00:00 2001 From: Raruto Date: Mon, 30 Jan 2023 16:56:39 +0100 Subject: [PATCH 11/14] Update README.md --- README.md | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d5561567c..699369271 100755 --- a/README.md +++ b/README.md @@ -94,7 +94,13 @@ You can start the built-in development servers by using the following: ```sh npm run docker:up # backend server (g3w-admin) +``` + +```sh npm run dev # frontend server (g3w-client) +``` + +```sh npm run watch:plugins # built-in plugins (editing, qplotly, qtimeseries) ``` @@ -122,7 +128,7 @@ http://localhost:3000/en/map/eleprofile/qdjango/2 # g3w-client (development) ### Plugins -If you want develop client plugins you need place them in the [`src/plugins`](https://github.com/g3w-suite/g3w-client/blob/dev/src/plugins) folder and then update your [`config.js`](https://github.com/g3w-suite/g3w-client/blob/dev/config.template.js) file accordinly: +If you want develop client plugins you need place them in the [`src/plugins`](https://github.com/g3w-suite/g3w-client/blob/dev/src/plugins) folder and then update your [`config.js`](https://github.com/g3w-suite/g3w-client/blob/dev/config.template.js) file accordingly: ```sh . @@ -135,10 +141,17 @@ If you want develop client plugins you need place them in the [`src/plugins`](ht ``` ```js -const G3W_PLUGINS = [ 'base', 'eleprofile', 'sidebar', /* ... */ ]; // overrides `window.initConfig.group.plugins` +// overrides global `window.initConfig.group.plugins` property for custom plugin development + +const G3W_PLUGINS = [ + 'base', + 'eleprofile', + 'sidebar', + ... +]; ``` -And then restart client development servers: +And then start again the development servers: ```sh npm run docker:up # backend server (g3w-admin) @@ -234,9 +247,21 @@ Currently the built-in and custom plugins are managed with several "independent" You can use the following commands to get the latest changes of built-in plugins: ```sh -cd /g3w-client/src/plugins/editing && git pull editing -cd /g3w-client/src/plugins/qplotly && git pull qplotly -cd /g3w-client/src/plugins/qtimeseries && git pull qtimeseries +cd /g3w-client/src/plugins/editing + +git pull editing +``` + +```sh +cd /g3w-client/src/plugins/qplotly + +git pull qplotly +``` + +```sh +cd /g3w-client/src/plugins/qtimeseries + +git pull qtimeseries ``` If you are looking for an alternative workflow, also try to take a look at [git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) or [git subtrees](https://www.atlassian.com/git/tutorials/git-subtree) From 0423e5c75ca961e0ee4505e450f955ccea0a232d Mon Sep 17 00:00:00 2001 From: Raruto Date: Mon, 30 Jan 2023 17:00:00 +0100 Subject: [PATCH 12/14] Update README.md --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 699369271..7e1f52cab 100755 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ npm run dev # frontend server (g3w-client) ``` ```sh -npm run watch:plugins # built-in plugins (editing, qplotly, qtimeseries) +npm run watch:plugins # watch built-in plugins (editing, qplotly, qtimeseries) ``` If everything went fine, you can now visit you local development server URL to see changes, the following rules are applied: @@ -128,7 +128,7 @@ http://localhost:3000/en/map/eleprofile/qdjango/2 # g3w-client (development) ### Plugins -If you want develop client plugins you need place them in the [`src/plugins`](https://github.com/g3w-suite/g3w-client/blob/dev/src/plugins) folder and then update your [`config.js`](https://github.com/g3w-suite/g3w-client/blob/dev/config.template.js) file accordingly: +If you want develop client plugins you need place them in the [`src/plugins`](https://github.com/g3w-suite/g3w-client/blob/dev/src/plugins) folder: ```sh . @@ -140,6 +140,8 @@ If you want develop client plugins you need place them in the [`src/plugins`](ht └── ... ``` +Update your [`config.js`](https://github.com/g3w-suite/g3w-client/blob/dev/config.template.js) file accordingly: + ```js // overrides global `window.initConfig.group.plugins` property for custom plugin development @@ -156,7 +158,7 @@ And then start again the development servers: ```sh npm run docker:up # backend server (g3w-admin) npm run dev # frontend server (g3w-client) -npm run watch:plugins # built-in plugins + custom plugins (base, eleprofile, sidebar) +npm run watch:plugins # watch built-in plugins + any custom plugin (eg. base, eleprofile, sidebar) ``` For further information about plugin development, see also: [`src/plugins/README.md`](https://github.com/g3w-suite/g3w-client/blob/dev/src/src/plugins/README.md) From 1ac5c566095893cb647de8fc45e8aea2044b37fd Mon Sep 17 00:00:00 2001 From: Raruto Date: Tue, 31 Jan 2023 10:35:55 +0100 Subject: [PATCH 13/14] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7e1f52cab..e1fb4d5f5 100755 --- a/README.md +++ b/README.md @@ -244,9 +244,9 @@ For more info: 3. How can I keep client plugins updated ? -Currently the built-in and custom plugins are managed with several "independent" git repositories, so there is currently no automated task to achieve this. +Currently built-in and custom plugins are managed with several "independent" git repositories, so there is currently no automated task to achieve this. -You can use the following commands to get the latest changes of built-in plugins: +You can use the following commands to fetch the latest changes of built-in plugins: ```sh cd /g3w-client/src/plugins/editing From 78d0a8e98680043fca099256f8ec439bc9adfffd Mon Sep 17 00:00:00 2001 From: Raruto Date: Tue, 7 Feb 2023 10:15:46 +0100 Subject: [PATCH 14/14] add new built-in plugin: `openrouteservice` --- README.md | 8 +++++++- gulpfile.js | 9 ++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b96f4f813..0ce6b71a1 100755 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ npm run dev # frontend server (g3w-client) ``` ```sh -npm run watch:plugins # watch built-in plugins (editing, qplotly, qtimeseries) +npm run watch:plugins # watch built-in plugins (editing, openrouteservice, qplotly, qtimeseries) ``` If everything went fine, you can now visit you local development server URL to see changes, the following rules are applied: @@ -254,6 +254,12 @@ cd /g3w-client/src/plugins/editing git pull editing ``` +```sh +cd /g3w-client/src/plugins/openrouteservice + +git pull openrouteservice +``` + ```sh cd /g3w-client/src/plugins/qplotly diff --git a/gulpfile.js b/gulpfile.js index ead9f6229..49db98a90 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -60,6 +60,7 @@ const dependencies = Object.keys(packageJSON.dependencies).filter(dep => dep !== // Built-in client plugins const default_plugins = [ 'editing', + 'openrouteservice', 'qplotly', 'qtimeseries' ]; @@ -344,9 +345,10 @@ gulp.task('browser-sync', function() { /** * Make sure that core client plugins are there * - * [submodule "src/plugins/editing"] <-- https://github.com/g3w-suite/g3w-client-plugin-editing.git - * [submodule "src/plugins/qplotly"] <-- https://github.com/g3w-suite/g3w-client-plugin-qplotly.git - * [submodule "src/plugins/qtimeseries"] <-- https://github.com/g3w-suite/g3w-client-plugin-qtimeseries.git + * [submodule "src/plugins/editing"] <-- https://github.com/g3w-suite/g3w-client-plugin-editing.git + * [submodule "src/plugins/openrouteservice"] <-- https://github.com/g3w-suite/g3w-client-plugin-openrouteservice.git + * [submodule "src/plugins/qplotly"] <-- https://github.com/g3w-suite/g3w-client-plugin-qplotly.git + * [submodule "src/plugins/qtimeseries"] <-- https://github.com/g3w-suite/g3w-client-plugin-qtimeseries.git */ gulp.task('clone:default_plugins', function() { console.log(H1__ + `Cloning default plugins` + __H1); @@ -365,6 +367,7 @@ gulp.task('clone:default_plugins', function() { * * CORE PLUGINS: * - [submodule "src/plugins/editing"] --> src/plugins/editing/plugin.js + * - [submodule "src/plugins/qtimeseries"] --> src/plugins/qtimeseries/plugin.js * - [submodule "src/plugins/qplotly"] --> src/plugins/qplotly/plugin.js * - [submodule "src/plugins/qtimeseries"] --> src/plugins/qtimeseries/plugin.js *