Skip to content

Commit

Permalink
remove themes and switch to standard mapstore project (#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
allyoucanmap authored Aug 23, 2021
1 parent a6f593f commit cc60405
Show file tree
Hide file tree
Showing 19 changed files with 119 additions and 362 deletions.
71 changes: 71 additions & 0 deletions geonode_mapstore_client/client/devServer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
const path = require('path');
const fs = require('fs');

module.exports = (devServerDefault, projectConfig) => {

const appDirectory = projectConfig.appDirectory;
const envPath = path.resolve(appDirectory, 'env.json');
const envJson = fs.existsSync(envPath) ? require(envPath) : {};
const packageJSON = require(path.resolve(appDirectory, 'package.json')) || {};
const geoNodeProjectConfig = packageJSON.geonode || {};
const devServerOptions = geoNodeProjectConfig.devServer || {};
const devServerHost = devServerOptions.host || envJson.DEV_SERVER_HOST || 'localhost';
const proxyTargetHost = devServerOptions.proxyTargetHost || envJson.DEV_SERVER_PROXY_TARGET_HOST || 'localhost:8000';
const protocol = devServerOptions.protocol || envJson.DEV_SERVER_HOST_PROTOCOL || 'http';

return {
clientLogLevel: 'debug',
https: protocol === 'https' ? true : false,
host: devServerHost,
headers: {
'Access-Control-Allow-Origin': '*'
},
contentBase: [
path.join(appDirectory)
],
before: function(app) {
const hashRegex = /\.[a-zA-Z0-9]{1,}\.js/;
app.use(function(req, res, next) {
// remove hash from requests to use the local js
const appsName = [
...(projectConfig.apps || [])
]
.find(name => req.url.indexOf('/' + name) !== -1 );
if (appsName) {
req.url = req.url.replace(hashRegex, '.js');
req.path = req.path.replace(hashRegex, '.js');
req.originalUrl = req.originalUrl.replace(hashRegex, '.js');
}
next();
});
},
proxy: [
{
context: [
'**',
'!**/static/mapstore/**',
'!**/MapStore2/**',
'!**/node_modules/**'
],
target: `${protocol}://${proxyTargetHost}`,
headers: {
Host: proxyTargetHost,
Referer: `${protocol}://${proxyTargetHost}/`
}
},
{
context: [
'/static/mapstore/ms-translations/**',
'/static/mapstore/gn-translations/**'
],
target: `${protocol}://${devServerHost}:8081`,
secure: false,
changeOrigin: true,
pathRewrite: {
'/static/mapstore/ms-translations': '/node_modules/mapstore/web/client/translations',
'/static/mapstore/gn-translations': '/static/mapstore/translations'
}
}
]
};
};
10 changes: 0 additions & 10 deletions geonode_mapstore_client/client/js/extend.js

This file was deleted.

1 change: 0 additions & 1 deletion geonode_mapstore_client/client/js/index.js

This file was deleted.

9 changes: 1 addition & 8 deletions geonode_mapstore_client/client/js/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import isFunction from 'lodash/isFunction';
import merge from 'lodash/merge';
import omit from 'lodash/omit';
import { extendPluginsDefinition } from '@extend/jsapi/plugins';
import {
PrintActionButton,
CatalogActionButton,
Expand Down Expand Up @@ -386,10 +385,4 @@ const pluginsDefinition = {
reducers: {}
};

const extendedPluginsDefinition = splitLazyAndStaticPlugins(
extendPluginsDefinition
? extendPluginsDefinition(pluginsDefinition, { toLazyPlugin })
: pluginsDefinition
);

export default extendedPluginsDefinition;
export default splitLazyAndStaticPlugins(pluginsDefinition);
2 changes: 1 addition & 1 deletion geonode_mapstore_client/client/js/utils/AppUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export function setupConfiguration({
});
setConfigProp('translationsPath', config.translationsPath
? config.translationsPath
: __MAPSTORE_PROJECT_CONFIG__.translationsPath
: ['/static/mapstore/gn-translations', '/static/mapstore/ms-translations']
);
const supportedLocales = defaultSupportedLocales || getSupportedLocales();
setSupportedLocales(supportedLocales);
Expand Down
28 changes: 20 additions & 8 deletions geonode_mapstore_client/client/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"name": "geonode-mapstore-client",
"version": "4.0.0",
"description": "MapStore 2 Api bundle specific to geonode framework",
"main": "api.js",
"description": "MapStore 2 bundles specific to geonode framework",
"eslintConfig": {
"extends": [
"@mapstore/eslint-config-mapstore"
Expand All @@ -17,17 +16,16 @@
}
},
"scripts": {
"compile": "mapstore-project compile geonode && node postCompile",
"start": "mapstore-project start geonode",
"test": "mapstore-project test geonode",
"test:watch": "mapstore-project test:watch geonode",
"update-project": "mapstore-project update geonode",
"compile": "mapstore-project compile && node postCompile",
"start": "mapstore-project start",
"test": "mapstore-project test",
"test:watch": "mapstore-project test:watch",
"lint": "eslint js --ext .jsx,.js"
},
"author": "GeoSolutions",
"license": "BSD-2-Clause",
"devDependencies": {
"@mapstore/project": "1.0.16"
"@mapstore/project": "1.0.18"
},
"dependencies": {
"font-awesome": "4.7.0",
Expand All @@ -41,5 +39,19 @@
"proxyTargetHost": "localhost:8000",
"protocol": "http"
}
},
"mapstore": {
"output": "dist",
"publicPath": "/static/mapstore/dist/",
"themePrefix": "msgapi",
"apps": [
"js/apps"
],
"html": [
""
],
"themes": [
"themes/"
]
}
}
21 changes: 19 additions & 2 deletions geonode_mapstore_client/client/postCompile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@

const fs = require('fs');
const rimraf = require('rimraf');
const childProcess = require('child_process');
const fs = require('fs-extra');
const path = require('path');
const message = require('@mapstore/project/scripts/utils/message');
const info = require('@mapstore/project/scripts/utils/info');
const { commit, version, name } = info();

const appDirectory = fs.realpathSync(process.cwd());
const staticPath = '../static/mapstore';
const distDirectory = 'dist';
rimraf.sync(path.resolve(appDirectory, staticPath));
message.title('cleaned static/mapstore/ directory');
fs.moveSync(path.resolve(appDirectory, distDirectory), path.resolve(appDirectory, staticPath + '/' + distDirectory));
fs.moveSync(path.resolve(appDirectory, staticPath + '/' + distDirectory + '/static/mapstore'), path.resolve(appDirectory, staticPath));
fs.moveSync(path.resolve(appDirectory, staticPath + '/' + distDirectory + '/ms-translations'), path.resolve(appDirectory, staticPath + '/ms-translations'));
fs.renameSync(path.resolve(appDirectory, staticPath + '/translations'), path.resolve(appDirectory, staticPath + '/gn-translations'));
fs.writeFileSync(path.resolve(appDirectory, 'version.txt'), `${name}-v${version}-${commit}`);
fs.writeFileSync(path.resolve(appDirectory, staticPath, 'version.txt'), `${name}-v${version}-${commit}`);
message.title(`updated version -> version ${version} - commit ${commit}`);

const packageJSONPath = './package.json';
const rootPackageJSONPath = '../../package.json';
Expand Down
147 changes: 0 additions & 147 deletions geonode_mapstore_client/client/themes/default/less/geonode.less

This file was deleted.

18 changes: 0 additions & 18 deletions geonode_mapstore_client/client/themes/default/theme.less

This file was deleted.

28 changes: 0 additions & 28 deletions geonode_mapstore_client/client/themes/default/variables.less

This file was deleted.

Loading

0 comments on commit cc60405

Please sign in to comment.