Skip to content

Commit

Permalink
fix(options): fix CLI options
Browse files Browse the repository at this point in the history
  • Loading branch information
nfroidure committed May 26, 2022
1 parent 03b480e commit 6f5fc2f
Show file tree
Hide file tree
Showing 4 changed files with 194 additions and 105 deletions.
155 changes: 123 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,17 @@
},
"homepage": "https://github.com/nfroidure/metapak#readme",
"dependencies": {
"bluebird": "^3.7.2",
"chalk": "^4.1.0",
"commander": "^7.2.0",
"commander": "^9.2.0",
"debug": "^4.3.4",
"deep-strict-equal": "^0.2.0",
"diff": "^5.1.0",
"glob": "^7.1.6",
"knifecycle": "^12.0.2",
"glob": "^8.0.3",
"knifecycle": "^12.0.4",
"mkdirp": "^1.0.4",
"pkg-dir": "^5.0.0",
"sort-keys": "^4.2.0",
"yerror": "^6.0.1"
"yerror": "^6.0.2"
},
"devDependencies": {
"commitizen": "^4.2.4",
Expand All @@ -73,7 +72,7 @@
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.16.0",
"eslint-plugin-prettier": "^4.0.0",
"metapak-nfroidure": "11.2.0",
"metapak-nfroidure": "11.2.1",
"mocha": "^10.0.0",
"nyc": "^15.1.0",
"prettier": "^2.6.2",
Expand Down
57 changes: 30 additions & 27 deletions src/metapak.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const path = require('path');
const Promise = require('bluebird');
const YError = require('yerror').default;
const { autoService } = require('knifecycle');

Expand Down Expand Up @@ -185,40 +184,44 @@ function _reorderMetapakModulesNames(
return metapakModulesNames;
}

function _getPackageMetapakModulesConfigs(
async function _getPackageMetapakModulesConfigs(
{ fs, log },
metapakModulesSequence,
metapackConfigsSequence,
resolveModule,
packageConf
) {
return Promise.props(
metapakModulesSequence.reduce(
(metapakModulesConfigs, metapakModuleName) => {
const modulePath = path.join(
resolveModule(metapakModuleName, packageConf),
'src'
);
const allModulesConfigs = metapakModulesSequence.reduce(
(metapakModulesConfigs, metapakModuleName) => {
const modulePath = path.join(
resolveModule(metapakModuleName, packageConf),
'src'
);

metapakModulesConfigs[metapakModuleName] = fs
.readdirAsync(modulePath)
.then((metapakModuleConfigs) => {
metapakModuleConfigs = metapackConfigsSequence.filter(
(metapakModuleConfig) =>
metapakModuleConfigs.includes(metapakModuleConfig)
);
log(
'debug',
'Found configs for "' + metapakModuleName + '":',
metapakModuleConfigs
);
return metapakModuleConfigs;
});
return metapakModulesConfigs;
},
{}
)
metapakModulesConfigs[metapakModuleName] = fs
.readdirAsync(modulePath)
.then((metapakModuleConfigs) => {
metapakModuleConfigs = metapackConfigsSequence.filter(
(metapakModuleConfig) =>
metapakModuleConfigs.includes(metapakModuleConfig)
);
log(
'debug',
'Found configs for "' + metapakModuleName + '":',
metapakModuleConfigs
);
return metapakModuleConfigs;
});
return metapakModulesConfigs;
},
{}
);
return await Object.keys(allModulesConfigs).reduce(async (p, key) => {
return {
...(await p),
[key]: await allModulesConfigs[key],
};
}, Promise.resolve({}));
}

function _awaitPromisesFullfil(promises) {
Expand Down
Loading

0 comments on commit 6f5fc2f

Please sign in to comment.