@dword-design/base 9.4.60 → 9.5.0
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/cli.js +4 -3
- package/dist/index.js +11 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -59,9 +59,10 @@ const run = async () => {
|
|
|
59
59
|
name: '-u, --update-snapshots'
|
|
60
60
|
}]
|
|
61
61
|
},
|
|
62
|
-
...(_base$config$commands = base.config.commands, mapValues(command =>
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
...(_base$config$commands = base.config.commands, mapValues((command, name) => ({
|
|
63
|
+
...command,
|
|
64
|
+
handler: (...args) => base.run(name, ...args)
|
|
65
|
+
}))(_base$config$commands))
|
|
65
66
|
}, mapValues((command, name) => ({
|
|
66
67
|
name,
|
|
67
68
|
...command
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import babelConfig from '@dword-design/babel-config';
|
|
2
2
|
import endent from "@dword-design/functions/dist/endent.js";
|
|
3
3
|
import identity from "@dword-design/functions/dist/identity.js";
|
|
4
|
+
import mapValues from "@dword-design/functions/dist/map-values.js";
|
|
4
5
|
import deepmerge from 'deepmerge';
|
|
5
6
|
import depcheck from 'depcheck';
|
|
6
7
|
import depcheckDetectorExeca from 'depcheck-detector-execa';
|
|
@@ -38,6 +39,7 @@ import getGeneratedFiles from "./get-generated-files/index.js";
|
|
|
38
39
|
import getGitInfo from "./get-git-info/index.js";
|
|
39
40
|
class Base {
|
|
40
41
|
constructor(config) {
|
|
42
|
+
var _this$config$commands;
|
|
41
43
|
const jitiInstance = jiti(process.cwd(), {
|
|
42
44
|
esmResolve: true,
|
|
43
45
|
interopDefault: true,
|
|
@@ -108,9 +110,18 @@ class Base {
|
|
|
108
110
|
}
|
|
109
111
|
configsToMerge.push(config);
|
|
110
112
|
this.config = deepmerge.all(configsToMerge, mergeOptions);
|
|
113
|
+
this.config = {
|
|
114
|
+
...this.config,
|
|
115
|
+
commands: (_this$config$commands = this.config.commands, mapValues(command => typeof command === 'function' ? {
|
|
116
|
+
handler: command
|
|
117
|
+
} : command)(_this$config$commands))
|
|
118
|
+
};
|
|
111
119
|
this.packageConfig = this.getPackageConfig();
|
|
112
120
|
this.generatedFiles = this.getGeneratedFiles();
|
|
113
121
|
}
|
|
122
|
+
run(name, ...args) {
|
|
123
|
+
return this.config.commands[name].handler.call(this, ...args);
|
|
124
|
+
}
|
|
114
125
|
}
|
|
115
126
|
Object.assign(Base.prototype, {
|
|
116
127
|
checkUnknownFiles,
|