From f58130435b58c8766e86f04c6f24f65ad3bf7085 Mon Sep 17 00:00:00 2001 From: Branden Cash Date: Thu, 15 Mar 2018 09:49:39 -0700 Subject: [PATCH] support for vendor prefixed nwb plugins --- .gitignore | 1 + src/config/plugin.js | 2 +- tests/config-test.js | 4 ++++ .../plugins/node_modules/@vendor/nwb-testplugin/index.js | 8 ++++++++ .../node_modules/@vendor/nwb-testplugin/package.json | 3 +++ tests/fixtures/plugins/package.json | 3 ++- 6 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 tests/fixtures/plugins/node_modules/@vendor/nwb-testplugin/index.js create mode 100644 tests/fixtures/plugins/node_modules/@vendor/nwb-testplugin/package.json diff --git a/.gitignore b/.gitignore index 7b695bdd..d6a328a1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ /coverage /lib /node_modules +/.idea npm-debug.log* package-lock.json diff --git a/src/config/plugin.js b/src/config/plugin.js index a40f21c0..00cf56bb 100644 --- a/src/config/plugin.js +++ b/src/config/plugin.js @@ -11,7 +11,7 @@ function getPackagePlugins(cwd) { return [ ...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.devDependencies || {}), - ].filter(dep => /^nwb-/.test(dep)) + ].filter(dep => /^nwb-/.test(dep) || /^@[^/]+\/nwb-/.test(dep)) } /** diff --git a/tests/config-test.js b/tests/config-test.js index 9bd37f08..169c161c 100644 --- a/tests/config-test.js +++ b/tests/config-test.js @@ -317,6 +317,10 @@ describe('getPluginConfig()', () => { fake: { loader: 'path/to/fake.js', test: /\.fake$/, + }, + fakeVendor: { + loader: 'path/to/fake.js', + test: /\.fake$/, } } }) diff --git a/tests/fixtures/plugins/node_modules/@vendor/nwb-testplugin/index.js b/tests/fixtures/plugins/node_modules/@vendor/nwb-testplugin/index.js new file mode 100644 index 00000000..9cbdf741 --- /dev/null +++ b/tests/fixtures/plugins/node_modules/@vendor/nwb-testplugin/index.js @@ -0,0 +1,8 @@ +module.exports = { + cssPreprocessors: { + fakeVendor: { + test: /\.fake$/, + loader: 'path/to/fake.js' + } + } +} diff --git a/tests/fixtures/plugins/node_modules/@vendor/nwb-testplugin/package.json b/tests/fixtures/plugins/node_modules/@vendor/nwb-testplugin/package.json new file mode 100644 index 00000000..14ab704d --- /dev/null +++ b/tests/fixtures/plugins/node_modules/@vendor/nwb-testplugin/package.json @@ -0,0 +1,3 @@ +{ + "main": "index.js" +} diff --git a/tests/fixtures/plugins/package.json b/tests/fixtures/plugins/package.json index 59395f95..b6fd3814 100644 --- a/tests/fixtures/plugins/package.json +++ b/tests/fixtures/plugins/package.json @@ -1,5 +1,6 @@ { "devDependencies": { - "nwb-testplugin": "*" + "nwb-testplugin": "*", + "@vendor/nwb-testplugin": "*" } }