From 689a75b381e6fe4fc0e9b969bd5ae38f0adc1276 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Wed, 10 Feb 2021 03:04:28 -0500 Subject: [PATCH] plugins: Pass `--no-production` instead of setting `NODE_ENV=development` --- src/static/js/pluginfw/plugins.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/static/js/pluginfw/plugins.js b/src/static/js/pluginfw/plugins.js index 4cf01fa2f..a65b4f08e 100644 --- a/src/static/js/pluginfw/plugins.js +++ b/src/static/js/pluginfw/plugins.js @@ -73,14 +73,13 @@ exports.update = async () => { exports.getPackages = async () => { logger.info('Running npm to get a list of installed plugins...'); - // Note: Do not pass `--prod` because it does not work if there is no package.json. - const np = runNpm(['ls', '--long', '--json', '--depth=0'], { + // Notes: + // * Do not pass `--prod` otherwise `npm ls` will fail if there is no `package.json`. + // * The `--no-production` flag is required (or the `NODE_ENV` environment variable must be + // unset or set to `development`) because otherwise `npm ls` will not mention any packages + // that are not included in `package.json` (which is expected to not exist). + const np = runNpm(['ls', '--long', '--json', '--depth=0', '--no-production'], { stdoutLogger: null, // We want to capture stdout, so don't attempt to log it. - env: { - ...process.env, - // NODE_ENV must be set to development for `npm ls` to show files without a package.json. - NODE_ENV: 'development', - }, }); const chunks = []; await Promise.all([