@verdaccio/cli 9.0.0-next-9.31 → 9.0.0-next-9.33
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/build/cli.js +1 -1
- package/build/cli.js.map +1 -1
- package/build/cli.mjs +1 -1
- package/build/cli.mjs.map +1 -1
- package/build/commands/env-info.d.ts +12 -0
- package/build/commands/env-info.js +139 -0
- package/build/commands/env-info.js.map +1 -0
- package/build/commands/env-info.mjs +132 -0
- package/build/commands/env-info.mjs.map +1 -0
- package/build/commands/info.d.ts +1 -0
- package/build/commands/info.js +3 -22
- package/build/commands/info.js.map +1 -1
- package/build/commands/info.mjs +4 -21
- package/build/commands/info.mjs.map +1 -1
- package/build/commands/init.js +1 -1
- package/build/commands/init.js.map +1 -1
- package/build/commands/init.mjs +1 -1
- package/build/commands/init.mjs.map +1 -1
- package/build/commands/version.js +1 -1
- package/build/commands/version.js.map +1 -1
- package/build/commands/version.mjs +1 -1
- package/build/commands/version.mjs.map +1 -1
- package/package.json +9 -9
package/build/cli.js
CHANGED
|
@@ -20,7 +20,7 @@ function runCli(options = {}) {
|
|
|
20
20
|
if (!require_utils.isVersionValid(process.version)) throw new Error(`Verdaccio requires at least Node.js v${require_utils.MIN_NODE_VERSION} or higher and you have installed ${process.version},
|
|
21
21
|
please upgrade your Node.js distribution`);
|
|
22
22
|
const [node, app, ...args] = process.argv;
|
|
23
|
-
const version = options.version ?? _verdaccio_core.pkgUtils.getPackageJson(
|
|
23
|
+
const version = options.version ?? _verdaccio_core.pkgUtils.getPackageJson(__dirname, "..").version;
|
|
24
24
|
const cli = new clipanion.Cli({
|
|
25
25
|
binaryLabel: `verdaccio`,
|
|
26
26
|
binaryName: `${node} ${app}`,
|
package/build/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["import { Cli } from 'clipanion';\n\nimport { pkgUtils, warningUtils } from '@verdaccio/core';\n\nimport { InfoCommand } from './commands/info';\nimport { InitCommand } from './commands/init';\nimport { VersionCommand } from './commands/version';\nimport type { CliRuntimeOptions } from './runtime';\nimport { configureCli } from './runtime';\nimport { MIN_NODE_VERSION, isVersionValid } from './utils';\n\n/**\n * Build and run the Verdaccio CLI.\n *\n * Called with no arguments it behaves exactly like the standalone `verdaccio`\n * binary. Downstream distributions can inject a custom server factory (and\n * version/name) via {@link CliRuntimeOptions} — e.g. a registry that needs to\n * boot with a custom Storage — without re-implementing the command set.\n */\nexport function runCli(options: CliRuntimeOptions = {}): Promise<void> {\n configureCli(options);\n\n if (process.getuid && process.getuid() === 0) {\n warningUtils.emit(warningUtils.Codes.VERWAR001);\n }\n\n if (!isVersionValid(process.version)) {\n throw new Error(\n `Verdaccio requires at least Node.js v${MIN_NODE_VERSION} or higher and you have installed ${process.version},\n please upgrade your Node.js distribution`\n );\n }\n\n const [node, app, ...args] = process.argv;\n\n const version =\n options.version
|
|
1
|
+
{"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["import { Cli } from 'clipanion';\n\nimport { pkgUtils, warningUtils } from '@verdaccio/core';\n\nimport { InfoCommand } from './commands/info';\nimport { InitCommand } from './commands/init';\nimport { VersionCommand } from './commands/version';\nimport type { CliRuntimeOptions } from './runtime';\nimport { configureCli } from './runtime';\nimport { MIN_NODE_VERSION, isVersionValid } from './utils';\n\n/**\n * Build and run the Verdaccio CLI.\n *\n * Called with no arguments it behaves exactly like the standalone `verdaccio`\n * binary. Downstream distributions can inject a custom server factory (and\n * version/name) via {@link CliRuntimeOptions} — e.g. a registry that needs to\n * boot with a custom Storage — without re-implementing the command set.\n */\nexport function runCli(options: CliRuntimeOptions = {}): Promise<void> {\n configureCli(options);\n\n if (process.getuid && process.getuid() === 0) {\n warningUtils.emit(warningUtils.Codes.VERWAR001);\n }\n\n if (!isVersionValid(process.version)) {\n throw new Error(\n `Verdaccio requires at least Node.js v${MIN_NODE_VERSION} or higher and you have installed ${process.version},\n please upgrade your Node.js distribution`\n );\n }\n\n const [node, app, ...args] = process.argv;\n\n const version =\n options.version ?? (pkgUtils.getPackageJson(import.meta.dirname, '..').version as string);\n\n const cli = new Cli({\n binaryLabel: `verdaccio`,\n binaryName: `${node} ${app}`,\n binaryVersion: version,\n });\n\n cli.register(InfoCommand);\n cli.register(InitCommand);\n cli.register(VersionCommand);\n\n process.on('uncaughtException', function (err) {\n console.error(\n `uncaught exception, please report (https://github.com/verdaccio/verdaccio/issues) this: \\n${err.stack}`\n );\n process.exit(1);\n });\n\n return cli.runExit(args, Cli.defaultContext);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,SAAgB,OAAO,UAA6B,CAAC,GAAkB;CACrE,gBAAA,aAAa,OAAO;CAEpB,IAAI,QAAQ,UAAU,QAAQ,OAAO,MAAM,GACzC,gBAAA,aAAa,KAAK,gBAAA,aAAa,MAAM,SAAS;CAGhD,IAAI,CAAC,cAAA,eAAe,QAAQ,OAAO,GACjC,MAAM,IAAI,MACR,wCAAwC,cAAA,iBAAiB,oCAAoC,QAAQ,QAAQ;6CAE/G;CAGF,MAAM,CAAC,MAAM,KAAK,GAAG,QAAQ,QAAQ;CAErC,MAAM,UACJ,QAAQ,WAAY,gBAAA,SAAS,eAAA,WAAoC,IAAI,CAAC,CAAC;CAEzE,MAAM,MAAM,IAAI,UAAA,IAAI;EAClB,aAAa;EACb,YAAY,GAAG,KAAK,GAAG;EACvB,eAAe;CACjB,CAAC;CAED,IAAI,SAAS,aAAA,WAAW;CACxB,IAAI,SAAS,aAAA,WAAW;CACxB,IAAI,SAAS,gBAAA,cAAc;CAE3B,QAAQ,GAAG,qBAAqB,SAAU,KAAK;EAC7C,QAAQ,MACN,6FAA6F,IAAI,OACnG;EACA,QAAQ,KAAK,CAAC;CAChB,CAAC;CAED,OAAO,IAAI,QAAQ,MAAM,UAAA,IAAI,cAAc;AAC7C"}
|
package/build/cli.mjs
CHANGED
|
@@ -20,7 +20,7 @@ function runCli(options = {}) {
|
|
|
20
20
|
if (!isVersionValid(process.version)) throw new Error(`Verdaccio requires at least Node.js v${MIN_NODE_VERSION} or higher and you have installed ${process.version},
|
|
21
21
|
please upgrade your Node.js distribution`);
|
|
22
22
|
const [node, app, ...args] = process.argv;
|
|
23
|
-
const version = options.version ?? pkgUtils.getPackageJson(
|
|
23
|
+
const version = options.version ?? pkgUtils.getPackageJson(import.meta.dirname, "..").version;
|
|
24
24
|
const cli = new Cli({
|
|
25
25
|
binaryLabel: `verdaccio`,
|
|
26
26
|
binaryName: `${node} ${app}`,
|
package/build/cli.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.mjs","names":[],"sources":["../src/cli.ts"],"sourcesContent":["import { Cli } from 'clipanion';\n\nimport { pkgUtils, warningUtils } from '@verdaccio/core';\n\nimport { InfoCommand } from './commands/info';\nimport { InitCommand } from './commands/init';\nimport { VersionCommand } from './commands/version';\nimport type { CliRuntimeOptions } from './runtime';\nimport { configureCli } from './runtime';\nimport { MIN_NODE_VERSION, isVersionValid } from './utils';\n\n/**\n * Build and run the Verdaccio CLI.\n *\n * Called with no arguments it behaves exactly like the standalone `verdaccio`\n * binary. Downstream distributions can inject a custom server factory (and\n * version/name) via {@link CliRuntimeOptions} — e.g. a registry that needs to\n * boot with a custom Storage — without re-implementing the command set.\n */\nexport function runCli(options: CliRuntimeOptions = {}): Promise<void> {\n configureCli(options);\n\n if (process.getuid && process.getuid() === 0) {\n warningUtils.emit(warningUtils.Codes.VERWAR001);\n }\n\n if (!isVersionValid(process.version)) {\n throw new Error(\n `Verdaccio requires at least Node.js v${MIN_NODE_VERSION} or higher and you have installed ${process.version},\n please upgrade your Node.js distribution`\n );\n }\n\n const [node, app, ...args] = process.argv;\n\n const version =\n options.version
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":[],"sources":["../src/cli.ts"],"sourcesContent":["import { Cli } from 'clipanion';\n\nimport { pkgUtils, warningUtils } from '@verdaccio/core';\n\nimport { InfoCommand } from './commands/info';\nimport { InitCommand } from './commands/init';\nimport { VersionCommand } from './commands/version';\nimport type { CliRuntimeOptions } from './runtime';\nimport { configureCli } from './runtime';\nimport { MIN_NODE_VERSION, isVersionValid } from './utils';\n\n/**\n * Build and run the Verdaccio CLI.\n *\n * Called with no arguments it behaves exactly like the standalone `verdaccio`\n * binary. Downstream distributions can inject a custom server factory (and\n * version/name) via {@link CliRuntimeOptions} — e.g. a registry that needs to\n * boot with a custom Storage — without re-implementing the command set.\n */\nexport function runCli(options: CliRuntimeOptions = {}): Promise<void> {\n configureCli(options);\n\n if (process.getuid && process.getuid() === 0) {\n warningUtils.emit(warningUtils.Codes.VERWAR001);\n }\n\n if (!isVersionValid(process.version)) {\n throw new Error(\n `Verdaccio requires at least Node.js v${MIN_NODE_VERSION} or higher and you have installed ${process.version},\n please upgrade your Node.js distribution`\n );\n }\n\n const [node, app, ...args] = process.argv;\n\n const version =\n options.version ?? (pkgUtils.getPackageJson(import.meta.dirname, '..').version as string);\n\n const cli = new Cli({\n binaryLabel: `verdaccio`,\n binaryName: `${node} ${app}`,\n binaryVersion: version,\n });\n\n cli.register(InfoCommand);\n cli.register(InitCommand);\n cli.register(VersionCommand);\n\n process.on('uncaughtException', function (err) {\n console.error(\n `uncaught exception, please report (https://github.com/verdaccio/verdaccio/issues) this: \\n${err.stack}`\n );\n process.exit(1);\n });\n\n return cli.runExit(args, Cli.defaultContext);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,SAAgB,OAAO,UAA6B,CAAC,GAAkB;CACrE,aAAa,OAAO;CAEpB,IAAI,QAAQ,UAAU,QAAQ,OAAO,MAAM,GACzC,aAAa,KAAK,aAAa,MAAM,SAAS;CAGhD,IAAI,CAAC,eAAe,QAAQ,OAAO,GACjC,MAAM,IAAI,MACR,wCAAwC,iBAAiB,oCAAoC,QAAQ,QAAQ;6CAE/G;CAGF,MAAM,CAAC,MAAM,KAAK,GAAG,QAAQ,QAAQ;CAErC,MAAM,UACJ,QAAQ,WAAY,SAAS,eAAe,YAAY,SAAS,IAAI,CAAC,CAAC;CAEzE,MAAM,MAAM,IAAI,IAAI;EAClB,aAAa;EACb,YAAY,GAAG,KAAK,GAAG;EACvB,eAAe;CACjB,CAAC;CAED,IAAI,SAAS,WAAW;CACxB,IAAI,SAAS,WAAW;CACxB,IAAI,SAAS,cAAc;CAE3B,QAAQ,GAAG,qBAAqB,SAAU,KAAK;EAC7C,QAAQ,MACN,6FAA6F,IAAI,OACnG;EACA,QAAQ,KAAK,CAAC;CAChB,CAAC;CAED,OAAO,IAAI,QAAQ,MAAM,IAAI,cAAc;AAC7C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ConfigYaml } from '@verdaccio/types';
|
|
2
|
+
/** Extract a `x.y.z` version out of a tool's `--version` output. */
|
|
3
|
+
export declare function parseVersion(raw: string): string;
|
|
4
|
+
/** Mask a path: keep the structure and the basename, replace each directory with `**`. */
|
|
5
|
+
export declare function maskPath(target: string): string;
|
|
6
|
+
/** Configured plugins and whether the storage is the built-in local filesystem. */
|
|
7
|
+
export declare function verdaccioConfigLines(config: ConfigYaml, configPath?: string, mask?: boolean): string[];
|
|
8
|
+
/**
|
|
9
|
+
* Local replacement for `envinfo` — the same environment report the CLI used to
|
|
10
|
+
* print, minus the browsers section, plus the configured plugins and storage.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getEnvInfo(mask?: boolean): Promise<string>;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.js");
|
|
2
|
+
let chalk = require("chalk");
|
|
3
|
+
chalk = require_runtime.__toESM(chalk);
|
|
4
|
+
let node_child_process = require("node:child_process");
|
|
5
|
+
let node_fs_promises = require("node:fs/promises");
|
|
6
|
+
node_fs_promises = require_runtime.__toESM(node_fs_promises);
|
|
7
|
+
let node_os = require("node:os");
|
|
8
|
+
node_os = require_runtime.__toESM(node_os);
|
|
9
|
+
let node_util = require("node:util");
|
|
10
|
+
let _verdaccio_config = require("@verdaccio/config");
|
|
11
|
+
//#region src/commands/env-info.ts
|
|
12
|
+
var run = (0, node_util.promisify)(node_child_process.execFile);
|
|
13
|
+
async function exec(cmd, args) {
|
|
14
|
+
try {
|
|
15
|
+
const { stdout } = await run(cmd, args, { timeout: 5e3 });
|
|
16
|
+
return stdout.trim();
|
|
17
|
+
} catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** Extract a `x.y.z` version out of a tool's `--version` output. */
|
|
22
|
+
function parseVersion(raw) {
|
|
23
|
+
const match = raw.match(/\d+\.\d+\.\d+[^\s,]*/);
|
|
24
|
+
return match ? match[0] : raw.replace(/^v/, "").trim();
|
|
25
|
+
}
|
|
26
|
+
/** Mask a path: keep the structure and the basename, replace each directory with `**`. */
|
|
27
|
+
function maskPath(target) {
|
|
28
|
+
const parts = target.split(/[/\\]/);
|
|
29
|
+
const last = parts.length - 1;
|
|
30
|
+
return parts.map((segment, i) => segment === "" || i === last ? segment : "**").join("/");
|
|
31
|
+
}
|
|
32
|
+
function which(bin) {
|
|
33
|
+
return exec("which", [bin]);
|
|
34
|
+
}
|
|
35
|
+
async function binary(label, bin, mask) {
|
|
36
|
+
const location = await which(bin);
|
|
37
|
+
if (location === null) return null;
|
|
38
|
+
const raw = await exec(bin, ["--version"]);
|
|
39
|
+
if (raw === null) return null;
|
|
40
|
+
return ` ${label}: ${parseVersion(raw)} - ${mask ? maskPath(location) : location}`;
|
|
41
|
+
}
|
|
42
|
+
async function osInfo() {
|
|
43
|
+
if (process.platform === "darwin") {
|
|
44
|
+
const name = await exec("sw_vers", ["-productName"]);
|
|
45
|
+
const version = await exec("sw_vers", ["-productVersion"]);
|
|
46
|
+
if (name && version) return `${name} ${version}`;
|
|
47
|
+
}
|
|
48
|
+
if (process.platform === "linux") try {
|
|
49
|
+
const match = (await node_fs_promises.default.readFile("/etc/os-release", "utf8")).match(/PRETTY_NAME="?([^"\n]+)/);
|
|
50
|
+
if (match) return match[1];
|
|
51
|
+
} catch {}
|
|
52
|
+
return `${process.platform} ${node_os.default.release()}`;
|
|
53
|
+
}
|
|
54
|
+
function cpuInfo() {
|
|
55
|
+
const cpus = node_os.default.cpus();
|
|
56
|
+
const model = cpus[0]?.model ?? "unknown";
|
|
57
|
+
return `(${cpus.length}) ${node_os.default.arch()} ${model}`;
|
|
58
|
+
}
|
|
59
|
+
async function globalVerdaccio() {
|
|
60
|
+
const raw = await exec("npm", [
|
|
61
|
+
"ls",
|
|
62
|
+
"-g",
|
|
63
|
+
"--depth=0",
|
|
64
|
+
"--json",
|
|
65
|
+
"verdaccio"
|
|
66
|
+
]);
|
|
67
|
+
if (raw === null) return null;
|
|
68
|
+
try {
|
|
69
|
+
const version = JSON.parse(raw)?.dependencies?.verdaccio?.version;
|
|
70
|
+
return version ? ` verdaccio: ${version}` : null;
|
|
71
|
+
} catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/** Configured plugins and whether the storage is the built-in local filesystem. */
|
|
76
|
+
function verdaccioConfigLines(config, configPath, mask = false) {
|
|
77
|
+
const lines = [" Verdaccio:"];
|
|
78
|
+
if (configPath) lines.push(` config: ${mask ? maskPath(configPath) : configPath}`);
|
|
79
|
+
const store = config.store ? Object.keys(config.store) : [];
|
|
80
|
+
lines.push(store.length === 0 ? ` storage: local filesystem${config.storage ? ` (${mask ? maskPath(config.storage) : config.storage})` : ""}` : ` storage: ${store.join(", ")} plugin`);
|
|
81
|
+
const auth = Object.keys(config.auth ?? {});
|
|
82
|
+
lines.push(` auth plugins: ${auth.length > 0 ? auth.join(", ") : "(none)"}`);
|
|
83
|
+
const middlewares = Object.keys(config.middlewares ?? {});
|
|
84
|
+
if (middlewares.length > 0) lines.push(` middleware plugins: ${middlewares.join(", ")}`);
|
|
85
|
+
const filters = Object.keys(config.filters ?? {});
|
|
86
|
+
if (filters.length > 0) lines.push(` filter plugins: ${filters.join(", ")}`);
|
|
87
|
+
return lines;
|
|
88
|
+
}
|
|
89
|
+
async function verdaccioInfo(mask) {
|
|
90
|
+
try {
|
|
91
|
+
const configPath = (0, _verdaccio_config.findExistingConfigFile)();
|
|
92
|
+
if (configPath === void 0) return [];
|
|
93
|
+
return verdaccioConfigLines((0, _verdaccio_config.getConfigParsed)(configPath), configPath, mask);
|
|
94
|
+
} catch {
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/** A one-line hint drawn in a box, used to point at the --mask option. */
|
|
99
|
+
function hintBox(text) {
|
|
100
|
+
const rule = "─".repeat(text.length + 2);
|
|
101
|
+
return chalk.default.cyan(`┌${rule}┐\n│ ${text} │\n└${rule}┘`);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Local replacement for `envinfo` — the same environment report the CLI used to
|
|
105
|
+
* print, minus the browsers section, plus the configured plugins and storage.
|
|
106
|
+
*/
|
|
107
|
+
async function getEnvInfo(mask = false) {
|
|
108
|
+
const lines = [
|
|
109
|
+
"",
|
|
110
|
+
"Environment Info:",
|
|
111
|
+
" System:"
|
|
112
|
+
];
|
|
113
|
+
lines.push(` OS: ${await osInfo()}`);
|
|
114
|
+
lines.push(` CPU: ${cpuInfo()}`);
|
|
115
|
+
if (process.platform !== "win32") {
|
|
116
|
+
const binaries = (await Promise.all([
|
|
117
|
+
binary("node", "node", mask),
|
|
118
|
+
binary("yarn", "yarn", mask),
|
|
119
|
+
binary("npm", "npm", mask),
|
|
120
|
+
binary("pnpm", "pnpm", mask)
|
|
121
|
+
])).filter((line) => line !== null);
|
|
122
|
+
if (binaries.length > 0) lines.push(" Binaries:", ...binaries);
|
|
123
|
+
const docker = await binary("Docker", "docker", mask);
|
|
124
|
+
if (docker) lines.push(" Virtualization:", docker);
|
|
125
|
+
const verdaccio = await globalVerdaccio();
|
|
126
|
+
if (verdaccio) lines.push(" npmGlobalPackages:", verdaccio);
|
|
127
|
+
}
|
|
128
|
+
lines.push(...await verdaccioInfo(mask));
|
|
129
|
+
let report = lines.join("\n") + "\n";
|
|
130
|
+
if (!mask) report += `\n${hintBox("tip: add --mask to obscure file paths (keeps the structure)")}\n`;
|
|
131
|
+
return report;
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
134
|
+
exports.getEnvInfo = getEnvInfo;
|
|
135
|
+
exports.maskPath = maskPath;
|
|
136
|
+
exports.parseVersion = parseVersion;
|
|
137
|
+
exports.verdaccioConfigLines = verdaccioConfigLines;
|
|
138
|
+
|
|
139
|
+
//# sourceMappingURL=env-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-info.js","names":[],"sources":["../../src/commands/env-info.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { execFile } from 'node:child_process';\nimport fs from 'node:fs/promises';\nimport os from 'node:os';\nimport { promisify } from 'node:util';\n\nimport { findExistingConfigFile, getConfigParsed } from '@verdaccio/config';\nimport type { ConfigYaml } from '@verdaccio/types';\n\nconst run = promisify(execFile);\n\nasync function exec(cmd: string, args: string[]): Promise<string | null> {\n try {\n const { stdout } = await run(cmd, args, { timeout: 5000 });\n return stdout.trim();\n } catch {\n return null;\n }\n}\n\n/** Extract a `x.y.z` version out of a tool's `--version` output. */\nexport function parseVersion(raw: string): string {\n const match = raw.match(/\\d+\\.\\d+\\.\\d+[^\\s,]*/);\n return match ? match[0] : raw.replace(/^v/, '').trim();\n}\n\n/** Mask a path: keep the structure and the basename, replace each directory with `**`. */\nexport function maskPath(target: string): string {\n const parts = target.split(/[/\\\\]/);\n const last = parts.length - 1;\n return parts.map((segment, i) => (segment === '' || i === last ? segment : '**')).join('/');\n}\n\nfunction which(bin: string): Promise<string | null> {\n return exec('which', [bin]);\n}\n\nasync function binary(label: string, bin: string, mask: boolean): Promise<string | null> {\n const location = await which(bin);\n if (location === null) {\n return null;\n }\n const raw = await exec(bin, ['--version']);\n if (raw === null) {\n return null;\n }\n const version = parseVersion(raw);\n return ` ${label}: ${version} - ${mask ? maskPath(location) : location}`;\n}\n\nasync function osInfo(): Promise<string> {\n if (process.platform === 'darwin') {\n const name = await exec('sw_vers', ['-productName']);\n const version = await exec('sw_vers', ['-productVersion']);\n if (name && version) {\n return `${name} ${version}`;\n }\n }\n if (process.platform === 'linux') {\n try {\n const release = await fs.readFile('/etc/os-release', 'utf8');\n const match = release.match(/PRETTY_NAME=\"?([^\"\\n]+)/);\n if (match) {\n return match[1];\n }\n } catch {\n // fall through to the generic label\n }\n }\n return `${process.platform} ${os.release()}`;\n}\n\nfunction cpuInfo(): string {\n const cpus = os.cpus();\n const model = cpus[0]?.model ?? 'unknown';\n return `(${cpus.length}) ${os.arch()} ${model}`;\n}\n\nasync function globalVerdaccio(): Promise<string | null> {\n const raw = await exec('npm', ['ls', '-g', '--depth=0', '--json', 'verdaccio']);\n if (raw === null) {\n return null;\n }\n try {\n const version = JSON.parse(raw)?.dependencies?.verdaccio?.version;\n return version ? ` verdaccio: ${version}` : null;\n } catch {\n return null;\n }\n}\n\n/** Configured plugins and whether the storage is the built-in local filesystem. */\nexport function verdaccioConfigLines(\n config: ConfigYaml,\n configPath?: string,\n mask = false\n): string[] {\n const lines = [' Verdaccio:'];\n if (configPath) {\n lines.push(` config: ${mask ? maskPath(configPath) : configPath}`);\n }\n const store = config.store ? Object.keys(config.store) : [];\n lines.push(\n store.length === 0\n ? ` storage: local filesystem${config.storage ? ` (${mask ? maskPath(config.storage) : config.storage})` : ''}`\n : ` storage: ${store.join(', ')} plugin`\n );\n const auth = Object.keys(config.auth ?? {});\n lines.push(` auth plugins: ${auth.length > 0 ? auth.join(', ') : '(none)'}`);\n const middlewares = Object.keys(config.middlewares ?? {});\n if (middlewares.length > 0) {\n lines.push(` middleware plugins: ${middlewares.join(', ')}`);\n }\n const filters = Object.keys(config.filters ?? {});\n if (filters.length > 0) {\n lines.push(` filter plugins: ${filters.join(', ')}`);\n }\n return lines;\n}\n\nasync function verdaccioInfo(mask: boolean): Promise<string[]> {\n try {\n // side-effect-free lookup: --info must never create a config file\n const configPath = findExistingConfigFile();\n if (configPath === undefined) {\n return [];\n }\n return verdaccioConfigLines(getConfigParsed(configPath), configPath, mask);\n } catch {\n return [];\n }\n}\n\n/** A one-line hint drawn in a box, used to point at the --mask option. */\nfunction hintBox(text: string): string {\n const rule = '─'.repeat(text.length + 2);\n return chalk.cyan(`┌${rule}┐\\n│ ${text} │\\n└${rule}┘`);\n}\n\n/**\n * Local replacement for `envinfo` — the same environment report the CLI used to\n * print, minus the browsers section, plus the configured plugins and storage.\n */\nexport async function getEnvInfo(mask = false): Promise<string> {\n const lines: string[] = ['', 'Environment Info:', ' System:'];\n lines.push(` OS: ${await osInfo()}`);\n lines.push(` CPU: ${cpuInfo()}`);\n\n // binary/version detection relies on `which` and unshimmed executables, which are\n // unreliable on Windows — skip it there rather than print broken or empty entries\n if (process.platform !== 'win32') {\n const binaries = (\n await Promise.all([\n binary('node', 'node', mask),\n binary('yarn', 'yarn', mask),\n binary('npm', 'npm', mask),\n binary('pnpm', 'pnpm', mask),\n ])\n ).filter((line): line is string => line !== null);\n if (binaries.length > 0) {\n lines.push(' Binaries:', ...binaries);\n }\n\n const docker = await binary('Docker', 'docker', mask);\n if (docker) {\n lines.push(' Virtualization:', docker);\n }\n\n const verdaccio = await globalVerdaccio();\n if (verdaccio) {\n lines.push(' npmGlobalPackages:', verdaccio);\n }\n }\n\n lines.push(...(await verdaccioInfo(mask)));\n\n let report = lines.join('\\n') + '\\n';\n if (!mask) {\n report += `\\n${hintBox('tip: add --mask to obscure file paths (keeps the structure)')}\\n`;\n }\n return report;\n}\n"],"mappings":";;;;;;;;;;;AASA,IAAM,OAAA,GAAM,UAAA,UAAA,CAAU,mBAAA,QAAQ;AAE9B,eAAe,KAAK,KAAa,MAAwC;CACvE,IAAI;EACF,MAAM,EAAE,WAAW,MAAM,IAAI,KAAK,MAAM,EAAE,SAAS,IAAK,CAAC;EACzD,OAAO,OAAO,KAAK;CACrB,QAAQ;EACN,OAAO;CACT;AACF;;AAGA,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";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
import { findExistingConfigFile, getConfigParsed } from "@verdaccio/config";
|
|
7
|
+
//#region src/commands/env-info.ts
|
|
8
|
+
var run = promisify(execFile);
|
|
9
|
+
async function exec(cmd, args) {
|
|
10
|
+
try {
|
|
11
|
+
const { stdout } = await run(cmd, args, { timeout: 5e3 });
|
|
12
|
+
return stdout.trim();
|
|
13
|
+
} catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** Extract a `x.y.z` version out of a tool's `--version` output. */
|
|
18
|
+
function parseVersion(raw) {
|
|
19
|
+
const match = raw.match(/\d+\.\d+\.\d+[^\s,]*/);
|
|
20
|
+
return match ? match[0] : raw.replace(/^v/, "").trim();
|
|
21
|
+
}
|
|
22
|
+
/** Mask a path: keep the structure and the basename, replace each directory with `**`. */
|
|
23
|
+
function maskPath(target) {
|
|
24
|
+
const parts = target.split(/[/\\]/);
|
|
25
|
+
const last = parts.length - 1;
|
|
26
|
+
return parts.map((segment, i) => segment === "" || i === last ? segment : "**").join("/");
|
|
27
|
+
}
|
|
28
|
+
function which(bin) {
|
|
29
|
+
return exec("which", [bin]);
|
|
30
|
+
}
|
|
31
|
+
async function binary(label, bin, mask) {
|
|
32
|
+
const location = await which(bin);
|
|
33
|
+
if (location === null) return null;
|
|
34
|
+
const raw = await exec(bin, ["--version"]);
|
|
35
|
+
if (raw === null) return null;
|
|
36
|
+
return ` ${label}: ${parseVersion(raw)} - ${mask ? maskPath(location) : location}`;
|
|
37
|
+
}
|
|
38
|
+
async function osInfo() {
|
|
39
|
+
if (process.platform === "darwin") {
|
|
40
|
+
const name = await exec("sw_vers", ["-productName"]);
|
|
41
|
+
const version = await exec("sw_vers", ["-productVersion"]);
|
|
42
|
+
if (name && version) return `${name} ${version}`;
|
|
43
|
+
}
|
|
44
|
+
if (process.platform === "linux") try {
|
|
45
|
+
const match = (await fs.readFile("/etc/os-release", "utf8")).match(/PRETTY_NAME="?([^"\n]+)/);
|
|
46
|
+
if (match) return match[1];
|
|
47
|
+
} catch {}
|
|
48
|
+
return `${process.platform} ${os.release()}`;
|
|
49
|
+
}
|
|
50
|
+
function cpuInfo() {
|
|
51
|
+
const cpus = os.cpus();
|
|
52
|
+
const model = cpus[0]?.model ?? "unknown";
|
|
53
|
+
return `(${cpus.length}) ${os.arch()} ${model}`;
|
|
54
|
+
}
|
|
55
|
+
async function globalVerdaccio() {
|
|
56
|
+
const raw = await exec("npm", [
|
|
57
|
+
"ls",
|
|
58
|
+
"-g",
|
|
59
|
+
"--depth=0",
|
|
60
|
+
"--json",
|
|
61
|
+
"verdaccio"
|
|
62
|
+
]);
|
|
63
|
+
if (raw === null) return null;
|
|
64
|
+
try {
|
|
65
|
+
const version = JSON.parse(raw)?.dependencies?.verdaccio?.version;
|
|
66
|
+
return version ? ` verdaccio: ${version}` : null;
|
|
67
|
+
} catch {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** Configured plugins and whether the storage is the built-in local filesystem. */
|
|
72
|
+
function verdaccioConfigLines(config, configPath, mask = false) {
|
|
73
|
+
const lines = [" Verdaccio:"];
|
|
74
|
+
if (configPath) lines.push(` config: ${mask ? maskPath(configPath) : configPath}`);
|
|
75
|
+
const store = config.store ? Object.keys(config.store) : [];
|
|
76
|
+
lines.push(store.length === 0 ? ` storage: local filesystem${config.storage ? ` (${mask ? maskPath(config.storage) : config.storage})` : ""}` : ` storage: ${store.join(", ")} plugin`);
|
|
77
|
+
const auth = Object.keys(config.auth ?? {});
|
|
78
|
+
lines.push(` auth plugins: ${auth.length > 0 ? auth.join(", ") : "(none)"}`);
|
|
79
|
+
const middlewares = Object.keys(config.middlewares ?? {});
|
|
80
|
+
if (middlewares.length > 0) lines.push(` middleware plugins: ${middlewares.join(", ")}`);
|
|
81
|
+
const filters = Object.keys(config.filters ?? {});
|
|
82
|
+
if (filters.length > 0) lines.push(` filter plugins: ${filters.join(", ")}`);
|
|
83
|
+
return lines;
|
|
84
|
+
}
|
|
85
|
+
async function verdaccioInfo(mask) {
|
|
86
|
+
try {
|
|
87
|
+
const configPath = findExistingConfigFile();
|
|
88
|
+
if (configPath === void 0) return [];
|
|
89
|
+
return verdaccioConfigLines(getConfigParsed(configPath), configPath, mask);
|
|
90
|
+
} catch {
|
|
91
|
+
return [];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/** A one-line hint drawn in a box, used to point at the --mask option. */
|
|
95
|
+
function hintBox(text) {
|
|
96
|
+
const rule = "─".repeat(text.length + 2);
|
|
97
|
+
return chalk.cyan(`┌${rule}┐\n│ ${text} │\n└${rule}┘`);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Local replacement for `envinfo` — the same environment report the CLI used to
|
|
101
|
+
* print, minus the browsers section, plus the configured plugins and storage.
|
|
102
|
+
*/
|
|
103
|
+
async function getEnvInfo(mask = false) {
|
|
104
|
+
const lines = [
|
|
105
|
+
"",
|
|
106
|
+
"Environment Info:",
|
|
107
|
+
" System:"
|
|
108
|
+
];
|
|
109
|
+
lines.push(` OS: ${await osInfo()}`);
|
|
110
|
+
lines.push(` CPU: ${cpuInfo()}`);
|
|
111
|
+
if (process.platform !== "win32") {
|
|
112
|
+
const binaries = (await Promise.all([
|
|
113
|
+
binary("node", "node", mask),
|
|
114
|
+
binary("yarn", "yarn", mask),
|
|
115
|
+
binary("npm", "npm", mask),
|
|
116
|
+
binary("pnpm", "pnpm", mask)
|
|
117
|
+
])).filter((line) => line !== null);
|
|
118
|
+
if (binaries.length > 0) lines.push(" Binaries:", ...binaries);
|
|
119
|
+
const docker = await binary("Docker", "docker", mask);
|
|
120
|
+
if (docker) lines.push(" Virtualization:", docker);
|
|
121
|
+
const verdaccio = await globalVerdaccio();
|
|
122
|
+
if (verdaccio) lines.push(" npmGlobalPackages:", verdaccio);
|
|
123
|
+
}
|
|
124
|
+
lines.push(...await verdaccioInfo(mask));
|
|
125
|
+
let report = lines.join("\n") + "\n";
|
|
126
|
+
if (!mask) report += `\n${hintBox("tip: add --mask to obscure file paths (keeps the structure)")}\n`;
|
|
127
|
+
return report;
|
|
128
|
+
}
|
|
129
|
+
//#endregion
|
|
130
|
+
export { getEnvInfo, maskPath, parseVersion, verdaccioConfigLines };
|
|
131
|
+
|
|
132
|
+
//# sourceMappingURL=env-info.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-info.mjs","names":[],"sources":["../../src/commands/env-info.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { execFile } from 'node:child_process';\nimport fs from 'node:fs/promises';\nimport os from 'node:os';\nimport { promisify } from 'node:util';\n\nimport { findExistingConfigFile, getConfigParsed } from '@verdaccio/config';\nimport type { ConfigYaml } from '@verdaccio/types';\n\nconst run = promisify(execFile);\n\nasync function exec(cmd: string, args: string[]): Promise<string | null> {\n try {\n const { stdout } = await run(cmd, args, { timeout: 5000 });\n return stdout.trim();\n } catch {\n return null;\n }\n}\n\n/** Extract a `x.y.z` version out of a tool's `--version` output. */\nexport function parseVersion(raw: string): string {\n const match = raw.match(/\\d+\\.\\d+\\.\\d+[^\\s,]*/);\n return match ? match[0] : raw.replace(/^v/, '').trim();\n}\n\n/** Mask a path: keep the structure and the basename, replace each directory with `**`. */\nexport function maskPath(target: string): string {\n const parts = target.split(/[/\\\\]/);\n const last = parts.length - 1;\n return parts.map((segment, i) => (segment === '' || i === last ? segment : '**')).join('/');\n}\n\nfunction which(bin: string): Promise<string | null> {\n return exec('which', [bin]);\n}\n\nasync function binary(label: string, bin: string, mask: boolean): Promise<string | null> {\n const location = await which(bin);\n if (location === null) {\n return null;\n }\n const raw = await exec(bin, ['--version']);\n if (raw === null) {\n return null;\n }\n const version = parseVersion(raw);\n return ` ${label}: ${version} - ${mask ? maskPath(location) : location}`;\n}\n\nasync function osInfo(): Promise<string> {\n if (process.platform === 'darwin') {\n const name = await exec('sw_vers', ['-productName']);\n const version = await exec('sw_vers', ['-productVersion']);\n if (name && version) {\n return `${name} ${version}`;\n }\n }\n if (process.platform === 'linux') {\n try {\n const release = await fs.readFile('/etc/os-release', 'utf8');\n const match = release.match(/PRETTY_NAME=\"?([^\"\\n]+)/);\n if (match) {\n return match[1];\n }\n } catch {\n // fall through to the generic label\n }\n }\n return `${process.platform} ${os.release()}`;\n}\n\nfunction cpuInfo(): string {\n const cpus = os.cpus();\n const model = cpus[0]?.model ?? 'unknown';\n return `(${cpus.length}) ${os.arch()} ${model}`;\n}\n\nasync function globalVerdaccio(): Promise<string | null> {\n const raw = await exec('npm', ['ls', '-g', '--depth=0', '--json', 'verdaccio']);\n if (raw === null) {\n return null;\n }\n try {\n const version = JSON.parse(raw)?.dependencies?.verdaccio?.version;\n return version ? ` verdaccio: ${version}` : null;\n } catch {\n return null;\n }\n}\n\n/** Configured plugins and whether the storage is the built-in local filesystem. */\nexport function verdaccioConfigLines(\n config: ConfigYaml,\n configPath?: string,\n mask = false\n): string[] {\n const lines = [' Verdaccio:'];\n if (configPath) {\n lines.push(` config: ${mask ? maskPath(configPath) : configPath}`);\n }\n const store = config.store ? Object.keys(config.store) : [];\n lines.push(\n store.length === 0\n ? ` storage: local filesystem${config.storage ? ` (${mask ? maskPath(config.storage) : config.storage})` : ''}`\n : ` storage: ${store.join(', ')} plugin`\n );\n const auth = Object.keys(config.auth ?? {});\n lines.push(` auth plugins: ${auth.length > 0 ? auth.join(', ') : '(none)'}`);\n const middlewares = Object.keys(config.middlewares ?? {});\n if (middlewares.length > 0) {\n lines.push(` middleware plugins: ${middlewares.join(', ')}`);\n }\n const filters = Object.keys(config.filters ?? {});\n if (filters.length > 0) {\n lines.push(` filter plugins: ${filters.join(', ')}`);\n }\n return lines;\n}\n\nasync function verdaccioInfo(mask: boolean): Promise<string[]> {\n try {\n // side-effect-free lookup: --info must never create a config file\n const configPath = findExistingConfigFile();\n if (configPath === undefined) {\n return [];\n }\n return verdaccioConfigLines(getConfigParsed(configPath), configPath, mask);\n } catch {\n return [];\n }\n}\n\n/** A one-line hint drawn in a box, used to point at the --mask option. */\nfunction hintBox(text: string): string {\n const rule = '─'.repeat(text.length + 2);\n return chalk.cyan(`┌${rule}┐\\n│ ${text} │\\n└${rule}┘`);\n}\n\n/**\n * Local replacement for `envinfo` — the same environment report the CLI used to\n * print, minus the browsers section, plus the configured plugins and storage.\n */\nexport async function getEnvInfo(mask = false): Promise<string> {\n const lines: string[] = ['', 'Environment Info:', ' System:'];\n lines.push(` OS: ${await osInfo()}`);\n lines.push(` CPU: ${cpuInfo()}`);\n\n // binary/version detection relies on `which` and unshimmed executables, which are\n // unreliable on Windows — skip it there rather than print broken or empty entries\n if (process.platform !== 'win32') {\n const binaries = (\n await Promise.all([\n binary('node', 'node', mask),\n binary('yarn', 'yarn', mask),\n binary('npm', 'npm', mask),\n binary('pnpm', 'pnpm', mask),\n ])\n ).filter((line): line is string => line !== null);\n if (binaries.length > 0) {\n lines.push(' Binaries:', ...binaries);\n }\n\n const docker = await binary('Docker', 'docker', mask);\n if (docker) {\n lines.push(' Virtualization:', docker);\n }\n\n const verdaccio = await globalVerdaccio();\n if (verdaccio) {\n lines.push(' npmGlobalPackages:', verdaccio);\n }\n }\n\n lines.push(...(await verdaccioInfo(mask)));\n\n let report = lines.join('\\n') + '\\n';\n if (!mask) {\n report += `\\n${hintBox('tip: add --mask to obscure file paths (keeps the structure)')}\\n`;\n }\n return report;\n}\n"],"mappings":";;;;;;;AASA,IAAM,MAAM,UAAU,QAAQ;AAE9B,eAAe,KAAK,KAAa,MAAwC;CACvE,IAAI;EACF,MAAM,EAAE,WAAW,MAAM,IAAI,KAAK,MAAM,EAAE,SAAS,IAAK,CAAC;EACzD,OAAO,OAAO,KAAK;CACrB,QAAQ;EACN,OAAO;CACT;AACF;;AAGA,SAAgB,aAAa,KAAqB;CAChD,MAAM,QAAQ,IAAI,MAAM,sBAAsB;CAC9C,OAAO,QAAQ,MAAM,KAAK,IAAI,QAAQ,MAAM,EAAE,CAAC,CAAC,KAAK;AACvD;;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C,OAAO,MAAM,KAAK,IAAI,KAAK,OAAO,KAAK,OAAO,KAAK,EAAE;AACvD;;;;;AAMA,eAAsB,WAAW,OAAO,OAAwB;CAC9D,MAAM,QAAkB;EAAC;EAAI;EAAqB;CAAW;CAC7D,MAAM,KAAK,WAAW,MAAM,OAAO,GAAG;CACtC,MAAM,KAAK,YAAY,QAAQ,GAAG;CAIlC,IAAI,QAAQ,aAAa,SAAS;EAChC,MAAM,YACJ,MAAM,QAAQ,IAAI;GAChB,OAAO,QAAQ,QAAQ,IAAI;GAC3B,OAAO,QAAQ,QAAQ,IAAI;GAC3B,OAAO,OAAO,OAAO,IAAI;GACzB,OAAO,QAAQ,QAAQ,IAAI;EAC7B,CAAC,EAAA,CACD,QAAQ,SAAyB,SAAS,IAAI;EAChD,IAAI,SAAS,SAAS,GACpB,MAAM,KAAK,eAAe,GAAG,QAAQ;EAGvC,MAAM,SAAS,MAAM,OAAO,UAAU,UAAU,IAAI;EACpD,IAAI,QACF,MAAM,KAAK,qBAAqB,MAAM;EAGxC,MAAM,YAAY,MAAM,gBAAgB;EACxC,IAAI,WACF,MAAM,KAAK,wBAAwB,SAAS;CAEhD;CAEA,MAAM,KAAK,GAAI,MAAM,cAAc,IAAI,CAAE;CAEzC,IAAI,SAAS,MAAM,KAAK,IAAI,IAAI;CAChC,IAAI,CAAC,MACH,UAAU,KAAK,QAAQ,6DAA6D,EAAE;CAExF,OAAO;AACT"}
|
package/build/commands/info.d.ts
CHANGED
package/build/commands/info.js
CHANGED
|
@@ -1,30 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_env_info = require("./env-info.js");
|
|
2
2
|
let clipanion = require("clipanion");
|
|
3
|
-
let envinfo = require("envinfo");
|
|
4
|
-
envinfo = require_runtime.__toESM(envinfo);
|
|
5
3
|
//#region src/commands/info.ts
|
|
6
4
|
var InfoCommand = class extends clipanion.Command {
|
|
7
5
|
static paths = [[`--info`], [`-i`]];
|
|
6
|
+
mask = clipanion.Option.Boolean(`--mask`, false, { description: `obscure file paths in the report (keeps the structure, hides the names)` });
|
|
8
7
|
async execute() {
|
|
9
|
-
this.context.stdout.write(
|
|
10
|
-
const data = await envinfo.default.run({
|
|
11
|
-
System: ["OS", "CPU"],
|
|
12
|
-
Binaries: [
|
|
13
|
-
"node",
|
|
14
|
-
"yarn",
|
|
15
|
-
"npm",
|
|
16
|
-
"pnpm"
|
|
17
|
-
],
|
|
18
|
-
Virtualization: ["Docker"],
|
|
19
|
-
Browsers: [
|
|
20
|
-
"Chrome",
|
|
21
|
-
"Edge",
|
|
22
|
-
"Firefox",
|
|
23
|
-
"Safari"
|
|
24
|
-
],
|
|
25
|
-
npmGlobalPackages: ["verdaccio"]
|
|
26
|
-
});
|
|
27
|
-
this.context.stdout.write(data);
|
|
8
|
+
this.context.stdout.write(await require_env_info.getEnvInfo(this.mask));
|
|
28
9
|
process.exit(0);
|
|
29
10
|
}
|
|
30
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info.js","names":[],"sources":["../../src/commands/info.ts"],"sourcesContent":["import { Command } from 'clipanion';\nimport
|
|
1
|
+
{"version":3,"file":"info.js","names":[],"sources":["../../src/commands/info.ts"],"sourcesContent":["import { Command, Option } from 'clipanion';\n\nimport { getEnvInfo } from './env-info';\n\nexport class InfoCommand extends Command {\n public static paths = [[`--info`], [`-i`]];\n\n public mask = Option.Boolean(`--mask`, false, {\n description: `obscure file paths in the report (keeps the structure, hides the names)`,\n });\n\n public async execute(): Promise<void> {\n this.context.stdout.write(await getEnvInfo(this.mask));\n process.exit(0);\n }\n}\n"],"mappings":";;;AAIA,IAAa,cAAb,cAAiC,UAAA,QAAQ;CACvC,OAAc,QAAQ,CAAC,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC;CAEzC,OAAc,UAAA,OAAO,QAAQ,UAAU,OAAO,EAC5C,aAAa,0EACf,CAAC;CAED,MAAa,UAAyB;EACpC,KAAK,QAAQ,OAAO,MAAM,MAAM,iBAAA,WAAW,KAAK,IAAI,CAAC;EACrD,QAAQ,KAAK,CAAC;CAChB;AACF"}
|
package/build/commands/info.mjs
CHANGED
|
@@ -1,28 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { getEnvInfo } from "./env-info.mjs";
|
|
2
|
+
import { Command, Option } from "clipanion";
|
|
3
3
|
//#region src/commands/info.ts
|
|
4
4
|
var InfoCommand = class extends Command {
|
|
5
5
|
static paths = [[`--info`], [`-i`]];
|
|
6
|
+
mask = Option.Boolean(`--mask`, false, { description: `obscure file paths in the report (keeps the structure, hides the names)` });
|
|
6
7
|
async execute() {
|
|
7
|
-
this.context.stdout.write(
|
|
8
|
-
const data = await envinfo.run({
|
|
9
|
-
System: ["OS", "CPU"],
|
|
10
|
-
Binaries: [
|
|
11
|
-
"node",
|
|
12
|
-
"yarn",
|
|
13
|
-
"npm",
|
|
14
|
-
"pnpm"
|
|
15
|
-
],
|
|
16
|
-
Virtualization: ["Docker"],
|
|
17
|
-
Browsers: [
|
|
18
|
-
"Chrome",
|
|
19
|
-
"Edge",
|
|
20
|
-
"Firefox",
|
|
21
|
-
"Safari"
|
|
22
|
-
],
|
|
23
|
-
npmGlobalPackages: ["verdaccio"]
|
|
24
|
-
});
|
|
25
|
-
this.context.stdout.write(data);
|
|
8
|
+
this.context.stdout.write(await getEnvInfo(this.mask));
|
|
26
9
|
process.exit(0);
|
|
27
10
|
}
|
|
28
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info.mjs","names":[],"sources":["../../src/commands/info.ts"],"sourcesContent":["import { Command } from 'clipanion';\nimport
|
|
1
|
+
{"version":3,"file":"info.mjs","names":[],"sources":["../../src/commands/info.ts"],"sourcesContent":["import { Command, Option } from 'clipanion';\n\nimport { getEnvInfo } from './env-info';\n\nexport class InfoCommand extends Command {\n public static paths = [[`--info`], [`-i`]];\n\n public mask = Option.Boolean(`--mask`, false, {\n description: `obscure file paths in the report (keeps the structure, hides the names)`,\n });\n\n public async execute(): Promise<void> {\n this.context.stdout.write(await getEnvInfo(this.mask));\n process.exit(0);\n }\n}\n"],"mappings":";;;AAIA,IAAa,cAAb,cAAiC,QAAQ;CACvC,OAAc,QAAQ,CAAC,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC;CAEzC,OAAc,OAAO,QAAQ,UAAU,OAAO,EAC5C,aAAa,0EACf,CAAC;CAED,MAAa,UAAyB;EACpC,KAAK,QAAQ,OAAO,MAAM,MAAM,WAAW,KAAK,IAAI,CAAC;EACrD,QAAQ,KAAK,CAAC;CAChB;AACF"}
|
package/build/commands/init.js
CHANGED
|
@@ -46,7 +46,7 @@ var InitCommand = class extends clipanion.Command {
|
|
|
46
46
|
_verdaccio_logger.logger.info({ file: configPathLocation }, "using config file: @{file}");
|
|
47
47
|
const { web } = configParsed;
|
|
48
48
|
process.title = web?.title || "verdaccio";
|
|
49
|
-
const currentDir =
|
|
49
|
+
const currentDir = __dirname;
|
|
50
50
|
const pkg = _verdaccio_core.pkgUtils.getPackageJson(currentDir, "../..");
|
|
51
51
|
const version = require_runtime.getVersionOverride() ?? pkg.version;
|
|
52
52
|
const name = require_runtime.getPkgNameOverride() ?? pkg.name;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","names":[],"sources":["../../src/commands/init.ts"],"sourcesContent":["import { Command, Option } from 'clipanion';\n\nimport { findConfigFile, parseConfigFile } from '@verdaccio/config';\nimport { pkgUtils, warningUtils } from '@verdaccio/core';\nimport { logger, setup } from '@verdaccio/logger';\nimport { initServer } from '@verdaccio/node-api';\nimport type { ConfigYaml, LoggerConfigItem } from '@verdaccio/types';\n\nimport { getPkgNameOverride, getStartServer, getVersionOverride } from '../runtime';\n\nexport const DEFAULT_PROCESS_NAME: string = 'verdaccio';\n\nexport class InitCommand extends Command {\n public static paths = [Command.Default];\n\n private port = Option.String('-l,-p,--listen,--port', {\n description: 'host:port number to listen on (default: localhost:4873)',\n });\n\n static usage = Command.Usage({\n description: `launch the server`,\n details: `\n This start the registry in the default port.\n\n When used without arguments, it:\n\n - bootstrap the server at the port \\`4873\\`\n\n The optional arguments are:\n\n - \\`-l | --listen | -p | --port\\` to switch the default server port,\n - \\`-c | --config\\` to define a different configuration path location,\n\n `,\n examples: [\n [`Runs the server with the default configuration`, `verdaccio`],\n [`Runs the server in the port 5000`, `verdaccio --listen 5000`],\n [\n `Runs the server by using a different absolute location of the configuration file`,\n `verdaccio --config /home/user/verdaccio/config.yaml`,\n ],\n ],\n });\n\n private config = Option.String('-c,--config', {\n description: 'use this configuration file (default: ./config.yaml)',\n });\n\n private async initLogger(logConfig: ConfigYaml) {\n if (logConfig.logs) {\n logConfig.log = logConfig.logs;\n warningUtils.emit(warningUtils.Codes.VERWAR002);\n }\n await setup(logConfig.log as LoggerConfigItem);\n }\n\n public async execute() {\n try {\n const configPathLocation = findConfigFile(this.config as string);\n const configParsed = parseConfigFile(configPathLocation);\n await this.initLogger(configParsed);\n logger.info({ file: configPathLocation }, 'using config file: @{file}');\n const { web } = configParsed;\n\n process.title = web?.title || DEFAULT_PROCESS_NAME;\n\n const currentDir =
|
|
1
|
+
{"version":3,"file":"init.js","names":[],"sources":["../../src/commands/init.ts"],"sourcesContent":["import { Command, Option } from 'clipanion';\n\nimport { findConfigFile, parseConfigFile } from '@verdaccio/config';\nimport { pkgUtils, warningUtils } from '@verdaccio/core';\nimport { logger, setup } from '@verdaccio/logger';\nimport { initServer } from '@verdaccio/node-api';\nimport type { ConfigYaml, LoggerConfigItem } from '@verdaccio/types';\n\nimport { getPkgNameOverride, getStartServer, getVersionOverride } from '../runtime';\n\nexport const DEFAULT_PROCESS_NAME: string = 'verdaccio';\n\nexport class InitCommand extends Command {\n public static paths = [Command.Default];\n\n private port = Option.String('-l,-p,--listen,--port', {\n description: 'host:port number to listen on (default: localhost:4873)',\n });\n\n static usage = Command.Usage({\n description: `launch the server`,\n details: `\n This start the registry in the default port.\n\n When used without arguments, it:\n\n - bootstrap the server at the port \\`4873\\`\n\n The optional arguments are:\n\n - \\`-l | --listen | -p | --port\\` to switch the default server port,\n - \\`-c | --config\\` to define a different configuration path location,\n\n `,\n examples: [\n [`Runs the server with the default configuration`, `verdaccio`],\n [`Runs the server in the port 5000`, `verdaccio --listen 5000`],\n [\n `Runs the server by using a different absolute location of the configuration file`,\n `verdaccio --config /home/user/verdaccio/config.yaml`,\n ],\n ],\n });\n\n private config = Option.String('-c,--config', {\n description: 'use this configuration file (default: ./config.yaml)',\n });\n\n private async initLogger(logConfig: ConfigYaml) {\n if (logConfig.logs) {\n logConfig.log = logConfig.logs;\n warningUtils.emit(warningUtils.Codes.VERWAR002);\n }\n await setup(logConfig.log as LoggerConfigItem);\n }\n\n public async execute() {\n try {\n const configPathLocation = findConfigFile(this.config as string);\n const configParsed = parseConfigFile(configPathLocation);\n await this.initLogger(configParsed);\n logger.info({ file: configPathLocation }, 'using config file: @{file}');\n const { web } = configParsed;\n\n process.title = web?.title || DEFAULT_PROCESS_NAME;\n\n const currentDir = import.meta.dirname;\n const pkg = pkgUtils.getPackageJson(currentDir, '../..');\n const version = getVersionOverride() ?? (pkg.version as string);\n const name = getPkgNameOverride() ?? (pkg.name as string);\n\n await initServer(\n configParsed,\n this.port as string,\n version as string,\n name as string,\n getStartServer()\n );\n\n const logLevel = configParsed.log?.level || 'default';\n logger.info({ logLevel }, 'log level: @{logLevel}');\n logger.info('server started');\n } catch (err: any) {\n console.error(err);\n process.exit(1);\n }\n }\n}\n"],"mappings":";;;;;;;AAUA,IAAa,uBAA+B;AAE5C,IAAa,cAAb,cAAiC,UAAA,QAAQ;CACvC,OAAc,QAAQ,CAAC,UAAA,QAAQ,OAAO;CAEtC,OAAe,UAAA,OAAO,OAAO,yBAAyB,EACpD,aAAa,0DACf,CAAC;CAED,OAAO,QAAQ,UAAA,QAAQ,MAAM;EAC3B,aAAa;EACb,SAAS;;;;;;;;;;;;;EAaT,UAAU;GACR,CAAC,kDAAkD,WAAW;GAC9D,CAAC,oCAAoC,yBAAyB;GAC9D,CACE,oFACA,qDACF;EACF;CACF,CAAC;CAED,SAAiB,UAAA,OAAO,OAAO,eAAe,EAC5C,aAAa,uDACf,CAAC;CAED,MAAc,WAAW,WAAuB;EAC9C,IAAI,UAAU,MAAM;GAClB,UAAU,MAAM,UAAU;GAC1B,gBAAA,aAAa,KAAK,gBAAA,aAAa,MAAM,SAAS;EAChD;EACA,OAAA,GAAM,kBAAA,MAAA,CAAM,UAAU,GAAuB;CAC/C;CAEA,MAAa,UAAU;EACrB,IAAI;GACF,MAAM,sBAAA,GAAqB,kBAAA,eAAA,CAAe,KAAK,MAAgB;GAC/D,MAAM,gBAAA,GAAe,kBAAA,gBAAA,CAAgB,kBAAkB;GACvD,MAAM,KAAK,WAAW,YAAY;GAClC,kBAAA,OAAO,KAAK,EAAE,MAAM,mBAAmB,GAAG,4BAA4B;GACtE,MAAM,EAAE,QAAQ;GAEhB,QAAQ,QAAQ,KAAK,SAAA;GAErB,MAAM,aAAA;GACN,MAAM,MAAM,gBAAA,SAAS,eAAe,YAAY,OAAO;GACvD,MAAM,UAAU,gBAAA,mBAAmB,KAAM,IAAI;GAC7C,MAAM,OAAO,gBAAA,mBAAmB,KAAM,IAAI;GAE1C,OAAA,GAAM,oBAAA,WAAA,CACJ,cACA,KAAK,MACL,SACA,MACA,gBAAA,eAAe,CACjB;GAEA,MAAM,WAAW,aAAa,KAAK,SAAS;GAC5C,kBAAA,OAAO,KAAK,EAAE,SAAS,GAAG,wBAAwB;GAClD,kBAAA,OAAO,KAAK,gBAAgB;EAC9B,SAAS,KAAU;GACjB,QAAQ,MAAM,GAAG;GACjB,QAAQ,KAAK,CAAC;EAChB;CACF;AACF"}
|
package/build/commands/init.mjs
CHANGED
|
@@ -46,7 +46,7 @@ var InitCommand = class extends Command {
|
|
|
46
46
|
logger.info({ file: configPathLocation }, "using config file: @{file}");
|
|
47
47
|
const { web } = configParsed;
|
|
48
48
|
process.title = web?.title || "verdaccio";
|
|
49
|
-
const currentDir =
|
|
49
|
+
const currentDir = import.meta.dirname;
|
|
50
50
|
const pkg = pkgUtils.getPackageJson(currentDir, "../..");
|
|
51
51
|
const version = getVersionOverride() ?? pkg.version;
|
|
52
52
|
const name = getPkgNameOverride() ?? pkg.name;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.mjs","names":[],"sources":["../../src/commands/init.ts"],"sourcesContent":["import { Command, Option } from 'clipanion';\n\nimport { findConfigFile, parseConfigFile } from '@verdaccio/config';\nimport { pkgUtils, warningUtils } from '@verdaccio/core';\nimport { logger, setup } from '@verdaccio/logger';\nimport { initServer } from '@verdaccio/node-api';\nimport type { ConfigYaml, LoggerConfigItem } from '@verdaccio/types';\n\nimport { getPkgNameOverride, getStartServer, getVersionOverride } from '../runtime';\n\nexport const DEFAULT_PROCESS_NAME: string = 'verdaccio';\n\nexport class InitCommand extends Command {\n public static paths = [Command.Default];\n\n private port = Option.String('-l,-p,--listen,--port', {\n description: 'host:port number to listen on (default: localhost:4873)',\n });\n\n static usage = Command.Usage({\n description: `launch the server`,\n details: `\n This start the registry in the default port.\n\n When used without arguments, it:\n\n - bootstrap the server at the port \\`4873\\`\n\n The optional arguments are:\n\n - \\`-l | --listen | -p | --port\\` to switch the default server port,\n - \\`-c | --config\\` to define a different configuration path location,\n\n `,\n examples: [\n [`Runs the server with the default configuration`, `verdaccio`],\n [`Runs the server in the port 5000`, `verdaccio --listen 5000`],\n [\n `Runs the server by using a different absolute location of the configuration file`,\n `verdaccio --config /home/user/verdaccio/config.yaml`,\n ],\n ],\n });\n\n private config = Option.String('-c,--config', {\n description: 'use this configuration file (default: ./config.yaml)',\n });\n\n private async initLogger(logConfig: ConfigYaml) {\n if (logConfig.logs) {\n logConfig.log = logConfig.logs;\n warningUtils.emit(warningUtils.Codes.VERWAR002);\n }\n await setup(logConfig.log as LoggerConfigItem);\n }\n\n public async execute() {\n try {\n const configPathLocation = findConfigFile(this.config as string);\n const configParsed = parseConfigFile(configPathLocation);\n await this.initLogger(configParsed);\n logger.info({ file: configPathLocation }, 'using config file: @{file}');\n const { web } = configParsed;\n\n process.title = web?.title || DEFAULT_PROCESS_NAME;\n\n const currentDir =
|
|
1
|
+
{"version":3,"file":"init.mjs","names":[],"sources":["../../src/commands/init.ts"],"sourcesContent":["import { Command, Option } from 'clipanion';\n\nimport { findConfigFile, parseConfigFile } from '@verdaccio/config';\nimport { pkgUtils, warningUtils } from '@verdaccio/core';\nimport { logger, setup } from '@verdaccio/logger';\nimport { initServer } from '@verdaccio/node-api';\nimport type { ConfigYaml, LoggerConfigItem } from '@verdaccio/types';\n\nimport { getPkgNameOverride, getStartServer, getVersionOverride } from '../runtime';\n\nexport const DEFAULT_PROCESS_NAME: string = 'verdaccio';\n\nexport class InitCommand extends Command {\n public static paths = [Command.Default];\n\n private port = Option.String('-l,-p,--listen,--port', {\n description: 'host:port number to listen on (default: localhost:4873)',\n });\n\n static usage = Command.Usage({\n description: `launch the server`,\n details: `\n This start the registry in the default port.\n\n When used without arguments, it:\n\n - bootstrap the server at the port \\`4873\\`\n\n The optional arguments are:\n\n - \\`-l | --listen | -p | --port\\` to switch the default server port,\n - \\`-c | --config\\` to define a different configuration path location,\n\n `,\n examples: [\n [`Runs the server with the default configuration`, `verdaccio`],\n [`Runs the server in the port 5000`, `verdaccio --listen 5000`],\n [\n `Runs the server by using a different absolute location of the configuration file`,\n `verdaccio --config /home/user/verdaccio/config.yaml`,\n ],\n ],\n });\n\n private config = Option.String('-c,--config', {\n description: 'use this configuration file (default: ./config.yaml)',\n });\n\n private async initLogger(logConfig: ConfigYaml) {\n if (logConfig.logs) {\n logConfig.log = logConfig.logs;\n warningUtils.emit(warningUtils.Codes.VERWAR002);\n }\n await setup(logConfig.log as LoggerConfigItem);\n }\n\n public async execute() {\n try {\n const configPathLocation = findConfigFile(this.config as string);\n const configParsed = parseConfigFile(configPathLocation);\n await this.initLogger(configParsed);\n logger.info({ file: configPathLocation }, 'using config file: @{file}');\n const { web } = configParsed;\n\n process.title = web?.title || DEFAULT_PROCESS_NAME;\n\n const currentDir = import.meta.dirname;\n const pkg = pkgUtils.getPackageJson(currentDir, '../..');\n const version = getVersionOverride() ?? (pkg.version as string);\n const name = getPkgNameOverride() ?? (pkg.name as string);\n\n await initServer(\n configParsed,\n this.port as string,\n version as string,\n name as string,\n getStartServer()\n );\n\n const logLevel = configParsed.log?.level || 'default';\n logger.info({ logLevel }, 'log level: @{logLevel}');\n logger.info('server started');\n } catch (err: any) {\n console.error(err);\n process.exit(1);\n }\n }\n}\n"],"mappings":";;;;;;;AAUA,IAAa,uBAA+B;AAE5C,IAAa,cAAb,cAAiC,QAAQ;CACvC,OAAc,QAAQ,CAAC,QAAQ,OAAO;CAEtC,OAAe,OAAO,OAAO,yBAAyB,EACpD,aAAa,0DACf,CAAC;CAED,OAAO,QAAQ,QAAQ,MAAM;EAC3B,aAAa;EACb,SAAS;;;;;;;;;;;;;EAaT,UAAU;GACR,CAAC,kDAAkD,WAAW;GAC9D,CAAC,oCAAoC,yBAAyB;GAC9D,CACE,oFACA,qDACF;EACF;CACF,CAAC;CAED,SAAiB,OAAO,OAAO,eAAe,EAC5C,aAAa,uDACf,CAAC;CAED,MAAc,WAAW,WAAuB;EAC9C,IAAI,UAAU,MAAM;GAClB,UAAU,MAAM,UAAU;GAC1B,aAAa,KAAK,aAAa,MAAM,SAAS;EAChD;EACA,MAAM,MAAM,UAAU,GAAuB;CAC/C;CAEA,MAAa,UAAU;EACrB,IAAI;GACF,MAAM,qBAAqB,eAAe,KAAK,MAAgB;GAC/D,MAAM,eAAe,gBAAgB,kBAAkB;GACvD,MAAM,KAAK,WAAW,YAAY;GAClC,OAAO,KAAK,EAAE,MAAM,mBAAmB,GAAG,4BAA4B;GACtE,MAAM,EAAE,QAAQ;GAEhB,QAAQ,QAAQ,KAAK,SAAA;GAErB,MAAM,aAAa,YAAY;GAC/B,MAAM,MAAM,SAAS,eAAe,YAAY,OAAO;GACvD,MAAM,UAAU,mBAAmB,KAAM,IAAI;GAC7C,MAAM,OAAO,mBAAmB,KAAM,IAAI;GAE1C,MAAM,WACJ,cACA,KAAK,MACL,SACA,MACA,eAAe,CACjB;GAEA,MAAM,WAAW,aAAa,KAAK,SAAS;GAC5C,OAAO,KAAK,EAAE,SAAS,GAAG,wBAAwB;GAClD,OAAO,KAAK,gBAAgB;EAC9B,SAAS,KAAU;GACjB,QAAQ,MAAM,GAAG;GACjB,QAAQ,KAAK,CAAC;EAChB;CACF;AACF"}
|
|
@@ -5,7 +5,7 @@ let _verdaccio_core = require("@verdaccio/core");
|
|
|
5
5
|
var VersionCommand = class extends clipanion.Command {
|
|
6
6
|
static paths = [[`--version`], [`-v`]];
|
|
7
7
|
async execute() {
|
|
8
|
-
const currentDir =
|
|
8
|
+
const currentDir = __dirname;
|
|
9
9
|
const version = require_runtime.getVersionOverride() ?? _verdaccio_core.pkgUtils.getPackageJson(currentDir, "../..").version;
|
|
10
10
|
this.context.stdout.write(`v${version}\n`);
|
|
11
11
|
process.exit(0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","names":[],"sources":["../../src/commands/version.ts"],"sourcesContent":["import { Command } from 'clipanion';\n\nimport { pkgUtils } from '@verdaccio/core';\n\nimport { getVersionOverride } from '../runtime';\n\nexport class VersionCommand extends Command {\n static paths = [[`--version`], [`-v`]];\n\n async execute() {\n const currentDir =
|
|
1
|
+
{"version":3,"file":"version.js","names":[],"sources":["../../src/commands/version.ts"],"sourcesContent":["import { Command } from 'clipanion';\n\nimport { pkgUtils } from '@verdaccio/core';\n\nimport { getVersionOverride } from '../runtime';\n\nexport class VersionCommand extends Command {\n static paths = [[`--version`], [`-v`]];\n\n async execute() {\n const currentDir = import.meta.dirname;\n const version = getVersionOverride() ?? pkgUtils.getPackageJson(currentDir, '../..').version;\n this.context.stdout.write(`v${version}\\n`);\n process.exit(0);\n }\n}\n"],"mappings":";;;;AAMA,IAAa,iBAAb,cAAoC,UAAA,QAAQ;CAC1C,OAAO,QAAQ,CAAC,CAAC,WAAW,GAAG,CAAC,IAAI,CAAC;CAErC,MAAM,UAAU;EACd,MAAM,aAAA;EACN,MAAM,UAAU,gBAAA,mBAAmB,KAAK,gBAAA,SAAS,eAAe,YAAY,OAAO,CAAC,CAAC;EACrF,KAAK,QAAQ,OAAO,MAAM,IAAI,QAAQ,GAAG;EACzC,QAAQ,KAAK,CAAC;CAChB;AACF"}
|
|
@@ -5,7 +5,7 @@ import { pkgUtils } from "@verdaccio/core";
|
|
|
5
5
|
var VersionCommand = class extends Command {
|
|
6
6
|
static paths = [[`--version`], [`-v`]];
|
|
7
7
|
async execute() {
|
|
8
|
-
const currentDir =
|
|
8
|
+
const currentDir = import.meta.dirname;
|
|
9
9
|
const version = getVersionOverride() ?? pkgUtils.getPackageJson(currentDir, "../..").version;
|
|
10
10
|
this.context.stdout.write(`v${version}\n`);
|
|
11
11
|
process.exit(0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.mjs","names":[],"sources":["../../src/commands/version.ts"],"sourcesContent":["import { Command } from 'clipanion';\n\nimport { pkgUtils } from '@verdaccio/core';\n\nimport { getVersionOverride } from '../runtime';\n\nexport class VersionCommand extends Command {\n static paths = [[`--version`], [`-v`]];\n\n async execute() {\n const currentDir =
|
|
1
|
+
{"version":3,"file":"version.mjs","names":[],"sources":["../../src/commands/version.ts"],"sourcesContent":["import { Command } from 'clipanion';\n\nimport { pkgUtils } from '@verdaccio/core';\n\nimport { getVersionOverride } from '../runtime';\n\nexport class VersionCommand extends Command {\n static paths = [[`--version`], [`-v`]];\n\n async execute() {\n const currentDir = import.meta.dirname;\n const version = getVersionOverride() ?? pkgUtils.getPackageJson(currentDir, '../..').version;\n this.context.stdout.write(`v${version}\\n`);\n process.exit(0);\n }\n}\n"],"mappings":";;;;AAMA,IAAa,iBAAb,cAAoC,QAAQ;CAC1C,OAAO,QAAQ,CAAC,CAAC,WAAW,GAAG,CAAC,IAAI,CAAC;CAErC,MAAM,UAAU;EACd,MAAM,aAAa,YAAY;EAC/B,MAAM,UAAU,mBAAmB,KAAK,SAAS,eAAe,YAAY,OAAO,CAAC,CAAC;EACrF,KAAK,QAAQ,OAAO,MAAM,IAAI,QAAQ,GAAG;EACzC,QAAQ,KAAK,CAAC;CAChB;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/cli",
|
|
3
|
-
"version": "9.0.0-next-9.
|
|
3
|
+
"version": "9.0.0-next-9.33",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Juan Picado",
|
|
6
6
|
"email": "juanpicado19@gmail.com"
|
|
@@ -37,21 +37,21 @@
|
|
|
37
37
|
"main": "./build/index.js",
|
|
38
38
|
"types": "build/index.d.ts",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@verdaccio/config": "9.0.0-next-9.
|
|
41
|
-
"@verdaccio/core": "9.0.0-next-9.
|
|
42
|
-
"@verdaccio/logger": "9.0.0-next-9.
|
|
43
|
-
"@verdaccio/node-api": "9.0.0-next-9.
|
|
44
|
-
"@verdaccio/server": "9.0.0-next-9.
|
|
40
|
+
"@verdaccio/config": "9.0.0-next-9.33",
|
|
41
|
+
"@verdaccio/core": "9.0.0-next-9.33",
|
|
42
|
+
"@verdaccio/logger": "9.0.0-next-9.33",
|
|
43
|
+
"@verdaccio/node-api": "9.0.0-next-9.33",
|
|
44
|
+
"@verdaccio/server": "9.0.0-next-9.33",
|
|
45
|
+
"chalk": "4.1.2",
|
|
45
46
|
"clipanion": "4.0.0-rc.4",
|
|
46
|
-
"envinfo": "7.19.0",
|
|
47
47
|
"semver": "7.8.5"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@verdaccio/types": "14.0.0-next-9.
|
|
50
|
+
"@verdaccio/types": "14.0.0-next-9.16",
|
|
51
51
|
"rimraf": "6.1.3",
|
|
52
52
|
"tsx": "4.22.4",
|
|
53
53
|
"vite": "8.2.2",
|
|
54
|
-
"vitest": "4.1.
|
|
54
|
+
"vitest": "4.1.11"
|
|
55
55
|
},
|
|
56
56
|
"funding": {
|
|
57
57
|
"type": "opencollective",
|