@verdaccio/cli 8.0.0-next-8.12 → 8.0.0-next-8.13
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/README.md +30 -24
- package/package.json +11 -7
- package/.babelrc +0 -3
- package/.eslintrc +0 -5
- package/CHANGELOG.md +0 -1600
- package/src/.eslintrc +0 -6
- package/src/cli.ts +0 -40
- package/src/commands/info.ts +0 -20
- package/src/commands/init.ts +0 -78
- package/src/commands/version.ts +0 -12
- package/src/index.ts +0 -1
- package/src/utils.ts +0 -8
- package/test/cli-test.spec.ts +0 -5
- package/test/utils.spec.ts +0 -20
- package/tsconfig.build.json +0 -10
- package/tsconfig.json +0 -23
package/src/cli.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Cli } from 'clipanion';
|
|
2
|
-
|
|
3
|
-
import { warningUtils } from '@verdaccio/core';
|
|
4
|
-
|
|
5
|
-
import { InfoCommand } from './commands/info';
|
|
6
|
-
import { InitCommand } from './commands/init';
|
|
7
|
-
import { VersionCommand } from './commands/version';
|
|
8
|
-
import { MIN_NODE_VERSION, isVersionValid } from './utils';
|
|
9
|
-
|
|
10
|
-
if (process.getuid && process.getuid() === 0) {
|
|
11
|
-
warningUtils.emit(warningUtils.Codes.VERWAR001);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (!isVersionValid(process.version)) {
|
|
15
|
-
throw new Error(
|
|
16
|
-
`Verdaccio requires at least Node.js v${MIN_NODE_VERSION} or higher and you have installed ${process.version},
|
|
17
|
-
please upgrade your Node.js distribution`
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const [node, app, ...args] = process.argv;
|
|
22
|
-
|
|
23
|
-
const cli = new Cli({
|
|
24
|
-
binaryLabel: `verdaccio`,
|
|
25
|
-
binaryName: `${node} ${app}`,
|
|
26
|
-
binaryVersion: require('../package.json').version,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
cli.register(InfoCommand);
|
|
30
|
-
cli.register(InitCommand);
|
|
31
|
-
cli.register(VersionCommand);
|
|
32
|
-
cli.runExit(args, Cli.defaultContext);
|
|
33
|
-
|
|
34
|
-
process.on('uncaughtException', function (err) {
|
|
35
|
-
console.error(
|
|
36
|
-
// eslint-disable-next-line max-len
|
|
37
|
-
`uncaught exception, please report (https://github.com/verdaccio/verdaccio/issues) this: \n${err.stack}`
|
|
38
|
-
);
|
|
39
|
-
process.exit(1);
|
|
40
|
-
});
|
package/src/commands/info.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Command } from 'clipanion';
|
|
2
|
-
import envinfo from 'envinfo';
|
|
3
|
-
|
|
4
|
-
export class InfoCommand extends Command {
|
|
5
|
-
public static paths = [[`--info`], [`-i`]];
|
|
6
|
-
|
|
7
|
-
public async execute(): Promise<void> {
|
|
8
|
-
this.context.stdout.write('\nEnvironment Info:');
|
|
9
|
-
const data = await envinfo.run({
|
|
10
|
-
System: ['OS', 'CPU'],
|
|
11
|
-
Binaries: ['node', 'yarn', 'npm', 'pnpm'],
|
|
12
|
-
Virtualization: ['Docker'],
|
|
13
|
-
Browsers: ['Chrome', 'Edge', 'Firefox', 'Safari'],
|
|
14
|
-
npmGlobalPackages: ['verdaccio'],
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
this.context.stdout.write(data);
|
|
18
|
-
process.exit(0);
|
|
19
|
-
}
|
|
20
|
-
}
|
package/src/commands/init.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { Command, Option } from 'clipanion';
|
|
2
|
-
|
|
3
|
-
import { findConfigFile, parseConfigFile } from '@verdaccio/config';
|
|
4
|
-
import { warningUtils } from '@verdaccio/core';
|
|
5
|
-
import { logger, setup } from '@verdaccio/logger';
|
|
6
|
-
import { initServer } from '@verdaccio/node-api';
|
|
7
|
-
import { ConfigYaml, LoggerConfigItem } from '@verdaccio/types';
|
|
8
|
-
|
|
9
|
-
export const DEFAULT_PROCESS_NAME: string = 'verdaccio';
|
|
10
|
-
|
|
11
|
-
export class InitCommand extends Command {
|
|
12
|
-
public static paths = [Command.Default];
|
|
13
|
-
|
|
14
|
-
private port = Option.String('-l,-p,--listen,--port', {
|
|
15
|
-
description: 'host:port number to listen on (default: localhost:4873)',
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// eslint-disable-next-line
|
|
19
|
-
static usage = Command.Usage({
|
|
20
|
-
description: `launch the server`,
|
|
21
|
-
details: `
|
|
22
|
-
This start the registry in the default port.
|
|
23
|
-
|
|
24
|
-
When used without arguments, it:
|
|
25
|
-
|
|
26
|
-
- bootstrap the server at the port \`4873\`
|
|
27
|
-
|
|
28
|
-
The optional arguments are:
|
|
29
|
-
|
|
30
|
-
- \`-l | --listen | -p | --port\` to switch the default server port,
|
|
31
|
-
- \`-c | --config\` to define a different configuration path location,
|
|
32
|
-
|
|
33
|
-
`,
|
|
34
|
-
examples: [
|
|
35
|
-
[`Runs the server with the default configuration`, `verdaccio`],
|
|
36
|
-
[`Runs the server in the port 5000`, `verdaccio --listen 5000`],
|
|
37
|
-
[
|
|
38
|
-
`Runs the server by using a different absolute location of the configuration file`,
|
|
39
|
-
`verdaccio --config /home/user/verdaccio/config.yaml`,
|
|
40
|
-
],
|
|
41
|
-
],
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
private config = Option.String('-c,--config', {
|
|
45
|
-
description: 'use this configuration file (default: ./config.yaml)',
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
private initLogger(logConfig: ConfigYaml) {
|
|
49
|
-
if (logConfig.logs) {
|
|
50
|
-
logConfig.log = logConfig.logs;
|
|
51
|
-
warningUtils.emit(warningUtils.Codes.VERWAR002);
|
|
52
|
-
}
|
|
53
|
-
setup(logConfig.log as LoggerConfigItem);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
public async execute() {
|
|
57
|
-
try {
|
|
58
|
-
const configPathLocation = findConfigFile(this.config as string);
|
|
59
|
-
const configParsed = parseConfigFile(configPathLocation);
|
|
60
|
-
this.initLogger(configParsed);
|
|
61
|
-
logger.info({ file: configPathLocation }, 'using config file: @{file}');
|
|
62
|
-
const { web } = configParsed;
|
|
63
|
-
|
|
64
|
-
process.title = web?.title || DEFAULT_PROCESS_NAME;
|
|
65
|
-
|
|
66
|
-
const { version, name } = require('../../package.json');
|
|
67
|
-
|
|
68
|
-
await initServer(configParsed, this.port as string, version, name);
|
|
69
|
-
|
|
70
|
-
const logLevel = configParsed.log?.level || 'default';
|
|
71
|
-
logger.info({ logLevel }, 'log level: @{logLevel}');
|
|
72
|
-
logger.info('server started');
|
|
73
|
-
} catch (err: any) {
|
|
74
|
-
console.error(err);
|
|
75
|
-
process.exit(1);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
package/src/commands/version.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/explicit-member-accessibility */
|
|
2
|
-
import { Command } from 'clipanion';
|
|
3
|
-
|
|
4
|
-
export class VersionCommand extends Command {
|
|
5
|
-
static paths = [[`--version`], [`-v`]];
|
|
6
|
-
|
|
7
|
-
async execute() {
|
|
8
|
-
const version = require('../../package.json').version;
|
|
9
|
-
this.context.stdout.write(`v${version}\n`);
|
|
10
|
-
process.exit(0);
|
|
11
|
-
}
|
|
12
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require('./cli');
|
package/src/utils.ts
DELETED
package/test/cli-test.spec.ts
DELETED
package/test/utils.spec.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'vitest';
|
|
2
|
-
|
|
3
|
-
import { isVersionValid } from '../src/utils';
|
|
4
|
-
|
|
5
|
-
describe('utils', () => {
|
|
6
|
-
test('valid version node.js', () => {
|
|
7
|
-
expect(isVersionValid('v14.0.0')).toBeTruthy();
|
|
8
|
-
expect(isVersionValid('v15.0.0')).toBeTruthy();
|
|
9
|
-
expect(isVersionValid('v16.0.0')).toBeTruthy();
|
|
10
|
-
expect(isVersionValid('v17.0.0')).toBeTruthy();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
test('is invalid version node.js', () => {
|
|
14
|
-
expect(isVersionValid('v13.0.0')).toBeFalsy();
|
|
15
|
-
expect(isVersionValid('v12.0.0')).toBeFalsy();
|
|
16
|
-
expect(isVersionValid('v8.0.0')).toBeFalsy();
|
|
17
|
-
expect(isVersionValid('v4.0.0')).toBeFalsy();
|
|
18
|
-
expect(isVersionValid('v0.0.10')).toBeFalsy();
|
|
19
|
-
});
|
|
20
|
-
});
|
package/tsconfig.build.json
DELETED
package/tsconfig.json
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.reference.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"rootDir": "./src",
|
|
5
|
-
"outDir": "./build"
|
|
6
|
-
},
|
|
7
|
-
"include": ["src/**/*"],
|
|
8
|
-
"exclude": ["src/**/*.test.ts"],
|
|
9
|
-
"references": [
|
|
10
|
-
{
|
|
11
|
-
"path": "../config"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"path": "../core/core"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"path": "../node-api"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"path": "../logger/logger"
|
|
21
|
-
}
|
|
22
|
-
]
|
|
23
|
-
}
|