Skip to content

Commit

Permalink
fix(npm-scripts): temporary work around for grabbing rules config at …
Browse files Browse the repository at this point in the history
…both the root and module level
  • Loading branch information
bryceosterhaus committed Jan 18, 2023
1 parent a6ad830 commit 92591ce
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,26 @@
* SPDX-License-Identifier: BSD-3-Clause
*/

const getUserConfig = require('./getUserConfig');
const path = require('path');

const findRoot = require('./findRoot');

function collectDefinedDependencies() {
const rootConfig = getUserConfig('npmscripts');
const rootDir = findRoot();

let rootConfig = {};

if (!rootDir) {
return new Set();
}

try {
/* eslint-disable-next-line @liferay/no-dynamic-require */
rootConfig = require(path.join(rootDir, 'npmscripts.config'));
}
catch (error) {
return new Set();
}

const amdImports = new Set(
Object.entries(rootConfig.build.bundler.config.imports).reduce(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ function getMergedConfig(type, property) {
mergedConfig = deepMerge(
[
require('../config/npmscripts.config'),

// Temporary workaround until we re-evaluate global key

{rules: rootConfig.global?.rules || {}},
rootConfig,
getUserConfig('npmscripts'),
],
Expand Down

0 comments on commit 92591ce

Please sign in to comment.