@ethereal-nexus/cli 1.0.2 → 1.2.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/index.js +208 -14
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// bin/index.ts
|
|
4
|
-
import { Command as
|
|
4
|
+
import { Command as Command4 } from "commander";
|
|
5
5
|
|
|
6
6
|
// src/commands/publish.ts
|
|
7
7
|
import path3 from "path";
|
|
@@ -48,13 +48,16 @@ function handleError(error) {
|
|
|
48
48
|
import path from "path";
|
|
49
49
|
import { cosmiconfig } from "cosmiconfig";
|
|
50
50
|
import { z } from "zod";
|
|
51
|
+
import { promises as fs } from "fs";
|
|
51
52
|
var DEFAULT_PATH = "./dist/.ethereal";
|
|
52
53
|
var explorer = cosmiconfig("ethereal");
|
|
53
54
|
var configSchema = z.object({
|
|
54
55
|
$schema: z.string().optional(),
|
|
55
56
|
url: z.string(),
|
|
56
|
-
auth: z.string(),
|
|
57
|
-
|
|
57
|
+
auth: z.string().optional(),
|
|
58
|
+
token: z.string().optional(),
|
|
59
|
+
path: z.string().optional(),
|
|
60
|
+
authType: z.enum(["keycloak"]).optional()
|
|
58
61
|
}).strict();
|
|
59
62
|
async function getRawConfig(cwd) {
|
|
60
63
|
try {
|
|
@@ -64,6 +67,7 @@ async function getRawConfig(cwd) {
|
|
|
64
67
|
}
|
|
65
68
|
return configSchema.parse(configResult.config);
|
|
66
69
|
} catch (error) {
|
|
70
|
+
console.error(error.message);
|
|
67
71
|
throw new Error(`Invalid configuration found in ${cwd}/components.json.`);
|
|
68
72
|
}
|
|
69
73
|
}
|
|
@@ -82,9 +86,15 @@ async function getConfig() {
|
|
|
82
86
|
}
|
|
83
87
|
return await resolveConfigPaths(cwd, config2);
|
|
84
88
|
}
|
|
89
|
+
async function saveConfig(config2) {
|
|
90
|
+
const cwd = path.resolve(process.cwd());
|
|
91
|
+
const targetPath = path.resolve(cwd, ".etherealrc");
|
|
92
|
+
await fs.writeFile(targetPath, JSON.stringify(config2, null, 2), "utf8");
|
|
93
|
+
return config2;
|
|
94
|
+
}
|
|
85
95
|
|
|
86
96
|
// src/utils/get-tar-exclude-list.ts
|
|
87
|
-
import
|
|
97
|
+
import fs2 from "node:fs";
|
|
88
98
|
var ignoreCommonFiles = [
|
|
89
99
|
"package.json",
|
|
90
100
|
"package-lock.json",
|
|
@@ -94,7 +104,7 @@ var ignoreCommonFiles = [
|
|
|
94
104
|
".DS_Store"
|
|
95
105
|
];
|
|
96
106
|
function getTarExcludeList(excludedPaths = []) {
|
|
97
|
-
const gitignore =
|
|
107
|
+
const gitignore = fs2.existsSync(".gitignore") ? fs2.readFileSync(".gitignore", "utf-8") : "";
|
|
98
108
|
const gitignoreFiles = gitignore?.split("\n")?.filter((file) => !file?.includes("#") && file?.trim() !== "");
|
|
99
109
|
return [
|
|
100
110
|
...gitignoreFiles,
|
|
@@ -135,13 +145,21 @@ import ora from "ora";
|
|
|
135
145
|
|
|
136
146
|
// src/lib/services/nexus.ts
|
|
137
147
|
import wretch from "wretch";
|
|
138
|
-
import
|
|
148
|
+
import fs3 from "node:fs";
|
|
139
149
|
import path2 from "path";
|
|
140
150
|
var config = await getConfig();
|
|
141
|
-
var nexusApi = wretch(config?.url)
|
|
151
|
+
var nexusApi = wretch(config?.url);
|
|
152
|
+
if (config?.authType === "keycloak" && config?.token) {
|
|
153
|
+
const isHttps = config?.url?.startsWith("https://");
|
|
154
|
+
const cookieName = isHttps ? "__Secure-authjs.session-token" : "authjs.session-token";
|
|
155
|
+
nexusApi = nexusApi.headers({
|
|
156
|
+
"Cookie": `${cookieName}=${config.token}; Secure; HttpOnly; SameSite=Strict`
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
nexusApi = nexusApi.auth(`apikey ${config?.auth}`);
|
|
142
160
|
var publish = async (filePath) => {
|
|
143
161
|
const form = new FormData();
|
|
144
|
-
const buffer =
|
|
162
|
+
const buffer = fs3.readFileSync(filePath);
|
|
145
163
|
const blob = new Blob([buffer]);
|
|
146
164
|
const fileName = path2.basename(filePath);
|
|
147
165
|
form.append("file", blob, fileName);
|
|
@@ -235,7 +253,7 @@ var publish2 = new Command().name("publish").description("publish a component to
|
|
|
235
253
|
});
|
|
236
254
|
|
|
237
255
|
// src/commands/init.ts
|
|
238
|
-
import { existsSync as existsSync2, promises as
|
|
256
|
+
import { existsSync as existsSync2, promises as fs4 } from "fs";
|
|
239
257
|
import { Command as Command2 } from "commander";
|
|
240
258
|
import chalk3 from "chalk";
|
|
241
259
|
import ora2 from "ora";
|
|
@@ -305,13 +323,13 @@ async function promptForConfig(cwd, skip) {
|
|
|
305
323
|
logger.info("");
|
|
306
324
|
const spinner = ora2(`Writing .etherealrc...`).start();
|
|
307
325
|
const targetPath = resolve(cwd, ".etherealrc");
|
|
308
|
-
await
|
|
326
|
+
await fs4.writeFile(targetPath, JSON.stringify(config2, null, 2), "utf8");
|
|
309
327
|
spinner.succeed();
|
|
310
328
|
}
|
|
311
329
|
|
|
312
330
|
// src/utils/get-package-info.ts
|
|
313
331
|
import path4 from "path";
|
|
314
|
-
import
|
|
332
|
+
import fs5 from "fs-extra";
|
|
315
333
|
|
|
316
334
|
// src/utils/dirname.ts
|
|
317
335
|
import { dirname } from "path";
|
|
@@ -321,20 +339,196 @@ var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
321
339
|
// src/utils/get-package-info.ts
|
|
322
340
|
function getPackageInfo() {
|
|
323
341
|
const packageJsonPath = path4.join(__dirname, "../package.json");
|
|
324
|
-
return
|
|
342
|
+
return fs5.readJSONSync(packageJsonPath);
|
|
325
343
|
}
|
|
326
344
|
|
|
345
|
+
// src/commands/auth.ts
|
|
346
|
+
import { Command as Command3 } from "commander";
|
|
347
|
+
import open from "open";
|
|
348
|
+
import ora3 from "ora";
|
|
349
|
+
import chalk4 from "chalk";
|
|
350
|
+
import http from "http";
|
|
351
|
+
import { URL } from "url";
|
|
352
|
+
import inquirer2 from "inquirer";
|
|
353
|
+
var authLogin = new Command3().name("auth").description("Ethereal Nexus authentication command.").argument("login", "to login").option("--port <port>", "Port to use for the callback server", "3000").action(async (_, options) => {
|
|
354
|
+
try {
|
|
355
|
+
const config2 = await getConfig();
|
|
356
|
+
if (!config2) {
|
|
357
|
+
logger.error("No configuration found. Please run `ethereal init` first.");
|
|
358
|
+
process.exit(1);
|
|
359
|
+
}
|
|
360
|
+
if (!config2.url) {
|
|
361
|
+
logger.error("No authentication URL found in configuration.");
|
|
362
|
+
process.exit(1);
|
|
363
|
+
}
|
|
364
|
+
if (!config2.authType || config2.authType !== "keycloak") {
|
|
365
|
+
logger.error('Authentication type must be set to "keycloak" in .etherealrc');
|
|
366
|
+
process.exit(1);
|
|
367
|
+
}
|
|
368
|
+
logger.info(`Starting Keycloak login flow...`);
|
|
369
|
+
const baseUrl = config2.url;
|
|
370
|
+
logger.info(`Using Keycloak server: ${baseUrl}`);
|
|
371
|
+
const server = http.createServer();
|
|
372
|
+
const port = parseInt(options.port);
|
|
373
|
+
try {
|
|
374
|
+
server.listen(port);
|
|
375
|
+
logger.info(`Using port ${port} for callback server`);
|
|
376
|
+
} catch (error) {
|
|
377
|
+
logger.error(`Failed to bind to port ${port}. It might be in use by another application.`);
|
|
378
|
+
process.exit(1);
|
|
379
|
+
}
|
|
380
|
+
server.on("error", (error) => {
|
|
381
|
+
if (error.code === "EADDRINUSE") {
|
|
382
|
+
logger.error(`Port ${port} is already in use. Please specify a different port with --port option.`);
|
|
383
|
+
process.exit(1);
|
|
384
|
+
} else {
|
|
385
|
+
logger.error(`Server error: ${error.message}`);
|
|
386
|
+
process.exit(1);
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
const tokenPromise = new Promise((resolve2, reject) => {
|
|
390
|
+
const timeout = setTimeout(() => {
|
|
391
|
+
server.close();
|
|
392
|
+
reject(new Error("Authentication timed out"));
|
|
393
|
+
}, 5 * 60 * 1e3);
|
|
394
|
+
server.on("request", async (req, res) => {
|
|
395
|
+
try {
|
|
396
|
+
const url = new URL(req.url || "", `http://localhost:${port}`);
|
|
397
|
+
const token = url.searchParams.get("token");
|
|
398
|
+
if (token) {
|
|
399
|
+
res.writeHead(200, { "Content-Type": "text/plain" });
|
|
400
|
+
res.end("Ethereal Nexus CLI Authentication successful! You can close this window.");
|
|
401
|
+
clearTimeout(timeout);
|
|
402
|
+
resolve2({ access_token: token });
|
|
403
|
+
server.close();
|
|
404
|
+
}
|
|
405
|
+
} catch (error) {
|
|
406
|
+
reject(error);
|
|
407
|
+
server.close();
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
});
|
|
411
|
+
const authUrlBase = baseUrl.endsWith(`/api/v1/cli-auth?callback=http://localhost:${port}`) ? baseUrl : `${baseUrl}/api/v1/cli-auth?callback=http://localhost:${port}`;
|
|
412
|
+
const authUrl = new URL(authUrlBase);
|
|
413
|
+
logger.info(`Opening browser to authenticate...`);
|
|
414
|
+
logger.info(`If the browser doesn't open automatically, please visit:`);
|
|
415
|
+
logger.info(chalk4.cyan(authUrl.toString()));
|
|
416
|
+
await open(authUrl.toString());
|
|
417
|
+
logger.info(`Waiting for authentication...`);
|
|
418
|
+
try {
|
|
419
|
+
const { access_token } = await tokenPromise;
|
|
420
|
+
const spinner = ora3("Saving authentication tokens...").start();
|
|
421
|
+
await saveConfig({
|
|
422
|
+
...config2,
|
|
423
|
+
token: access_token
|
|
424
|
+
});
|
|
425
|
+
spinner.succeed();
|
|
426
|
+
logger.info(chalk4.green("Authentication successful!"));
|
|
427
|
+
} catch (error) {
|
|
428
|
+
logger.error("Authentication failed:", error);
|
|
429
|
+
process.exit(1);
|
|
430
|
+
}
|
|
431
|
+
} catch (error) {
|
|
432
|
+
handleError(error);
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
var authLogout = new Command3().name("auth logout").description("Ethereal Nexus authentication command.").argument("logout", "to logout").action(async () => {
|
|
436
|
+
try {
|
|
437
|
+
const config2 = await getConfig();
|
|
438
|
+
if (!config2) {
|
|
439
|
+
logger.error("No configuration found. Please run `ethereal init` first.");
|
|
440
|
+
process.exit(1);
|
|
441
|
+
}
|
|
442
|
+
if (!config2.auth) {
|
|
443
|
+
logger.info("You are not currently logged in.");
|
|
444
|
+
process.exit(0);
|
|
445
|
+
}
|
|
446
|
+
const spinner = ora3("Removing local authentication token...").start();
|
|
447
|
+
await saveConfig({
|
|
448
|
+
...config2,
|
|
449
|
+
token: void 0
|
|
450
|
+
});
|
|
451
|
+
spinner.succeed();
|
|
452
|
+
logger.info(chalk4.green("Logged out successfully!"));
|
|
453
|
+
} catch (error) {
|
|
454
|
+
handleError(error);
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
var authKeys = new Command3().name("authkeys").description("List and select API keys.").argument("keys", "to list and select API keys").action(async () => {
|
|
458
|
+
try {
|
|
459
|
+
const config2 = await getConfig();
|
|
460
|
+
if (!config2) {
|
|
461
|
+
logger.error("No configuration found. Please run `ethereal init` first.");
|
|
462
|
+
process.exit(1);
|
|
463
|
+
}
|
|
464
|
+
if (!config2.token) {
|
|
465
|
+
logger.error("You are not authenticated. Please run `ethereal auth login` first.");
|
|
466
|
+
process.exit(1);
|
|
467
|
+
}
|
|
468
|
+
logger.info("Fetching API keys...");
|
|
469
|
+
let apiKeys = [];
|
|
470
|
+
const baseUrl = config2.url;
|
|
471
|
+
const apiKeysUrl = baseUrl.endsWith("/api/v1/cli/apikeys") ? baseUrl : `${baseUrl}/api/v1/cli/apikeys`;
|
|
472
|
+
try {
|
|
473
|
+
const isHttps = apiKeysUrl.startsWith("https://");
|
|
474
|
+
const cookieName = isHttps ? "__Secure-authjs.session-token" : "authjs.session-token";
|
|
475
|
+
const response = await fetch(apiKeysUrl, {
|
|
476
|
+
headers: {
|
|
477
|
+
"Cookie": `${cookieName}=${config2.token}; Secure; HttpOnly; SameSite=Strict`
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
if (!response.ok) {
|
|
481
|
+
logger.error(`Failed to fetch API keys: ${response.statusText}`);
|
|
482
|
+
process.exit(1);
|
|
483
|
+
}
|
|
484
|
+
apiKeys = await response.json();
|
|
485
|
+
if (!apiKeys || apiKeys.length === 0) {
|
|
486
|
+
logger.error("No API keys found for your account.");
|
|
487
|
+
process.exit(1);
|
|
488
|
+
}
|
|
489
|
+
} catch (error) {
|
|
490
|
+
logger.error("Failed to fetch API keys:", error);
|
|
491
|
+
process.exit(1);
|
|
492
|
+
}
|
|
493
|
+
const { selectedKey } = await inquirer2.prompt([
|
|
494
|
+
{
|
|
495
|
+
type: "list",
|
|
496
|
+
name: "selectedKey",
|
|
497
|
+
message: "Select an API key to use:",
|
|
498
|
+
choices: apiKeys.map((key) => {
|
|
499
|
+
const permissionsStr = Object.entries(key.permissions ?? {}).map(([resource, permission]) => `${resource}: ${permission}`).join(", ");
|
|
500
|
+
const createdDate = new Date(key.created_at).toLocaleDateString();
|
|
501
|
+
return {
|
|
502
|
+
name: `${key.alias || "Unnamed Key"} - ${key.key} - Created: ${createdDate} - Permissions: ${permissionsStr}`,
|
|
503
|
+
value: key.key
|
|
504
|
+
};
|
|
505
|
+
})
|
|
506
|
+
}
|
|
507
|
+
]);
|
|
508
|
+
const spinner = ora3("Saving selected API key...").start();
|
|
509
|
+
await saveConfig({
|
|
510
|
+
...config2,
|
|
511
|
+
auth: selectedKey
|
|
512
|
+
});
|
|
513
|
+
spinner.succeed();
|
|
514
|
+
logger.info(chalk4.green("API key saved successfully!"));
|
|
515
|
+
logger.info(`Using API key: ${chalk4.cyan(selectedKey)}`);
|
|
516
|
+
} catch (error) {
|
|
517
|
+
handleError(error);
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
|
|
327
521
|
// bin/index.ts
|
|
328
522
|
process.on("SIGINT", () => process.exit(0));
|
|
329
523
|
process.on("SIGTERM", () => process.exit(0));
|
|
330
524
|
function main() {
|
|
331
525
|
const packageInfo = getPackageInfo();
|
|
332
|
-
const program = new
|
|
526
|
+
const program = new Command4().name("ethereal").description("Add components and dependencies to your Nexus projects.").version(
|
|
333
527
|
packageInfo.version || "1.0.0",
|
|
334
528
|
"-v, --version",
|
|
335
529
|
"display the version number"
|
|
336
530
|
);
|
|
337
|
-
program.addCommand(init).addCommand(publish2).parse();
|
|
531
|
+
program.addCommand(init).addCommand(authLogin).addCommand(authLogout).addCommand(authKeys).addCommand(publish2).parse();
|
|
338
532
|
}
|
|
339
533
|
main();
|
|
340
534
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../bin/index.ts","../src/commands/publish.ts","../src/utils/logger.ts","../src/utils/handle-error.ts","../src/utils/get-config.ts","../src/utils/get-tar-exclude-list.ts","../src/utils/create-tar.ts","../src/lib/services/nexus.ts","../src/commands/init.ts","../src/utils/get-package-info.ts","../src/utils/dirname.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Command } from \"commander\"\nimport { publish } from '../src/commands/publish';\nimport { init } from '../src/commands/init';\nimport { getPackageInfo } from \"../src/utils/get-package-info\"\n\nprocess.on(\"SIGINT\", () => process.exit(0))\nprocess.on(\"SIGTERM\", () => process.exit(0))\n\nfunction main() {\n const packageInfo = getPackageInfo();\n\n const program = new Command()\n .name(\"ethereal\")\n .description(\"Add components and dependencies to your Nexus projects.\")\n .version(\n packageInfo.version || \"1.0.0\",\n \"-v, --version\",\n \"display the version number\"\n )\n\n program\n .addCommand(init)\n .addCommand(publish)\n .parse()\n}\n\nmain()","import path from 'path';\nimport chalk from 'chalk';\nimport { existsSync, readdirSync } from 'node:fs';\nimport { Command } from 'commander';\nimport { z } from 'zod';\nimport { handleError } from '../utils/handle-error';\nimport { logger } from '../utils/logger';\nimport { getConfig } from '../utils/get-config';\nimport { getTarExcludeList, ignoreCommonFiles } from '../utils/get-tar-exclude-list';\nimport { createTar } from '../utils/create-tar';\nimport ora from 'ora';\nimport { nexus } from '../lib/services/nexus';\n\nconst publishOptionsSchema = z.object({\n components: z.array(z.string()).optional(),\n yes: z.boolean(),\n overwrite: z.boolean(),\n all: z.boolean(),\n path: z.string().optional()\n});\n\nexport const publish = new Command()\n .name('publish')\n .description('publish a component to your project')\n .argument('[components...]', 'the components to add')\n .option('-y, --yes', 'skip confirmation prompt.', false)\n .option('-o, --overwrite', 'overwrite existing versions.', false)\n .option('-a, --all', 'add all available components', false)\n .option('-p, --path <path>', 'the path to .ethereal folder where the component are.')\n .action(async (components, opts) => {\n try {\n const options = publishOptionsSchema.parse({\n components,\n ...opts\n });\n if (!options.all && !options.components?.length) {\n logger.warn(\n `Either [components...] or --all need to be passed.`\n );\n process.exit(1);\n }\n\n const config = await getConfig();\n if (!config) {\n logger.warn(\n `Configuration is missing. Please run ${chalk.green(\n `'init'`\n )} to create an .etherealrc file.`\n );\n process.exit(1);\n }\n\n const distPath = config?.path;\n if (!distPath || !existsSync(distPath)) {\n logger.error(`The path ${distPath} does not exist. Please try again.`);\n process.exit(1);\n }\n\n const selectedComponents = options.all\n ? readdirSync(distPath).filter(folder => !ignoreCommonFiles.includes(folder))\n : options.components!;\n\n const componentPaths = selectedComponents.map(folder => path.resolve(distPath, folder));\n const excludeList = getTarExcludeList();\n const spinner = ora({\n discardStdin: false,\n text: `${chalk.green('Taring files...\\n')}`\n }).start();\n for (const folder of componentPaths) {\n spinner.text = `Taring ${folder}...\\n`;\n createTar(folder, excludeList);\n spinner.stopAndPersist({\n text: folder,\n symbol: chalk.green('✔')\n });\n }\n\n spinner.start(`Publishing...\\n`);\n for (const folder of componentPaths) {\n spinner.text = `Publishing ${folder}...\\n`;\n const tar = `${folder}/ethereal_nexus.tar.gz`;\n try {\n const result = await nexus.publish(tar);\n spinner.stopAndPersist({\n text: folder,\n symbol: chalk.green('✔')\n });\n\n if(result === 409) {\n logger.warn('Some assets were already present.');\n }\n } catch (e) {\n logger.error(`Failed to publish ${tar}.`, e);\n process.exit(1);\n }\n }\n spinner.stop();\n\n logger.info(\"\")\n spinner.succeed(`Done.`);\n logger.info(\n `${chalk.green(\n \"Success!\"\n )} You may now start using your components.`\n )\n } catch (error) {\n handleError(error);\n }\n });\n","import chalk from \"chalk\"\n\nexport const logger = {\n error(...args: unknown[]) {\n console.log(chalk.red(...args))\n },\n warn(...args: unknown[]) {\n console.log(chalk.yellow(...args))\n },\n info(...args: unknown[]) {\n console.log(chalk.cyan(...args))\n },\n success(...args: unknown[]) {\n console.log(chalk.green(...args))\n },\n break() {\n console.log(\"\")\n },\n}","import { logger } from './logger';\n\nexport function handleError(error: unknown) {\n if (typeof error === \"string\") {\n logger.error(error)\n process.exit(1)\n }\n\n if (error instanceof Error) {\n logger.error(error.message)\n process.exit(1)\n }\n\n logger.error(\"Something went wrong. Please try again.\")\n process.exit(1)\n}","import path from \"path\"\nimport { cosmiconfig } from \"cosmiconfig\"\nimport { z } from \"zod\"\n\nexport const DEFAULT_PATH = \"./dist/.ethereal\"\n\nconst explorer = cosmiconfig(\"ethereal\");\n\nexport const configSchema = z\n .object({\n $schema: z.string().optional(),\n url: z.string(),\n auth: z.string(),\n path: z.string().optional()\n })\n .strict()\n\nexport type Config = z.infer<typeof configSchema>\n\nexport async function getRawConfig(cwd: string): Promise<Config | null> {\n try {\n const configResult = await explorer.search(cwd)\n if (!configResult) {\n return null\n }\n\n return configSchema.parse(configResult.config)\n } catch (error) {\n throw new Error(`Invalid configuration found in ${cwd}/components.json.`)\n }\n}\n\nexport async function resolveConfigPaths(cwd: string, config: Config) {\n const sourcePath = config.path ?? DEFAULT_PATH;\n return configSchema.parse({\n ...config,\n path: path.resolve(cwd, sourcePath),\n })\n}\n\nexport async function getConfig() {\n const cwd = path.resolve(process.cwd())\n const config = await getRawConfig(cwd)\n\n if (!config) {\n return null\n }\n\n return await resolveConfigPaths(cwd, config)\n}\n","import fs from 'node:fs';\n\nexport const ignoreCommonFiles = [\n 'package.json',\n 'package-lock.json',\n 'yarn.lock',\n 'pnpm-lock.yaml',\n 'node_modules',\n '.DS_Store'\n]\n\nexport function getTarExcludeList(excludedPaths: string[] = []) {\n const gitignore = fs.existsSync('.gitignore')\n ? fs.readFileSync('.gitignore', 'utf-8')\n : '';\n const gitignoreFiles = gitignore\n ?.split('\\n')\n ?.filter((file) => !file?.includes('#') && file?.trim() !== '');\n\n return [\n ...gitignoreFiles,\n ...excludedPaths,\n ...ignoreCommonFiles,\n '*.tar',\n '*.tar.gz',\n '*.tar.xz',\n ]\n}\n","import { create } from 'tar'\nimport { minimatch } from 'minimatch'\n\nexport function createTar(folder: string, excludeList: string[]) {\n console.log(folder)\n return create(\n {\n gzip: true,\n file: `${folder}/ethereal_nexus.tar.gz`,\n filter: (path) => {\n for (const exclude of excludeList) {\n if (minimatch(path, exclude)) {\n return false\n }\n }\n return true\n },\n cwd: `${folder}/`,\n sync: true,\n },\n ['.']\n )\n}","import wretch from \"wretch\"\nimport { getConfig } from '../../utils/get-config';\nimport fs from 'node:fs';\nimport path from 'path';\n\nconst config = await getConfig()\nconst nexusApi = wretch(config?.url)\n .auth(`apikey ${config?.auth}`)\n\nconst publish = async (filePath: string) => {\n const form = new FormData();\n const buffer = fs.readFileSync(filePath);\n const blob = new Blob([buffer])\n const fileName = path.basename(filePath);\n\n form.append('file', blob, fileName);\n\n return await nexusApi\n .url(\"/api/v1/publish\")\n .body(form)\n .post()\n .error(409, (error) => 409)\n .json()\n}\n\nexport const nexus = {\n publish\n}\n","import { existsSync, promises as fs } from 'fs';\nimport { Command } from 'commander';\nimport { logger } from '../utils/logger';\nimport chalk from 'chalk';\nimport { handleError } from '../utils/handle-error';\nimport ora from 'ora';\nimport inquirer from 'inquirer';\nimport { configSchema, DEFAULT_PATH } from '../utils/get-config';\nimport { z } from 'zod';\nimport { resolve } from 'node:path';\n\nconst initOptionsSchema = z.object({\n yes: z.boolean(),\n});\n\nexport const init = new Command()\n .name(\"init\")\n .description(\"initialize your project configuration\")\n .option('-y, --yes', 'skip confirmation prompt.', false)\n .action(async (opts) => {\n try {\n const options = initOptionsSchema.parse(opts)\n const cwd = resolve(process.cwd())\n\n // Ensure target directory exists.\n if (!existsSync(cwd)) {\n logger.error(`The path ${cwd} does not exist. Please try again.`)\n process.exit(1)\n }\n\n await promptForConfig(cwd, options.yes)\n\n logger.info(\"\")\n logger.info(\n `${chalk.green(\n \"Success!\"\n )} Project initialization completed. You may now create your components.`\n )\n } catch (error) {\n handleError(error)\n }\n })\n\nexport async function promptForConfig(\n cwd: string,\n skip: boolean,\n) {\n const highlight = (text: string) => chalk.cyan(text)\n\n const options = await inquirer\n .prompt([{\n type: 'input',\n name: 'url',\n message: `What is your ${highlight('Nexus')} instance url?`\n },\n {\n type: 'password',\n name: 'auth',\n message: `What is your ${highlight('Nexus')} instance Api Key?`\n },\n {\n type: 'input',\n name: 'path',\n default: DEFAULT_PATH,\n message: `What is the path for your library output?`\n }\n ])\n\n const config = configSchema.parse({\n url: options.url,\n auth: options.auth,\n path: options.path,\n })\n\n if (!skip) {\n const { proceed } = await inquirer\n .prompt({\n type: \"confirm\",\n name: \"proceed\",\n message: `Write configuration to ${highlight(\n \".etherealrc\"\n )}. Proceed?`,\n default: true,\n })\n\n if (!proceed) {\n process.exit(0)\n }\n }\n logger.info(\"\")\n const spinner = ora(`Writing .etherealrc...`).start()\n const targetPath = resolve(cwd, \".etherealrc\")\n await fs.writeFile(targetPath, JSON.stringify(config, null, 2), \"utf8\")\n spinner.succeed()\n}\n","import path from \"path\"\nimport fs from \"fs-extra\"\nimport { __dirname } from \"./dirname\"\nimport { type PackageJson } from \"type-fest\"\n\nexport function getPackageInfo() {\n const packageJsonPath = path.join(__dirname, \"../package.json\")\n\n return fs.readJSONSync(packageJsonPath) as PackageJson\n}","import { dirname } from 'path';\nimport { fileURLToPath } from 'url';\n\nexport const __dirname = dirname(fileURLToPath(import.meta.url));"],"mappings":";;;AACA,SAAS,WAAAA,gBAAe;;;ACDxB,OAAOC,WAAU;AACjB,OAAOC,YAAW;AAClB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BC,MAAK,KAAK,WAAW,iBAAiB;AAE9D,SAAOC,IAAG,aAAa,eAAe;AACxC;;;ATHA,QAAQ,GAAG,UAAU,MAAM,QAAQ,KAAK,CAAC,CAAC;AAC1C,QAAQ,GAAG,WAAW,MAAM,QAAQ,KAAK,CAAC,CAAC;AAE3C,SAAS,OAAO;AACd,QAAM,cAAc,eAAe;AAEnC,QAAM,UAAU,IAAIC,SAAQ,EACzB,KAAK,UAAU,EACf,YAAY,yDAAyD,EACrE;AAAA,IACC,YAAY,WAAW;AAAA,IACvB;AAAA,IACA;AAAA,EACF;AAEF,UACG,WAAW,IAAI,EACf,WAAWC,QAAO,EAClB,MAAM;AACX;AAEA,KAAK;","names":["Command","path","chalk","z","config","path","fs","path","z","publish","config","chalk","path","existsSync","fs","Command","chalk","ora","z","Command","existsSync","chalk","config","ora","fs","path","fs","path","fs","Command","publish"]}
|
|
1
|
+
{"version":3,"sources":["../bin/index.ts","../src/commands/publish.ts","../src/utils/logger.ts","../src/utils/handle-error.ts","../src/utils/get-config.ts","../src/utils/get-tar-exclude-list.ts","../src/utils/create-tar.ts","../src/lib/services/nexus.ts","../src/commands/init.ts","../src/utils/get-package-info.ts","../src/utils/dirname.ts","../src/commands/auth.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Command } from \"commander\"\nimport { publish } from '../src/commands/publish';\nimport { init } from '../src/commands/init';\nimport { getPackageInfo } from \"../src/utils/get-package-info\"\nimport { authLogin, authLogout, authKeys } from '../src/commands/auth';\n\nprocess.on(\"SIGINT\", () => process.exit(0))\nprocess.on(\"SIGTERM\", () => process.exit(0))\n\nfunction main() {\n const packageInfo = getPackageInfo();\n\n const program = new Command()\n .name(\"ethereal\")\n .description(\"Add components and dependencies to your Nexus projects.\")\n .version(\n packageInfo.version || \"1.0.0\",\n \"-v, --version\",\n \"display the version number\"\n )\n\n program\n .addCommand(init)\n .addCommand(authLogin)\n .addCommand(authLogout)\n .addCommand(authKeys)\n .addCommand(publish)\n .parse()\n}\n\nmain()\n","import path from 'path';\nimport chalk from 'chalk';\nimport { existsSync, readdirSync } from 'node:fs';\nimport { Command } from 'commander';\nimport { z } from 'zod';\nimport { handleError } from '../utils/handle-error';\nimport { logger } from '../utils/logger';\nimport { getConfig } from '../utils/get-config';\nimport { getTarExcludeList, ignoreCommonFiles } from '../utils/get-tar-exclude-list';\nimport { createTar } from '../utils/create-tar';\nimport ora from 'ora';\nimport { nexus } from '../lib/services/nexus';\n\nconst publishOptionsSchema = z.object({\n components: z.array(z.string()).optional(),\n yes: z.boolean(),\n overwrite: z.boolean(),\n all: z.boolean(),\n path: z.string().optional()\n});\n\nexport const publish = new Command()\n .name('publish')\n .description('publish a component to your project')\n .argument('[components...]', 'the components to add')\n .option('-y, --yes', 'skip confirmation prompt.', false)\n .option('-o, --overwrite', 'overwrite existing versions.', false)\n .option('-a, --all', 'add all available components', false)\n .option('-p, --path <path>', 'the path to .ethereal folder where the component are.')\n .action(async (components, opts) => {\n try {\n const options = publishOptionsSchema.parse({\n components,\n ...opts\n });\n if (!options.all && !options.components?.length) {\n logger.warn(\n `Either [components...] or --all need to be passed.`\n );\n process.exit(1);\n }\n\n const config = await getConfig();\n if (!config) {\n logger.warn(\n `Configuration is missing. Please run ${chalk.green(\n `'init'`\n )} to create an .etherealrc file.`\n );\n process.exit(1);\n }\n\n const distPath = config?.path;\n if (!distPath || !existsSync(distPath)) {\n logger.error(`The path ${distPath} does not exist. Please try again.`);\n process.exit(1);\n }\n\n const selectedComponents = options.all\n ? readdirSync(distPath).filter(folder => !ignoreCommonFiles.includes(folder))\n : options.components!;\n\n const componentPaths = selectedComponents.map(folder => path.resolve(distPath, folder));\n const excludeList = getTarExcludeList();\n const spinner = ora({\n discardStdin: false,\n text: `${chalk.green('Taring files...\\n')}`\n }).start();\n for (const folder of componentPaths) {\n spinner.text = `Taring ${folder}...\\n`;\n createTar(folder, excludeList);\n spinner.stopAndPersist({\n text: folder,\n symbol: chalk.green('✔')\n });\n }\n\n spinner.start(`Publishing...\\n`);\n for (const folder of componentPaths) {\n spinner.text = `Publishing ${folder}...\\n`;\n const tar = `${folder}/ethereal_nexus.tar.gz`;\n try {\n const result = await nexus.publish(tar);\n spinner.stopAndPersist({\n text: folder,\n symbol: chalk.green('✔')\n });\n\n if(result === 409) {\n logger.warn('Some assets were already present.');\n }\n } catch (e) {\n logger.error(`Failed to publish ${tar}.`, e);\n process.exit(1);\n }\n }\n spinner.stop();\n\n logger.info(\"\")\n spinner.succeed(`Done.`);\n logger.info(\n `${chalk.green(\n \"Success!\"\n )} You may now start using your components.`\n )\n } catch (error) {\n handleError(error);\n }\n });\n","import chalk from \"chalk\"\n\nexport const logger = {\n error(...args: unknown[]) {\n console.log(chalk.red(...args))\n },\n warn(...args: unknown[]) {\n console.log(chalk.yellow(...args))\n },\n info(...args: unknown[]) {\n console.log(chalk.cyan(...args))\n },\n success(...args: unknown[]) {\n console.log(chalk.green(...args))\n },\n break() {\n console.log(\"\")\n },\n}","import { logger } from './logger';\n\nexport function handleError(error: unknown) {\n if (typeof error === \"string\") {\n logger.error(error)\n process.exit(1)\n }\n\n if (error instanceof Error) {\n logger.error(error.message)\n process.exit(1)\n }\n\n logger.error(\"Something went wrong. Please try again.\")\n process.exit(1)\n}","import path from \"path\"\nimport { cosmiconfig } from \"cosmiconfig\"\nimport { z } from \"zod\"\nimport { promises as fs } from 'fs'\n\nexport const DEFAULT_PATH = \"./dist/.ethereal\"\n\nconst explorer = cosmiconfig(\"ethereal\");\n\nexport const configSchema = z\n .object({\n $schema: z.string().optional(),\n url: z.string(),\n auth: z.string().optional(),\n token: z.string().optional(),\n path: z.string().optional(),\n authType: z.enum(['keycloak']).optional(),\n })\n .strict()\n\nexport type Config = z.infer<typeof configSchema>\n\nexport async function getRawConfig(cwd: string): Promise<Config | null> {\n try {\n const configResult = await explorer.search(cwd)\n if (!configResult) {\n return null\n }\n\n return configSchema.parse(configResult.config)\n } catch (error) {\n console.error(error.message)\n throw new Error(`Invalid configuration found in ${cwd}/components.json.`)\n }\n}\n\nexport async function resolveConfigPaths(cwd: string, config: Config) {\n const sourcePath = config.path ?? DEFAULT_PATH;\n return configSchema.parse({\n ...config,\n path: path.resolve(cwd, sourcePath),\n })\n}\n\nexport async function getConfig() {\n const cwd = path.resolve(process.cwd())\n const config = await getRawConfig(cwd)\n\n if (!config) {\n return null\n }\n\n return await resolveConfigPaths(cwd, config)\n}\n\nexport async function saveConfig(config: Config) {\n const cwd = path.resolve(process.cwd())\n const targetPath = path.resolve(cwd, \".etherealrc\")\n await fs.writeFile(targetPath, JSON.stringify(config, null, 2), \"utf8\")\n return config\n}\n","import fs from 'node:fs';\n\nexport const ignoreCommonFiles = [\n 'package.json',\n 'package-lock.json',\n 'yarn.lock',\n 'pnpm-lock.yaml',\n 'node_modules',\n '.DS_Store'\n]\n\nexport function getTarExcludeList(excludedPaths: string[] = []) {\n const gitignore = fs.existsSync('.gitignore')\n ? fs.readFileSync('.gitignore', 'utf-8')\n : '';\n const gitignoreFiles = gitignore\n ?.split('\\n')\n ?.filter((file) => !file?.includes('#') && file?.trim() !== '');\n\n return [\n ...gitignoreFiles,\n ...excludedPaths,\n ...ignoreCommonFiles,\n '*.tar',\n '*.tar.gz',\n '*.tar.xz',\n ]\n}\n","import { create } from 'tar'\nimport { minimatch } from 'minimatch'\n\nexport function createTar(folder: string, excludeList: string[]) {\n console.log(folder)\n return create(\n {\n gzip: true,\n file: `${folder}/ethereal_nexus.tar.gz`,\n filter: (path) => {\n for (const exclude of excludeList) {\n if (minimatch(path, exclude)) {\n return false\n }\n }\n return true\n },\n cwd: `${folder}/`,\n sync: true,\n },\n ['.']\n )\n}","import wretch from \"wretch\"\nimport { getConfig } from '../../utils/get-config';\nimport fs from 'node:fs';\nimport path from 'path';\n\nconst config = await getConfig()\nlet nexusApi = wretch(config?.url)\n\n// If authType is keycloak and token exists, set the cookie\nif (config?.authType === 'keycloak' && config?.token) {\n // Determine if the URL is using HTTPS\n const isHttps = config?.url?.startsWith('https://');\n\n // Set the appropriate cookie name based on the protocol\n const cookieName = isHttps ? '__Secure-authjs.session-token' : 'authjs.session-token';\n\n nexusApi = nexusApi.headers({\n 'Cookie': `${cookieName}=${config.token}; Secure; HttpOnly; SameSite=Strict`\n })\n}\n\nnexusApi = nexusApi.auth(`apikey ${config?.auth}`)\n\n\nconst publish = async (filePath: string) => {\n\n const form = new FormData();\n const buffer = fs.readFileSync(filePath);\n const blob = new Blob([buffer])\n const fileName = path.basename(filePath);\n\n form.append('file', blob, fileName);\n\n\n return await nexusApi\n .url(\"/api/v1/publish\")\n .body(form)\n .post()\n .error(409, (error) => 409)\n .json()\n}\n\nexport const nexus = {\n publish\n}\n","import { existsSync, promises as fs } from 'fs';\nimport { Command } from 'commander';\nimport { logger } from '../utils/logger';\nimport chalk from 'chalk';\nimport { handleError } from '../utils/handle-error';\nimport ora from 'ora';\nimport inquirer from 'inquirer';\nimport { configSchema, DEFAULT_PATH } from '../utils/get-config';\nimport { z } from 'zod';\nimport { resolve } from 'node:path';\n\nconst initOptionsSchema = z.object({\n yes: z.boolean(),\n});\n\nexport const init = new Command()\n .name(\"init\")\n .description(\"initialize your project configuration\")\n .option('-y, --yes', 'skip confirmation prompt.', false)\n .action(async (opts) => {\n try {\n const options = initOptionsSchema.parse(opts)\n const cwd = resolve(process.cwd())\n\n // Ensure target directory exists.\n if (!existsSync(cwd)) {\n logger.error(`The path ${cwd} does not exist. Please try again.`)\n process.exit(1)\n }\n\n await promptForConfig(cwd, options.yes)\n\n logger.info(\"\")\n logger.info(\n `${chalk.green(\n \"Success!\"\n )} Project initialization completed. You may now create your components.`\n )\n } catch (error) {\n handleError(error)\n }\n })\n\nexport async function promptForConfig(\n cwd: string,\n skip: boolean,\n) {\n const highlight = (text: string) => chalk.cyan(text)\n\n const options = await inquirer\n .prompt([{\n type: 'input',\n name: 'url',\n message: `What is your ${highlight('Nexus')} instance url?`\n },\n {\n type: 'password',\n name: 'auth',\n message: `What is your ${highlight('Nexus')} instance Api Key?`\n },\n {\n type: 'input',\n name: 'path',\n default: DEFAULT_PATH,\n message: `What is the path for your library output?`\n }\n ])\n\n const config = configSchema.parse({\n url: options.url,\n auth: options.auth,\n path: options.path,\n })\n\n if (!skip) {\n const { proceed } = await inquirer\n .prompt({\n type: \"confirm\",\n name: \"proceed\",\n message: `Write configuration to ${highlight(\n \".etherealrc\"\n )}. Proceed?`,\n default: true,\n })\n\n if (!proceed) {\n process.exit(0)\n }\n }\n logger.info(\"\")\n const spinner = ora(`Writing .etherealrc...`).start()\n const targetPath = resolve(cwd, \".etherealrc\")\n await fs.writeFile(targetPath, JSON.stringify(config, null, 2), \"utf8\")\n spinner.succeed()\n}\n","import path from \"path\"\nimport fs from \"fs-extra\"\nimport { __dirname } from \"./dirname\"\nimport { type PackageJson } from \"type-fest\"\n\nexport function getPackageInfo() {\n const packageJsonPath = path.join(__dirname, \"../package.json\")\n\n return fs.readJSONSync(packageJsonPath) as PackageJson\n}","import { dirname } from 'path';\nimport { fileURLToPath } from 'url';\n\nexport const __dirname = dirname(fileURLToPath(import.meta.url));","import { Command } from 'commander';\nimport { handleError } from '../utils/handle-error';\nimport { getConfig, saveConfig } from '../utils/get-config';\nimport open from 'open';\nimport { logger } from '../utils/logger';\nimport ora from 'ora';\nimport chalk from 'chalk';\nimport http from 'http';\nimport { URL } from 'url';\nimport inquirer from 'inquirer';\n\n/**\n * Command to authenticate with Keycloak.\n * This command implements a direct OAuth flow:\n * 1. Verifies that authType is set to 'keycloak' in .etherealrc\n * 2. Uses the authenticationUrl from .etherealrc as the Keycloak server URL\n * 3. Sets up a local server to receive the callback\n * 4. Opens the browser for the user to login\n * 5. Listens for a token parameter in the callback URL (localhost:${port}/?token=...)\n * 6. Saves the received token to the .etherealrc file\n */\nexport const authLogin = new Command()\n .name('auth')\n .description('Ethereal Nexus authentication command.')\n .argument('login', 'to login')\n .option('--port <port>', 'Port to use for the callback server', '3000')\n .action(async (_, options) => {\n try {\n const config = await getConfig();\n\n if (!config) {\n logger.error('No configuration found. Please run `ethereal init` first.');\n process.exit(1);\n }\n\n if (!config.url) {\n logger.error('No authentication URL found in configuration.');\n process.exit(1);\n }\n\n if (!config.authType || config.authType !== 'keycloak') {\n logger.error('Authentication type must be set to \"keycloak\" in .etherealrc');\n process.exit(1);\n }\n\n logger.info(`Starting Keycloak login flow...`);\n\n // Use the authentication URL directly without format verification\n const baseUrl = config.url;\n\n logger.info(`Using Keycloak server: ${baseUrl}`);\n\n // Create a local server to receive the callback\n const server = http.createServer();\n\n // Use the specified port or default to 3000\n const port = parseInt(options.port);\n\n try {\n server.listen(port);\n logger.info(`Using port ${port} for callback server`);\n } catch (error) {\n logger.error(`Failed to bind to port ${port}. It might be in use by another application.`);\n process.exit(1);\n }\n\n // Handle server errors\n server.on('error', (error: any) => {\n if (error.code === 'EADDRINUSE') {\n logger.error(`Port ${port} is already in use. Please specify a different port with --port option.`);\n process.exit(1);\n } else {\n logger.error(`Server error: ${error.message}`);\n process.exit(1);\n }\n });\n\n // Create a promise that will resolve when we get the tokens\n const tokenPromise = new Promise<{ access_token: string, refresh_token?: string }>((resolve, reject) => {\n // Set a timeout to reject the promise after 5 minutes\n const timeout = setTimeout(() => {\n server.close();\n reject(new Error('Authentication timed out'));\n }, 5 * 60 * 1000);\n\n server.on('request', async (req, res) => {\n try {\n // Parse the URL to get the token\n const url = new URL(req.url || '', `http://localhost:${port}`);\n const token = url.searchParams.get('token');\n\n if (token) {\n // Send a response to the browser\n res.writeHead(200, { 'Content-Type': 'text/plain' });\n res.end('Ethereal Nexus CLI Authentication successful! You can close this window.');\n\n // Resolve the promise with the token\n clearTimeout(timeout);\n resolve({ access_token: token });\n\n // Close the server\n server.close();\n }\n } catch (error) {\n reject(error);\n server.close();\n }\n });\n });\n\n // Ensure the auth URL is correctly constructed\n const authUrlBase = baseUrl.endsWith(`/api/v1/cli-auth?callback=http://localhost:${port}`)\n ? baseUrl \n : `${baseUrl}/api/v1/cli-auth?callback=http://localhost:${port}`;\n const authUrl = new URL(authUrlBase);\n\n // Open the browser with the login URL\n logger.info(`Opening browser to authenticate...`);\n logger.info(`If the browser doesn't open automatically, please visit:`);\n logger.info(chalk.cyan(authUrl.toString()));\n\n await open(authUrl.toString());\n\n logger.info(`Waiting for authentication...`);\n\n // Wait for the tokens\n try {\n const { access_token } = await tokenPromise;\n\n // Save the tokens to the config\n const spinner = ora('Saving authentication tokens...').start();\n await saveConfig({\n ...config,\n token: access_token\n });\n spinner.succeed();\n\n logger.info(chalk.green('Authentication successful!'));\n } catch (error) {\n logger.error('Authentication failed:', error);\n process.exit(1);\n }\n } catch (error) {\n handleError(error);\n }\n });\n\n/**\n * Command to logout.\n * This command simply removes the authentication token from the config file.\n */\nexport const authLogout = new Command()\n .name('auth logout')\n .description('Ethereal Nexus authentication command.')\n .argument('logout', 'to logout')\n .action(async () => {\n try {\n const config = await getConfig();\n\n if (!config) {\n logger.error('No configuration found. Please run `ethereal init` first.');\n process.exit(1);\n }\n\n if (!config.auth) {\n logger.info('You are not currently logged in.');\n process.exit(0);\n }\n\n // Remove the token from the config\n const spinner = ora('Removing local authentication token...').start();\n await saveConfig({\n ...config,\n token: undefined\n });\n spinner.succeed();\n\n logger.info(chalk.green('Logged out successfully!'));\n } catch (error) {\n handleError(error);\n }\n });\n\n/**\n * Command to list and select API keys.\n * This command:\n * 1. Checks if .etherealrc has an \"auth\" field\n * 2. Lists all API keys from a specific user (mocked data for now)\n * 3. Allows keyboard selection of a specific API key\n * 4. Saves the selected API key to .etherealrc\n */\nexport const authKeys = new Command()\n .name('authkeys')\n .description('List and select API keys.')\n .argument('keys', 'to list and select API keys')\n .action(async () => {\n try {\n const config = await getConfig();\n\n if (!config) {\n logger.error('No configuration found. Please run `ethereal init` first.');\n process.exit(1);\n }\n\n if (!config.token) {\n logger.error('You are not authenticated. Please run `ethereal auth login` first.');\n process.exit(1);\n }\n\n logger.info('Fetching API keys...');\n\n // Fetch API keys from the server\n let apiKeys = [];\n const baseUrl = config.url;\n const apiKeysUrl = baseUrl.endsWith('/api/v1/cli/apikeys')\n ? baseUrl\n : `${baseUrl}/api/v1/cli/apikeys`;\n\n try {\n // Determine if the API keys URL is using HTTPS\n const isHttps = apiKeysUrl.startsWith('https://');\n\n // Set the appropriate cookie name based on the protocol\n const cookieName = isHttps ? '__Secure-authjs.session-token' : 'authjs.session-token';\n\n const response = await fetch(apiKeysUrl, {\n headers: {\n 'Cookie': `${cookieName}=${config.token}; Secure; HttpOnly; SameSite=Strict`\n }\n });\n\n if (!response.ok) {\n logger.error(`Failed to fetch API keys: ${response.statusText}`);\n process.exit(1);\n }\n\n apiKeys = await response.json();\n\n if (!apiKeys || apiKeys.length === 0) {\n logger.error('No API keys found for your account.');\n process.exit(1);\n }\n } catch (error) {\n logger.error('Failed to fetch API keys:', error);\n process.exit(1);\n }\n\n // Display API keys with inquirer\n const { selectedKey } = await inquirer.prompt([\n {\n type: 'list',\n name: 'selectedKey',\n message: 'Select an API key to use:',\n choices: apiKeys.map((key: { permissions: any; id:string, created_at: string | number | Date; alias: any; key: any; }) => {\n // Format the permissions for display\n const permissionsStr = Object.entries(key.permissions ?? {})\n .map(([resource, permission]) => `${resource}: ${permission}`)\n .join(', ');\n\n // Format the created_at date\n const createdDate = new Date(key.created_at).toLocaleDateString();\n\n return {\n name: `${key.alias || 'Unnamed Key'} - ${key.key} - Created: ${createdDate} - Permissions: ${permissionsStr}`,\n value: key.key\n };\n }),\n },\n ]);\n\n // Save the selected API key to .etherealrc\n const spinner = ora('Saving selected API key...').start();\n await saveConfig({\n ...config,\n auth: selectedKey\n });\n spinner.succeed();\n\n logger.info(chalk.green('API key saved successfully!'));\n logger.info(`Using API key: ${chalk.cyan(selectedKey)}`);\n } catch (error) {\n handleError(error);\n }\n });\n"],"mappings":";;;AACA,SAAS,WAAAA,gBAAe;;;ACDxB,OAAOC,WAAU;AACjB,OAAOC,YAAW;AAClB,SAAS,YAAY,mBAAmB;AACxC,SAAS,eAAe;AACxB,SAAS,KAAAC,UAAS;;;ACJlB,OAAO,WAAW;A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,QACT,SAAS,QAAQ,IAAI,CAAC,QAAoG;AAExH,gBAAM,iBAAiB,OAAO,QAAQ,IAAI,eAAe,CAAC,CAAC,EACxD,IAAI,CAAC,CAAC,UAAU,UAAU,MAAM,GAAG,QAAQ,KAAK,UAAU,EAAE,EAC5D,KAAK,IAAI;AAGZ,gBAAM,cAAc,IAAI,KAAK,IAAI,UAAU,EAAE,mBAAmB;AAEhE,iBAAO;AAAA,YACL,MAAM,GAAG,IAAI,SAAS,aAAa,MAAM,IAAI,GAAG,eAAe,WAAW,mBAAmB,cAAc;AAAA,YAC3G,OAAO,IAAI;AAAA,UACb;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAGD,UAAM,UAAUF,KAAI,4BAA4B,EAAE,MAAM;AACxD,UAAM,WAAW;AAAA,MACf,GAAGI;AAAA,MACH,MAAM;AAAA,IACR,CAAC;AACD,YAAQ,QAAQ;AAEhB,WAAO,KAAKH,OAAM,MAAM,6BAA6B,CAAC;AACtD,WAAO,KAAK,kBAAkBA,OAAM,KAAK,WAAW,CAAC,EAAE;AAAA,EACzD,SAAS,OAAO;AACd,gBAAY,KAAK;AAAA,EACnB;AACF,CAAC;;;AXpRH,QAAQ,GAAG,UAAU,MAAM,QAAQ,KAAK,CAAC,CAAC;AAC1C,QAAQ,GAAG,WAAW,MAAM,QAAQ,KAAK,CAAC,CAAC;AAE3C,SAAS,OAAO;AACd,QAAM,cAAc,eAAe;AAEnC,QAAM,UAAU,IAAIK,SAAQ,EACzB,KAAK,UAAU,EACf,YAAY,yDAAyD,EACrE;AAAA,IACC,YAAY,WAAW;AAAA,IACvB;AAAA,IACA;AAAA,EACF;AAEF,UACG,WAAW,IAAI,EACf,WAAW,SAAS,EACpB,WAAW,UAAU,EACrB,WAAW,QAAQ,EACnB,WAAWC,QAAO,EAClB,MAAM;AACX;AAEA,KAAK;","names":["Command","path","chalk","z","config","fs","path","fs","path","z","publish","config","chalk","path","existsSync","fs","Command","chalk","ora","z","Command","existsSync","chalk","config","ora","fs","path","fs","path","fs","Command","ora","chalk","inquirer","Command","config","resolve","Command","publish"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethereal-nexus/cli",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"exports": "./dist/index.js",
|
|
@@ -16,16 +16,18 @@
|
|
|
16
16
|
"fs-extra": "^11.2.0",
|
|
17
17
|
"inquirer": "^9.2.22",
|
|
18
18
|
"minimatch": "^10.0.1",
|
|
19
|
+
"node-fetch": "^3.3.2",
|
|
20
|
+
"open": "^10.0.3",
|
|
19
21
|
"ora": "^8.0.1",
|
|
20
22
|
"tar": "^7.4.0",
|
|
21
23
|
"wretch": "^2.8.1",
|
|
22
|
-
"zod": "^3.
|
|
24
|
+
"zod": "^3.24.1"
|
|
23
25
|
},
|
|
24
26
|
"devDependencies": {
|
|
25
27
|
"@types/fs-extra": "^11.0.4",
|
|
26
28
|
"@types/inquirer": "^9.0.7",
|
|
27
29
|
"@types/node": "^20.12.12",
|
|
28
|
-
"tsup": "^8.
|
|
30
|
+
"tsup": "^8.3.5",
|
|
29
31
|
"type-fest": "^4.18.2"
|
|
30
32
|
},
|
|
31
33
|
"bin": {
|