@fluid-app/fluid-cli 0.1.727 → 0.1.728
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/bin/fluid.mjs +37 -7
- package/dist/bin/fluid.mjs.map +1 -1
- package/dist/client-DR4F01_p.mjs +2 -0
- package/dist/{hook-BOhhK8ae.mjs → hook-9lViaRU7.mjs} +4 -4
- package/dist/{hook-BOhhK8ae.mjs.map → hook-9lViaRU7.mjs.map} +1 -1
- package/dist/index.mjs +3 -3
- package/dist/{profiles-CpG6O9Zi.mjs → profiles-CUTsnD_9.mjs} +126 -126
- package/dist/profiles-CUTsnD_9.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/client-DU__lstz.mjs +0 -2
- package/dist/profiles-CpG6O9Zi.mjs.map +0 -1
package/dist/bin/fluid.mjs
CHANGED
|
@@ -1,18 +1,42 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as walkCommands, A as pollAgentAccess, D as fetchUserCompanies, E as confirmMfa, F as validateToken, M as sendMfa, N as signup, O as getFluidApiBase, P as switchCompany, Q as visibleSubcommands, S as resolveCredentialSource, X as rootCommand, Y as filterCatalog, Z as visibleOptions, _ as getAuthToken, c as inputsModeActive, g as getActiveProfile, j as redeemIdentityLink, k as isInsecureRemoteBase, l as registerInputsHook, s as exitOnInputsError, u as createInputsReader, w as FLUID_API_ERROR, x as readFdToken } from "../hook-
|
|
3
|
-
import { A as isClientProfile, C as
|
|
2
|
+
import { $ as walkCommands, A as pollAgentAccess, D as fetchUserCompanies, E as confirmMfa, F as validateToken, M as sendMfa, N as signup, O as getFluidApiBase, P as switchCompany, Q as visibleSubcommands, S as resolveCredentialSource, X as rootCommand, Y as filterCatalog, Z as visibleOptions, _ as getAuthToken, c as inputsModeActive, g as getActiveProfile, j as redeemIdentityLink, k as isInsecureRemoteBase, l as registerInputsHook, s as exitOnInputsError, u as createInputsReader, w as FLUID_API_ERROR, x as readFdToken } from "../hook-9lViaRU7.mjs";
|
|
3
|
+
import { A as isClientProfile, C as readStoredConfig, D as getConfigDir, E as isStrictConfig, S as readConfig, T as writeConfig, _ as primeClientProfile, c as sessionFacts, j as isIdentityProfile, l as signInWithBrowser, n as describeIdentityError, o as primeIdentityProfile, p as clientAccessToken, r as identityToken, t as endUnusedSessions, u as signOutIdentity, w as updateConfig, y as resolveIdentityUrl } from "../profiles-CUTsnD_9.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
7
|
import { Argument, Command, Option } from "commander";
|
|
8
|
+
import { dirname, isAbsolute, join, relative, sep } from "node:path";
|
|
9
|
+
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
10
|
+
import { tmpdir } from "node:os";
|
|
8
11
|
import { text } from "node:stream/consumers";
|
|
9
12
|
import chalk from "chalk";
|
|
10
13
|
import prompts from "prompts";
|
|
11
14
|
import ora from "ora";
|
|
12
|
-
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
13
|
-
import { dirname, isAbsolute, join, relative, sep } from "node:path";
|
|
14
|
-
import { tmpdir } from "node:os";
|
|
15
15
|
import { spawn } from "node:child_process";
|
|
16
|
+
//#region src/plugins/missing-plugin.ts
|
|
17
|
+
const SITES_PLUGIN = "@fluid-app/fluid-cli-member-site";
|
|
18
|
+
/** The Sites plugin's top-level commands: core can't ask an unloaded plugin. */
|
|
19
|
+
const SITES_COMMANDS = new Set([
|
|
20
|
+
"sites",
|
|
21
|
+
"deploy",
|
|
22
|
+
"member-site",
|
|
23
|
+
"vault"
|
|
24
|
+
]);
|
|
25
|
+
/**
|
|
26
|
+
* Why `fluid <name>` (or `fluid help <name>`) is missing when the Sites plugin
|
|
27
|
+
* adds it and no loaded plugin did, since commander's "unknown command" reads
|
|
28
|
+
* as if Fluid has no Sites. When `enabledPlugins` leaves the plugin out, an
|
|
29
|
+
* install changes nothing, so the hint says to add it there. Null otherwise.
|
|
30
|
+
*/
|
|
31
|
+
function missingPluginHint(program, args, enabledPlugins) {
|
|
32
|
+
const name = args[0] === "help" ? args[1] : args[0];
|
|
33
|
+
if (name === void 0 || !SITES_COMMANDS.has(name)) return null;
|
|
34
|
+
if (program.commands.some((command) => command.name() === name || command.aliases().includes(name))) return null;
|
|
35
|
+
const allowList = enabledPlugins === void 0 ? readConfig().enabledPlugins : enabledPlugins;
|
|
36
|
+
const install = `npm install -g ${SITES_PLUGIN}`;
|
|
37
|
+
return `fluid ${name} comes from the Sites plugin, ${allowList !== null && !allowList.includes(SITES_PLUGIN) ? `which enabledPlugins in your Fluid config leaves out. Add ${SITES_PLUGIN} to it, and install the plugin if it isn't installed: ${install}` : `which is not loaded. Install or update it: ${install}`}`;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
16
40
|
//#region src/commands/commands.ts
|
|
17
41
|
/**
|
|
18
42
|
* fluid commands — list every installed command, or print the catalog as
|
|
@@ -39,7 +63,11 @@ const commandsCommand = new Command("commands").description("List installed comm
|
|
|
39
63
|
const root = rootCommand(command);
|
|
40
64
|
const entries = filterCatalog(walkCommands(root), root, prefix);
|
|
41
65
|
if (entries.length === 0) {
|
|
42
|
-
|
|
66
|
+
const hint = missingPluginHint(root, prefix);
|
|
67
|
+
process.stderr.write(JSON.stringify({
|
|
68
|
+
error: `No command named "${prefix.join(" ")}".`,
|
|
69
|
+
...hint ? { hint } : {}
|
|
70
|
+
}) + "\n");
|
|
43
71
|
process.exitCode = 1;
|
|
44
72
|
return;
|
|
45
73
|
}
|
|
@@ -1027,7 +1055,7 @@ const defaultSignupDeps = {
|
|
|
1027
1055
|
isInteractive: () => Boolean(process.stdin.isTTY),
|
|
1028
1056
|
agent: {
|
|
1029
1057
|
poll: pollAgentAccess,
|
|
1030
|
-
saveProfile: async (name, input, options) => (await import("../client-
|
|
1058
|
+
saveProfile: async (name, input, options) => (await import("../client-DR4F01_p.mjs")).saveClientProfile(name, input, options),
|
|
1031
1059
|
strictConfig: isStrictConfig,
|
|
1032
1060
|
stashRecovery: writeRecoveryFile,
|
|
1033
1061
|
stderrIsTty: () => Boolean(process.stderr.isTTY),
|
|
@@ -2334,6 +2362,8 @@ if (!inputsModeActive(process.env)) startUpdateCheck({
|
|
|
2334
2362
|
versions: process.versions
|
|
2335
2363
|
});
|
|
2336
2364
|
await loadPlugins(program, packageRoot);
|
|
2365
|
+
const missingPlugin = missingPluginHint(program, process.argv.slice(2));
|
|
2366
|
+
if (missingPlugin) program.error(missingPlugin, { exitCode: 1 });
|
|
2337
2367
|
try {
|
|
2338
2368
|
await program.parseAsync(process.argv, { from: "node" });
|
|
2339
2369
|
} catch (error) {
|