Interactive interface for browsing global, full-resolution satellite imagery
Add npm script options
Jason Kent2dd4bf4434b5
diff --git a/doc/developing.md b/doc/developing.mdindex 6aacb3103..ee56b7c36 100644--- a/doc/developing.md+++ b/doc/developing.md@@ -33,7 +33,8 @@ To build the app with an incomplete configuration, prefix the command like this:**`npm run notes`**: Runs [github-changelog-generator](https://github.com/github-changelog-generator/github-changelog-generator) to automatically build release notes. For individual release notes, add release tag argument option, for example `npm run notes tag=v3.3.1`. Will use `docker` by default. To use `ruby`, add `ruby=true`. For example `npm run notes ruby=true`. Will use `master` branch by default. To use specific branch, add `branch=develop`. Combine arguments, for example `npm run notes ruby=true branch=develop`.**`npm run watch`**: Builds and serves local Development mode Webpack bundle in watch mode using Webpack Dev Server (*Note: It is necessary to wait for the initial build to finish before being able to develop*). JS and CSS bundles are updated automatically when source files change. You must run `npm run build` or `npm run build:config` first to make a request to the GIBS `GetCapabilities` API and build the configuration files.-**`npm run watch:debug`**: Injects a global `DEBUG` object into `main.js`. This will activate `react-logger` which logs the before and after state of each action.+**`npm run watch:debug:logger`**: This will activate `redux-logger` which logs the before and after state of each action.+**`npm run watch:debug:devtools`**: This will activate `redux-devtools` which allows using a browser exetension to debug Redux state.## Startingdiff --git a/package.json b/package.jsonindex 796cb1f10..9cc680fd9 100644--- a/package.json+++ b/package.json@@ -81,7 +81,8 @@"test:unit:tz:coverage": "TZ=Australia/Sydney npx jest --coverage","updateconfig": "run-s getcapabilities build:config","watch": "node ./tasks/watchclean.js && cross-env NODE_ENV=development webpack-dev-server",- "watch:debug": "node ./tasks/watchclean.js && cross-env DEBUG=true NODE_ENV=development webpack-dev-server",+ "watch:debug:logger": "node ./tasks/watchclean.js && cross-env DEBUG=logger NODE_ENV=development webpack-dev-server",+ "watch:debug:devtools": "node ./tasks/watchclean.js && cross-env DEBUG=devtools NODE_ENV=development webpack-dev-server","upload": "node tasks/upload.js"},"devDependencies": {diff --git a/web/js/combine-middleware.js b/web/js/combine-middleware.jsindex e647d4f04..b84768506 100644--- a/web/js/combine-middleware.js+++ b/web/js/combine-middleware.js@@ -5,11 +5,11 @@ import { createLogger } from 'redux-logger';const loggerMiddleware = createLogger({ collapsed: true });/*** Combine necessary middleware- * @param {Boolean} isDebugMode | Server is in debug mode+ * @param {Boolean} enableDebugLogger | Enable redux-logger* @param {Object} locationMiddleware | redux-location-state middleware*/-export default function getMiddleware(isDebugMode, locationMiddleware) {- return isDebugMode+export default function getMiddleware(enableDebugLogger, locationMiddleware) {+ return enableDebugLogger? compact([thunkMiddleware, locationMiddleware, loggerMiddleware]): compact([thunkMiddleware, locationMiddleware]);}diff --git a/web/js/main.js b/web/js/main.jsindex ae46d1dde..83857fd3f 100644--- a/web/js/main.js+++ b/web/js/main.js@@ -41,19 +41,19 @@ import { debugConfig } from './debug';import { CUSTOM_PALETTE_TYPE_ARRAY } from './modules/palettes/constants';const history = createBrowserHistory();--const isDebugMode = typeof DEBUG !== 'undefined';const configURI = Brand.url('config/wv.json');const startTime = new Date().getTime();-const compose = !isDebugMode ? defaultCompose : composeWithDevTools({- stateSanitizer: (state) => {- const sanitizedState = {- ...state,- };- delete sanitizedState.map;- return sanitizedState;- },-});+const compose = DEBUG === false || DEBUG === 'logger'+ ? defaultCompose+ : DEBUG === 'devtools' && composeWithDevTools({+ stateSanitizer: (state) => {+ const sanitizedState = {+ ...state,+ };+ delete sanitizedState.map;+ return sanitizedState;+ },+ });let parameters = util.fromQueryString(window.location.search);let { elapsed } = util;const errors = [];@@ -150,7 +150,7 @@ const render = (config, legacyState) => {reducers,stateToParams,);- const middleware = getMiddleware(isDebugMode, locationMiddleware);+ const middleware = getMiddleware(DEBUG === 'logger', locationMiddleware);const store = createStore(reducersWithLocation,getInitialState(models, config, parameters),diff --git a/webpack.config.js b/webpack.config.jsindex 83ff43c6a..6aa2afb26 100644--- a/webpack.config.js+++ b/webpack.config.js@@ -45,9 +45,13 @@ if (isDevServer) {if (process.env.ANALYZE_MODE === 'true') {pluginSystem.push(new BundleAnalyzerPlugin());}-if (process.env.DEBUG === 'true') {+if (process.env.DEBUG !== undefined) {pluginSystem.push(- new webpack.DefinePlugin({ DEBUG: JSON.stringify('true') }),+ new webpack.DefinePlugin({ DEBUG: JSON.stringify(process.env.DEBUG) }),+ );+} else {+ pluginSystem.push(+ new webpack.DefinePlugin({ DEBUG: false }),);}