@dword-design/base 10.0.5 → 10.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +17 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import endent from "@dword-design/functions/dist/endent.js";
|
|
2
|
+
import filter from "@dword-design/functions/dist/filter.js";
|
|
3
|
+
import flatMap from "@dword-design/functions/dist/flat-map.js";
|
|
2
4
|
import identity from "@dword-design/functions/dist/identity.js";
|
|
3
5
|
import mapValues from "@dword-design/functions/dist/map-values.js";
|
|
4
6
|
import jitiBabelTransform from '@dword-design/jiti-babel-transform';
|
|
@@ -40,6 +42,19 @@ import getGeneratedFiles from "./get-generated-files/index.js";
|
|
|
40
42
|
import getGitInfo from "./get-git-info/index.js";
|
|
41
43
|
const _require = createRequire(import.meta.url);
|
|
42
44
|
const babelConfig = _require('@dword-design/babel-config');
|
|
45
|
+
const mergeConfigs = (...configs) => {
|
|
46
|
+
var _result$eslintConfig, _result$eslintConfig$, _result$eslintConfig$2;
|
|
47
|
+
const result = deepmerge.all(configs, {
|
|
48
|
+
customMerge: key => key === 'supportedNodeVersions' ? (a, b) => b : undefined
|
|
49
|
+
});
|
|
50
|
+
if (((_result$eslintConfig = result.eslintConfig) === null || _result$eslintConfig === void 0 ? void 0 : (_result$eslintConfig$ = _result$eslintConfig.rules) === null || _result$eslintConfig$ === void 0 ? void 0 : (_result$eslintConfig$2 = _result$eslintConfig$['import/no-unresolved']) === null || _result$eslintConfig$2 === void 0 ? void 0 : _result$eslintConfig$2.length) > 0) {
|
|
51
|
+
var _ref, _result$eslintConfig$3;
|
|
52
|
+
result.eslintConfig.rules['import/no-unresolved'] = ['error', {
|
|
53
|
+
ignore: (_ref = (_result$eslintConfig$3 = result.eslintConfig.rules['import/no-unresolved'], filter(setting => typeof setting === 'object')(_result$eslintConfig$3)), flatMap(setting => setting.ignore)(_ref))
|
|
54
|
+
}];
|
|
55
|
+
}
|
|
56
|
+
return result;
|
|
57
|
+
};
|
|
43
58
|
class Base {
|
|
44
59
|
constructor(config) {
|
|
45
60
|
var _this$config$commands;
|
|
@@ -101,20 +116,17 @@ class Base {
|
|
|
101
116
|
syncKeywords: true,
|
|
102
117
|
windows: true
|
|
103
118
|
};
|
|
104
|
-
const mergeOptions = {
|
|
105
|
-
customMerge: key => key === 'supportedNodeVersions' ? (a, b) => b : undefined
|
|
106
|
-
};
|
|
107
119
|
const configsToMerge = [defaultConfig];
|
|
108
120
|
if (config.name) {
|
|
109
121
|
const inheritedConfigPath = config.name === this.packageConfig.name ? P.resolve('src', 'index.js') : config.name;
|
|
110
122
|
let inheritedConfig = inheritedConfigPath ? jitiInstance(inheritedConfigPath) : undefined;
|
|
111
123
|
if (typeof inheritedConfig === 'function') {
|
|
112
|
-
inheritedConfig = inheritedConfig(
|
|
124
|
+
inheritedConfig = inheritedConfig(mergeConfigs(defaultConfig, config));
|
|
113
125
|
}
|
|
114
126
|
configsToMerge.push(inheritedConfig);
|
|
115
127
|
}
|
|
116
128
|
configsToMerge.push(config);
|
|
117
|
-
this.config =
|
|
129
|
+
this.config = mergeConfigs(...configsToMerge);
|
|
118
130
|
this.config = {
|
|
119
131
|
...this.config,
|
|
120
132
|
commands: (_this$config$commands = this.config.commands, mapValues(command => typeof command === 'function' ? {
|