Skip to content

Commit ba12027

Browse files
authored
Merge pull request #5 from dolliejs/dev
feat: update apis
2 parents 2f3bdd3 + 6381313 commit ba12027

File tree

3 files changed

+13
-22
lines changed

3 files changed

+13
-22
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@dollie/cli",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"description": "CLI for Dollie.js",
55
"homepage": "https://github.com/dolliejs/dollie-cli#readme",
66
"author": {
@@ -52,7 +52,7 @@
5252
"node": ">= 10.0.0"
5353
},
5454
"dependencies": {
55-
"@dollie/core": "^2.1.0",
55+
"@dollie/core": "^2.2.0",
5656
"commander": "^7.0.0",
5757
"fs-extra": "^9.1.0",
5858
"lodash": "^4.17.21",

src/index.ts

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,19 @@ for (const constantKey of constantKeys) {
2727
program.option('-p, --plugins [plugin...]', 'specify an array of plugin file pathname');
2828

2929
program.action(async (...result) => {
30-
const props = result[0] || {} as DollieBaseAppConfig;
31-
const constants = Object.keys(_.omit(props, ['plugins'])).reduce((result, currentKey) => {
32-
const currentSnakeKey = parseCamelToSnake(currentKey);
33-
const currentValue = (props[0] || {})[currentKey];
34-
if (currentSnakeKey && currentValue !== undefined) {
35-
const snakeKey = currentSnakeKey.toUpperCase() as keyof ExportedConstants;
36-
if (snakeKey === 'SCAFFOLD_TIMEOUT') {
37-
result[snakeKey] = parseInt(currentValue, 10) || 10000;
38-
} else {
39-
result[snakeKey] = currentValue;
40-
}
41-
}
42-
return result;
43-
}, {}) as ExportedConstants;
30+
const rawProps = (result[0] || {});
31+
const props = _.omit(rawProps, ['plugins']) as Partial<DollieBaseAppConfig>;
32+
if (props.scaffoldTimeout !== undefined) {
33+
props.scaffoldTimeout = parseInt(rawProps.scaffoldTimeout, 10);
34+
}
4435
try {
45-
const pluginPaths = (_.isArray(props.plugins) ? props.plugins : []) as Array<string>;
36+
const pluginPaths = (_.isArray(rawProps.plugins) ? rawProps.plugins : []) as Array<string>;
4637
const plugins = pluginPaths.map((pluginPath) => ({
4738
pathname: pluginPath,
4839
executor: require(path.resolve(pluginPath)),
4940
})) as Array<Plugin>;
5041
await dollie.interactive({
51-
constants,
42+
...props,
5243
plugins,
5344
});
5445
} catch (e) {

0 commit comments

Comments
 (0)