diff --git a/README.md b/README.md index a03c9462eb3ba0a884e85a3f5facb8de1830d000..839436bb0b9a1c8d69ce66bba6ba4bc39aec0fbb 100644 --- a/README.md +++ b/README.md @@ -55,19 +55,9 @@ This project builds on experience from previous solutions: ### Build automatically on file save: npm run watch - npm run watch-extra -### Build/watch mol-viewer -**Build** - - npm run build - npm run build-viewer - -**Watch** - - npm run watch - npm run watch-extra - npm run watch-viewer +### With debug mode enabled: + DEBUG=molstar npm run watch **Run** diff --git a/src/mol-plugin/context.ts b/src/mol-plugin/context.ts index 8826344ea6969826e0145138a8fe9c3a4cfe481d..245dcaad2e9e66467d674bc03d9786afe92c633e 100644 --- a/src/mol-plugin/context.ts +++ b/src/mol-plugin/context.ts @@ -34,6 +34,7 @@ import { StructureElementSelectionManager } from './util/structure-element-selec import { SubstructureParentHelper } from './util/substructure-parent-helper'; import { Representation } from 'mol-repr/representation'; import { ModifiersKeys } from 'mol-util/input/input-observer'; +import { isProductionMode, isDebugMode } from 'mol-util/debug'; export class PluginContext { private disposed = false; @@ -225,5 +226,7 @@ export class PluginContext { this.lociLabels = new LociLabelManager(this); this.log.message(`Mol* Plugin ${PLUGIN_VERSION} [${PLUGIN_VERSION_DATE.toLocaleString()}]`); + if (!isProductionMode) this.log.message(`Development mode enabled`); + if (isDebugMode) this.log.message(`Debug mode enabled`); } } \ No newline at end of file diff --git a/src/mol-util/debug.ts b/src/mol-util/debug.ts index 3f9334cd84030372556afd95b430113faf23fba3..5dc93664ac37fbb9825811dc1bd6e38e421d3d56 100644 --- a/src/mol-util/debug.ts +++ b/src/mol-util/debug.ts @@ -12,8 +12,8 @@ const isProductionMode = process.env.NODE_ENV === 'production' /** * set to true to enable more comprehensive checks and assertions, - * moslty used in `mol-gl` + * mostly used in `mol-gl` */ -const isDebugMode = false +const isDebugMode = process.env.DEBUG === '*' || process.env.DEBUG === 'molstar' export { isProductionMode, isDebugMode } \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index f3cf06a2970a8589f0a570f336987d8cbc0f0a67..90c91d820e6e4c329f4e8c77eed90565f13694ff 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -49,6 +49,8 @@ const sharedConfig = { }), new webpack.DefinePlugin({ __PLUGIN_VERSION_TIMESTAMP__: webpack.DefinePlugin.runtimeValue(() => `${new Date().valueOf()}`, true), + 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), + 'process.env.DEBUG': JSON.stringify(process.env.DEBUG) }), new MiniCssExtractPlugin({ filename: 'app.css' }) ],