@boopkit/cli 0.1.10 → 0.1.11
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/lib/capability.js +15 -3
- package/package.json +1 -1
package/dist/lib/capability.js
CHANGED
|
@@ -118,15 +118,27 @@ function findPackageDirByCapabilityName(name, searchPaths) {
|
|
|
118
118
|
function listCapabilities() {
|
|
119
119
|
const seen = new Set();
|
|
120
120
|
const capabilities = [];
|
|
121
|
+
// Collect @boopkit dirs to scan: both the CLI package's own node_modules
|
|
122
|
+
// and the current project's node_modules (when run from a boop project)
|
|
123
|
+
const boopkitDirs = [];
|
|
124
|
+
const cliBoopkit = path.join((0, config_1.getBoopRoot)(), 'node_modules', '@boopkit');
|
|
125
|
+
boopkitDirs.push(cliBoopkit);
|
|
126
|
+
const cwdBoopkit = path.join(process.cwd(), 'node_modules', '@boopkit');
|
|
127
|
+
if (cwdBoopkit !== cliBoopkit) {
|
|
128
|
+
boopkitDirs.push(cwdBoopkit);
|
|
129
|
+
}
|
|
121
130
|
// Scan node_modules/@boopkit/cap-* for packages with boopkit.capability === true
|
|
122
|
-
const nodeModulesBoopkit
|
|
123
|
-
|
|
131
|
+
for (const nodeModulesBoopkit of boopkitDirs) {
|
|
132
|
+
if (!fs.existsSync(nodeModulesBoopkit))
|
|
133
|
+
continue;
|
|
124
134
|
const entries = fs.readdirSync(nodeModulesBoopkit, { withFileTypes: true });
|
|
125
135
|
for (const entry of entries) {
|
|
126
136
|
if ((!entry.isDirectory() && !entry.isSymbolicLink()) || !entry.name.startsWith('cap-'))
|
|
127
137
|
continue;
|
|
128
138
|
const capName = entry.name.replace(/^cap-/, '');
|
|
129
|
-
|
|
139
|
+
if (seen.has(capName))
|
|
140
|
+
continue;
|
|
141
|
+
const cap = getCapabilityFromPackage(capName, [process.cwd()]);
|
|
130
142
|
if (cap) {
|
|
131
143
|
seen.add(capName);
|
|
132
144
|
capabilities.push(cap);
|