@lsst/pik 0.8.1 → 0.9.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/lib/program.d.ts.map +1 -1
- package/dist/lib/program.js +12 -6
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/lib/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,OAAO,
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/lib/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,gBAAgB,CAAC;AA4DxB,eAAO,MAAM,OAAO,SAGG,CAAC;AA0CxB;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAsE9D"}
|
package/dist/lib/program.js
CHANGED
|
@@ -3,7 +3,7 @@ import { select, Separator } from '@inquirer/prompts';
|
|
|
3
3
|
import pc from 'picocolors';
|
|
4
4
|
import { writeFileSync } from 'fs';
|
|
5
5
|
import { resolve } from 'path';
|
|
6
|
-
import { loadConfig, findLocalConfig, isValidPlugin, } from '@lsst/pik-core';
|
|
6
|
+
import { loadConfig, findLocalConfig, loadGlobalConfig, isValidPlugin, } from '@lsst/pik-core';
|
|
7
7
|
import { selectPlugin } from '@lsst/pik-plugin-select';
|
|
8
8
|
import { worktreePlugin } from '@lsst/pik-plugin-worktree';
|
|
9
9
|
import { killportPlugin } from './plugins/killport.js';
|
|
@@ -20,19 +20,25 @@ const builtinPlugins = [
|
|
|
20
20
|
*/
|
|
21
21
|
async function getEnabledPlugins() {
|
|
22
22
|
const config = await loadConfig();
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
// A global config with registered projects makes the select plugin usable from
|
|
24
|
+
// any directory, even with no local pik config present.
|
|
25
|
+
const globalConfig = await loadGlobalConfig();
|
|
26
|
+
const hasGlobalSelectors = Boolean(globalConfig?.projects?.length);
|
|
27
|
+
if (!config && !hasGlobalSelectors) {
|
|
28
|
+
// No local config and nothing exposed globally - no plugins enabled
|
|
25
29
|
return [];
|
|
26
30
|
}
|
|
27
31
|
const enabledPlugins = [];
|
|
28
|
-
// Add built-in plugins that have config keys
|
|
32
|
+
// Add built-in plugins that have config keys (or, for select, are reachable globally)
|
|
29
33
|
for (const plugin of builtinPlugins) {
|
|
30
|
-
|
|
34
|
+
const enabledLocally = config ? plugin.command in config : false;
|
|
35
|
+
const enabledGlobally = plugin.command === selectPlugin.command && hasGlobalSelectors;
|
|
36
|
+
if (enabledLocally || enabledGlobally) {
|
|
31
37
|
enabledPlugins.push(plugin);
|
|
32
38
|
}
|
|
33
39
|
}
|
|
34
40
|
// Add external plugins from config
|
|
35
|
-
if (config
|
|
41
|
+
if (config?.plugins && Array.isArray(config.plugins)) {
|
|
36
42
|
for (const plugin of config.plugins) {
|
|
37
43
|
if (isValidPlugin(plugin)) {
|
|
38
44
|
enabledPlugins.push(plugin);
|
package/package.json
CHANGED