Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace http-proxy server with BrowserSync proxy (docker development) #150

Merged
merged 38 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
016d3a2
Remove `http-proxy` server
Raruto Aug 22, 2022
09734a5
update development URLs within `readme.md`
Raruto Aug 22, 2022
b9289ed
Merge branch 'dev' into browser-sync-proxy
Raruto Aug 24, 2022
00ee32c
Fix wrong merge
Raruto Aug 24, 2022
04cb5da
Proxy routes fallback within `config.template.js` (v3.x)
Raruto Aug 24, 2022
f0b0f91
remove gulp task `plugins`
Raruto Aug 24, 2022
0130b74
remove "glob" need when updating plugin files
Raruto Aug 24, 2022
7821412
Merge branch 'dev' into browser-sync-proxy
Raruto Aug 26, 2022
516f734
refactor and simply vendors build chain
Raruto Aug 31, 2022
d9c51d6
Merge branch 'dev' into browser-sync-proxy
Raruto Aug 31, 2022
d3eac4e
reduce delta
Raruto Aug 31, 2022
3bc308b
update comments
Raruto Aug 31, 2022
d8e73a6
live reload application on plugin.js changes
Raruto Aug 31, 2022
3477c5d
add comments and sort tasks
Raruto Sep 1, 2022
56d8a59
handle `build:plugins` task in local development
Raruto Sep 5, 2022
602f461
handle local developed plugins
Raruto Sep 5, 2022
0d8fb18
micro-optimization (single glob watch)
Raruto Sep 5, 2022
0e0d300
remove mandatory `gid` and `baseurl` options within `G3W_PLUGINS`
Raruto Sep 6, 2022
d9202ac
generate `app.min.js.map` (PRODUCTION)
Raruto Sep 6, 2022
192a690
refactor browserify transform option
Raruto Sep 6, 2022
a8f3450
restore previous plugin developement tips (v3.4)
Raruto Sep 7, 2022
6a10052
Merge branch 'dev' into browser-sync-proxy
volterra79 Sep 22, 2022
061776c
Merge branch 'dev' into browser-sync-proxy
Raruto Oct 28, 2022
a97cb5d
restore vendors fonts in gulp chain
Raruto Oct 28, 2022
b167ce6
Update "g3w-admin" and "g3w-suite-docker" badge versions
Raruto Oct 31, 2022
9feba90
set v3.5 also on badge image..
Raruto Oct 31, 2022
06540eb
Add some minimal info about "Plugins" development
Raruto Oct 31, 2022
11220dd
Merge branch 'dev' into browser-sync-proxy
volterra79 Nov 10, 2022
61de71f
Align with dev new css and js vendors
volterra79 Nov 10, 2022
35d13e5
Merge remote-tracking branch 'origin/browser-sync-proxy' into browser…
volterra79 Nov 10, 2022
323844b
Merge branch 'dev' into browser-sync-proxy
volterra79 Nov 11, 2022
979fdc7
Merge branch 'dev' into browser-sync-proxy
volterra79 Jan 10, 2023
9a67f58
Comment change skin color to skin-blue on development environment to …
volterra79 Jan 10, 2023
186d37f
Rename admin_plugins_folder to admin_folder because it referred to g3…
volterra79 Jan 10, 2023
2273ebd
Revert "Rename admin_plugins_folder to admin_folder because it referr…
volterra79 Jan 10, 2023
46d2d40
Revert "Rename admin_plugins_folder to admin_folder because it referr…
volterra79 Jan 10, 2023
415ca9f
replace "comment" section with a TODO
Raruto Jan 10, 2023
7079b5d
Add deprecate wrapper comment to a part of code to extract project gr…
volterra79 Jan 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ package-lock.json
/src/assets/style/less/g3w-skins-custom/
/src/libs/sdk/config/dev/
/src/libs/sdk/g3w-ol3/config/config.js
/src/index.html
/src/plugins/**
!/src/plugins/README.md
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ If everything went fine, you can now visit you local development server URL to s
# project_type = "qdjango";
# project_id = "1"

http://localhost:8000/en/map/countries/qdjango/1 # g3w-admin (production)
http://localhost:3000/?project=countries/qdjango/1 # g3w-client (development)
http://localhost:8000/en/map/countries/qdjango/1 # g3w-admin (production)
http://localhost:3000/en/map/countries/qdjango/1 # g3w-client (development)
```

```sh
Expand All @@ -118,10 +118,23 @@ http://localhost:3000/?project=countries/qdjango/1 # g3w-client (development)
# project_type = "qdjango";
# project_id = "2"

http://localhost:8000/en/map/eleprofile/qdjango/2 # g3w-admin (production)
http://localhost:3000/?project=eleprofile/qdjango/2 # g3w-client (development)
http://localhost:8000/en/map/eleprofile/qdjango/2 # g3w-admin (production)
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:

- [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)

---

### FAQ
Expand Down Expand Up @@ -217,8 +230,8 @@ All notable changes to this project are documented in the [releases](https://git
---

**Compatibile with:**
[![g3w-admin version](https://img.shields.io/badge/g3w--admin-3.4-1EB300.svg?style=flat)](https://github.com/g3w-suite/g3w-admin/tree/v.3.4.x)
[![g3w-suite-docker version](https://img.shields.io/badge/g3w--suite--docker-3.4-1EB300.svg?style=flat)](https://github.com/g3w-suite/g3w-suite-docker/tree/v3.4.x)
[![g3w-admin version](https://img.shields.io/badge/g3w--admin-3.5-1EB300.svg?style=flat)](https://github.com/g3w-suite/g3w-admin/tree/v.3.5.x)
[![g3w-suite-docker version](https://img.shields.io/badge/g3w--suite--docker-3.5-1EB300.svg?style=flat)](https://github.com/g3w-suite/g3w-suite-docker/tree/v3.5.x)

---

Expand Down
69 changes: 30 additions & 39 deletions config.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,68 +4,59 @@ const G3W_HOST_SCHEMA = 'http';
const G3W_HOST = '127.0.0.1'; // local development server
const G3W_ADMIN_PORT = '8000'; // G3W-ADMIN development server
const G3W_CLIENT_PORT = '3000'; // G3W-CLIENT development server
const G3W_PROXY_ROUTES = [ // G3W-ADMIN routes to be proxied while developing
'/media',
'/api',
'/ows',
'/static',
'/en/',
'/it/',
'/upload/'
];

const G3W_PLUGINS = { // override "initConfig->group->plugins" attribute for custom plugin development
// "your-plugin-folder-name": {
// baseurl: '../dist',
// gid: 'qdjango:1' // 1 = current project id
// }
};
const G3W_PLUGINS = [ // override "initConfig->group->plugins" attribute for custom plugin development
// "your-plugin-folder-name-1",
// "your-plugin-folder-name-2",
// "your-plugin-folder-name-3",
];

const G3W_KEYS = {
// google: '<INSERT HERE YOUR GOOGLE API KEY>',
// bing: '<INSERT HERE YOUR BING API KEY>'
};

const G3W_ADMIN_PATH = '../g3w-admin/g3w-admin'; // path to G3W-ADMIN main code

let conf = {
assetsFolder: './src/assets', // path to G3W-CLIENT assets folder
pluginsFolder: './src/plugins', // path to G3W-CLIENT plugins folder
distFolder: './dist', // path to G3W-CLIENT dist folder
clientFolder: './dist/client', // path to G3W-CLIENT client folder
admin_plugins_folder: G3W_ADMIN_PATH, // path to G3W-ADMIN where are stored all plugin folders
admin_static_folder: `${G3W_ADMIN_PATH}/client/static`, // path to G3W-ADMIN client/static
admin_templates_folder: `${G3W_ADMIN_PATH}/client/templates`, // path to G3W-ADMIN client/templates
assetsFolder: './src/assets', // path to G3W-CLIENT assets folder
pluginsFolder: './src/plugins', // path to G3W-CLIENT plugins folder
admin_plugins_folder: '../g3w-admin/g3w-admin', // path to G3W-ADMIN plugins folder
admin_overrides_folder: '../g3w-suite-docker/config/g3w-suite/overrides', // path to G3W-SUITE overrides folder
host: G3W_HOST,
port: G3W_CLIENT_PORT,
// proxy configuration for local G3W_ADMIN server (where G3W-ADMIN is running)
proxy: {
host: G3W_HOST,
url: `${G3W_HOST_SCHEMA}://${G3W_HOST}:${G3W_ADMIN_PORT}/`,
routes: G3W_PROXY_ROUTES
},
test: {
path: '/test/config/groups/'
},
createProject: {
before(project) { /* code here */ },
after(project) { /* code here */ },
},
setCurrentProject: {
before(project) { /* code here */ },
after(project) { /* code here */ },
},
// override "initConfig->group->plugins" attribute for custom plugin development
plugins: G3W_PLUGINS,
keys: G3W_KEYS
keys: G3W_KEYS,
devConfig: function() {
g3wsdk.core.ApplicationService.once('ready', () => { });
g3wsdk.core.project.ProjectsRegistry.onbefore('createProject', (projectConfig) => {});
g3wsdk.core.project.ProjectsRegistry.onafter('createProject', (projectConfig) => {});
g3wsdk.core.project.ProjectsRegistry.onbefore('setCurrentProject', (project) => {});
g3wsdk.core.project.ProjectsRegistry.onafter('setCurrentProject', (project) => {});
g3wsdk.gui.GUI.once('ready', () => { console.log('ready'); });
}
};

// backward compatibilities (v3.x)
if (version < '4') {
conf.assetsFolder = (version < '3.7' ? './assets' : conf.assetsFolder);
conf.proxy.urls = conf.proxy.routes;
conf.localServerPort = conf.port;
conf.g3w_admin_paths = {
conf.assetsFolder = (version < '3.7' ? './assets' : conf.assetsFolder);
conf.distFolder = './dist';
conf.clientFolder = './dist/client';
conf.admin_static_folder = `${conf.admin_plugins_folder}/client/static`;
conf.admin_templates_folder = `${conf.admin_plugins_folder}/client/templates`;
conf.createProject = { before() {}, after() {} };
conf.setCurrentProject = { before() {}, after() {} };
conf.plugins = conf.plugins.reduce((a, v) => ({ ...a, [v]: { gid: 'qdjango:1', baseurl: `.${conf.distFolder}` }}), {});
conf.proxy.routes = ['/media', '/api', '/ows', '/static', '/en/', '/it/', '/upload/'];
conf.proxy.urls = conf.proxy.routes;
conf.localServerPort = conf.port;
conf.g3w_admin_paths = {
dev: {
g3w_admin_plugins_basepath: conf.admin_plugins_folder.replace(/\/?$/, '/'),
g3w_admin_client_dest_static: conf.admin_static_folder,
Expand Down
Loading