@verdaccio/cli 6.0.0-6-next.22 → 6.0.0-6-next.26
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/CHANGELOG.md +60 -0
- package/build/cli.js +6 -4
- package/build/cli.js.map +1 -1
- package/build/commands/{newServer.d.ts → FastifyServer.d.ts} +4 -1
- package/build/commands/{newServer.js → FastifyServer.js} +17 -10
- package/build/commands/FastifyServer.js.map +1 -0
- package/build/commands/info.js +2 -2
- package/build/commands/info.js.map +1 -1
- package/build/commands/init.js +3 -1
- package/build/commands/init.js.map +1 -1
- package/build/utils.d.ts +2 -2
- package/build/utils.js +4 -3
- package/build/utils.js.map +1 -1
- package/package.json +8 -7
- package/src/cli.ts +6 -4
- package/src/commands/{newServer.ts → FastifyServer.ts} +12 -5
- package/src/commands/info.ts +1 -1
- package/src/commands/init.ts +4 -4
- package/src/utils.ts +3 -2
- package/test/utils.spec.ts +9 -2
- package/tsconfig.json +3 -0
- package/build/commands/newServer.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,65 @@
|
|
|
1
1
|
# @verdaccio/cli
|
|
2
2
|
|
|
3
|
+
## 6.0.0-6-next.26
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [a828271d]
|
|
8
|
+
- Updated dependencies [24b9be02]
|
|
9
|
+
- Updated dependencies [e75c0a3b]
|
|
10
|
+
- @verdaccio/fastify-migration@6.0.0-6-next.17
|
|
11
|
+
- @verdaccio/core@6.0.0-6-next.4
|
|
12
|
+
- @verdaccio/logger@6.0.0-6-next.8
|
|
13
|
+
- @verdaccio/node-api@6.0.0-6-next.25
|
|
14
|
+
- @verdaccio/config@6.0.0-6-next.12
|
|
15
|
+
|
|
16
|
+
## 6.0.0-6-next.25
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [f86c31ed]
|
|
21
|
+
- Updated dependencies [20c9e43e]
|
|
22
|
+
- @verdaccio/fastify-migration@6.0.0-6-next.16
|
|
23
|
+
- @verdaccio/config@6.0.0-6-next.11
|
|
24
|
+
- @verdaccio/node-api@6.0.0-6-next.24
|
|
25
|
+
|
|
26
|
+
## 6.0.0-6-next.24
|
|
27
|
+
|
|
28
|
+
### Minor Changes
|
|
29
|
+
|
|
30
|
+
- 6c1eb021: feat: use warning codes for deprecation warnings
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- Updated dependencies [6c1eb021]
|
|
35
|
+
- @verdaccio/core@6.0.0-6-next.3
|
|
36
|
+
- @verdaccio/logger@6.0.0-6-next.7
|
|
37
|
+
- @verdaccio/node-api@6.0.0-6-next.23
|
|
38
|
+
- @verdaccio/config@6.0.0-6-next.10
|
|
39
|
+
- @verdaccio/fastify-migration@6.0.0-6-next.15
|
|
40
|
+
|
|
41
|
+
## 6.0.0-6-next.23
|
|
42
|
+
|
|
43
|
+
### Major Changes
|
|
44
|
+
|
|
45
|
+
- 794af76c: Remove Node 12 support
|
|
46
|
+
|
|
47
|
+
- We need move to the new `undici` and does not support Node.js 12
|
|
48
|
+
|
|
49
|
+
### Minor Changes
|
|
50
|
+
|
|
51
|
+
- 154b2ecd: refactor: remove @verdaccio/commons-api in favor @verdaccio/core and remove duplications
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- Updated dependencies [794af76c]
|
|
56
|
+
- Updated dependencies [b702ea36]
|
|
57
|
+
- Updated dependencies [154b2ecd]
|
|
58
|
+
- @verdaccio/config@6.0.0-6-next.9
|
|
59
|
+
- @verdaccio/fastify-migration@6.0.0-6-next.14
|
|
60
|
+
- @verdaccio/logger@6.0.0-6-next.6
|
|
61
|
+
- @verdaccio/node-api@6.0.0-6-next.22
|
|
62
|
+
|
|
3
63
|
## 6.0.0-6-next.22
|
|
4
64
|
|
|
5
65
|
### Patch Changes
|
package/build/cli.js
CHANGED
|
@@ -2,18 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
var _clipanion = require("clipanion");
|
|
4
4
|
|
|
5
|
+
var _core = require("@verdaccio/core");
|
|
6
|
+
|
|
7
|
+
var _FastifyServer = require("./commands/FastifyServer");
|
|
8
|
+
|
|
5
9
|
var _info = require("./commands/info");
|
|
6
10
|
|
|
7
11
|
var _init = require("./commands/init");
|
|
8
12
|
|
|
9
13
|
var _version = require("./commands/version");
|
|
10
14
|
|
|
11
|
-
var _newServer = require("./commands/newServer");
|
|
12
|
-
|
|
13
15
|
var _utils = require("./utils");
|
|
14
16
|
|
|
15
17
|
if (process.getuid && process.getuid() === 0) {
|
|
16
|
-
|
|
18
|
+
_core.warningUtils.emit(_core.warningUtils.Codes.VERWAR001);
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
if (!(0, _utils.isVersionValid)(process.version)) {
|
|
@@ -30,7 +32,7 @@ const cli = new _clipanion.Cli({
|
|
|
30
32
|
cli.register(_info.InfoCommand);
|
|
31
33
|
cli.register(_init.InitCommand);
|
|
32
34
|
cli.register(_version.VersionCommand);
|
|
33
|
-
cli.register(
|
|
35
|
+
cli.register(_FastifyServer.FastifyServer);
|
|
34
36
|
cli.runExit(args, _clipanion.Cli.defaultContext);
|
|
35
37
|
process.on('uncaughtException', function (err) {
|
|
36
38
|
console.error( // eslint-disable-next-line max-len
|
package/build/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli.ts"],"names":["process","getuid","
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts"],"names":["process","getuid","warningUtils","emit","Codes","VERWAR001","version","Error","MIN_NODE_VERSION","node","app","args","argv","cli","Cli","binaryLabel","binaryName","binaryVersion","require","register","InfoCommand","InitCommand","VersionCommand","FastifyServer","runExit","defaultContext","on","err","console","error","stack","exit"],"mappings":";;AAAA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAIA,OAAO,CAACC,MAAR,IAAkBD,OAAO,CAACC,MAAR,OAAqB,CAA3C,EAA8C;AAC5CC,qBAAaC,IAAb,CAAkBD,mBAAaE,KAAb,CAAmBC,SAArC;AACD;;AAED,IAAI,CAAC,2BAAeL,OAAO,CAACM,OAAvB,CAAL,EAAsC;AACpC,QAAM,IAAIC,KAAJ,CACH,wCAAuCC,uBAAiB,qCAAoCR,OAAO,CAACM,OAAQ;AACjH,6CAFQ,CAAN;AAID;;AAED,MAAM,CAACG,IAAD,EAAOC,GAAP,EAAY,GAAGC,IAAf,IAAuBX,OAAO,CAACY,IAArC;AAEA,MAAMC,GAAG,GAAG,IAAIC,cAAJ,CAAQ;AAClBC,EAAAA,WAAW,EAAG,WADI;AAElBC,EAAAA,UAAU,EAAG,GAAEP,IAAK,IAAGC,GAAI,EAFT;AAGlBO,EAAAA,aAAa,EAAEC,OAAO,CAAC,iBAAD,CAAP,CAA2BZ;AAHxB,CAAR,CAAZ;AAMAO,GAAG,CAACM,QAAJ,CAAaC,iBAAb;AACAP,GAAG,CAACM,QAAJ,CAAaE,iBAAb;AACAR,GAAG,CAACM,QAAJ,CAAaG,uBAAb;AACAT,GAAG,CAACM,QAAJ,CAAaI,4BAAb;AACAV,GAAG,CAACW,OAAJ,CAAYb,IAAZ,EAAkBG,eAAIW,cAAtB;AAEAzB,OAAO,CAAC0B,EAAR,CAAW,mBAAX,EAAgC,UAAUC,GAAV,EAAe;AAC7CC,EAAAA,OAAO,CAACC,KAAR,EACE;AACC,+FAA4FF,GAAG,CAACG,KAAM,EAFzG;AAIA9B,EAAAA,OAAO,CAAC+B,IAAR,CAAa,CAAb;AACD,CAND","sourcesContent":["import { Cli } from 'clipanion';\n\nimport { warningUtils } from '@verdaccio/core';\n\nimport { FastifyServer } from './commands/FastifyServer';\nimport { InfoCommand } from './commands/info';\nimport { InitCommand } from './commands/init';\nimport { VersionCommand } from './commands/version';\nimport { MIN_NODE_VERSION, isVersionValid } from './utils';\n\nif (process.getuid && process.getuid() === 0) {\n warningUtils.emit(warningUtils.Codes.VERWAR001);\n}\n\nif (!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\nconst [node, app, ...args] = process.argv;\n\nconst cli = new Cli({\n binaryLabel: `verdaccio`,\n binaryName: `${node} ${app}`,\n binaryVersion: require('../package.json').version,\n});\n\ncli.register(InfoCommand);\ncli.register(InitCommand);\ncli.register(VersionCommand);\ncli.register(FastifyServer);\ncli.runExit(args, Cli.defaultContext);\n\nprocess.on('uncaughtException', function (err) {\n console.error(\n // eslint-disable-next-line max-len\n `uncaught exception, please report (https://github.com/verdaccio/verdaccio/issues) this: \\n${err.stack}`\n );\n process.exit(1);\n});\n"],"file":"cli.js"}
|
|
@@ -3,8 +3,11 @@ export declare const DEFAULT_PROCESS_NAME: string;
|
|
|
3
3
|
/**
|
|
4
4
|
* This command is intended to run the server with Fastify
|
|
5
5
|
* as a migration step.
|
|
6
|
+
* More info: https://github.com/verdaccio/verdaccio/discussions/2155
|
|
7
|
+
* To try out.
|
|
8
|
+
* pnpm debug:fastify
|
|
6
9
|
*/
|
|
7
|
-
export declare class
|
|
10
|
+
export declare class FastifyServer extends Command {
|
|
8
11
|
static paths: string[][];
|
|
9
12
|
private port;
|
|
10
13
|
private config;
|
|
@@ -3,16 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.FastifyServer = exports.DEFAULT_PROCESS_NAME = void 0;
|
|
7
7
|
|
|
8
8
|
var _clipanion = require("clipanion");
|
|
9
9
|
|
|
10
10
|
var _config = require("@verdaccio/config");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _core = require("@verdaccio/core");
|
|
13
13
|
|
|
14
14
|
var _fastifyMigration = _interopRequireDefault(require("@verdaccio/fastify-migration"));
|
|
15
15
|
|
|
16
|
+
var _logger = require("@verdaccio/logger");
|
|
17
|
+
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
19
|
|
|
18
20
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -21,11 +23,14 @@ const DEFAULT_PROCESS_NAME = 'verdaccio';
|
|
|
21
23
|
/**
|
|
22
24
|
* This command is intended to run the server with Fastify
|
|
23
25
|
* as a migration step.
|
|
26
|
+
* More info: https://github.com/verdaccio/verdaccio/discussions/2155
|
|
27
|
+
* To try out.
|
|
28
|
+
* pnpm debug:fastify
|
|
24
29
|
*/
|
|
25
30
|
|
|
26
31
|
exports.DEFAULT_PROCESS_NAME = DEFAULT_PROCESS_NAME;
|
|
27
32
|
|
|
28
|
-
class
|
|
33
|
+
class FastifyServer extends _clipanion.Command {
|
|
29
34
|
constructor(...args) {
|
|
30
35
|
super(...args);
|
|
31
36
|
|
|
@@ -41,7 +46,7 @@ class NewServer extends _clipanion.Command {
|
|
|
41
46
|
initLogger(logConfig) {
|
|
42
47
|
try {
|
|
43
48
|
if (logConfig.logs) {
|
|
44
|
-
|
|
49
|
+
_core.warningUtils.emit(_core.warningUtils.Codes.VERDEP001);
|
|
45
50
|
} // FUTURE: remove fallback when is ready
|
|
46
51
|
|
|
47
52
|
|
|
@@ -59,13 +64,15 @@ class NewServer extends _clipanion.Command {
|
|
|
59
64
|
web
|
|
60
65
|
} = configParsed;
|
|
61
66
|
this.initLogger(configParsed);
|
|
62
|
-
process.title = (web === null || web === void 0 ? void 0 : web.title) || DEFAULT_PROCESS_NAME; //
|
|
67
|
+
process.title = (web === null || web === void 0 ? void 0 : web.title) || DEFAULT_PROCESS_NAME; // FIXME: need a way to get version of the package.
|
|
68
|
+
// const { version, name } = require('../../package.json');
|
|
63
69
|
|
|
64
70
|
const ser = await (0, _fastifyMigration.default)({
|
|
65
71
|
logger: _logger.logger,
|
|
66
72
|
config: configParsed
|
|
67
|
-
});
|
|
68
|
-
|
|
73
|
+
}); // FIXME: harcoded, this would need to come from the configuration and the --listen flag.
|
|
74
|
+
|
|
75
|
+
await ser.listen(process.env.PORT || 4873);
|
|
69
76
|
} catch (err) {
|
|
70
77
|
console.error(err);
|
|
71
78
|
process.exit(1);
|
|
@@ -74,7 +81,7 @@ class NewServer extends _clipanion.Command {
|
|
|
74
81
|
|
|
75
82
|
}
|
|
76
83
|
|
|
77
|
-
exports.
|
|
84
|
+
exports.FastifyServer = FastifyServer;
|
|
78
85
|
|
|
79
|
-
_defineProperty(
|
|
80
|
-
//# sourceMappingURL=
|
|
86
|
+
_defineProperty(FastifyServer, "paths", [['fastify-server']]);
|
|
87
|
+
//# sourceMappingURL=FastifyServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/FastifyServer.ts"],"names":["DEFAULT_PROCESS_NAME","FastifyServer","Command","Option","String","description","initLogger","logConfig","logs","warningUtils","emit","Codes","VERDEP001","log","Error","execute","configPathLocation","config","configParsed","web","process","title","ser","logger","listen","env","PORT","err","console","error","exit"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;;;;;AAGO,MAAMA,oBAA4B,GAAG,WAArC;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,MAAMC,aAAN,SAA4BC,kBAA5B,CAAoC;AAAA;AAAA;;AAAA,kCAG1BC,kBAAOC,MAAP,CAAc,uBAAd,EAAuC;AACpDC,MAAAA,WAAW,EAAE;AADuC,KAAvC,CAH0B;;AAAA,oCAOxBF,kBAAOC,MAAP,CAAc,aAAd,EAA6B;AAC5CC,MAAAA,WAAW,EAAE;AAD+B,KAA7B,CAPwB;AAAA;;AAWjCC,EAAAA,UAAU,CAACC,SAAD,EAA2B;AAC3C,QAAI;AACF,UAAIA,SAAS,CAACC,IAAd,EAAoB;AAClBC,2BAAaC,IAAb,CAAkBD,mBAAaE,KAAb,CAAmBC,SAArC;AACD,OAHC,CAIF;;;AACA,yBAAML,SAAS,CAACM,GAAV,IAAiBN,SAAS,CAACC,IAAjC;AACD,KAND,CAME,MAAM;AACN,YAAM,IAAIM,KAAJ,CAAU,sBAAV,CAAN;AACD;AACF;;AAEmB,QAAPC,OAAO,GAAG;AACrB,QAAI;AACF,YAAMC,kBAAkB,GAAG,4BAAe,KAAKC,MAApB,CAA3B;AACA,YAAMC,YAAY,GAAG,6BAAgBF,kBAAhB,CAArB;AACA,YAAM;AAAEG,QAAAA;AAAF,UAAUD,YAAhB;AACA,WAAKZ,UAAL,CAAgBY,YAAhB;AAEAE,MAAAA,OAAO,CAACC,KAAR,GAAgB,CAAAF,GAAG,SAAH,IAAAA,GAAG,WAAH,YAAAA,GAAG,CAAEE,KAAL,KAAcrB,oBAA9B,CANE,CAOF;AACA;;AACA,YAAMsB,GAAG,GAAG,MAAM,+BAAO;AAAEC,QAAAA,MAAM,EAANA,cAAF;AAAUN,QAAAA,MAAM,EAAEC;AAAlB,OAAP,CAAlB,CATE,CAUF;;AACA,YAAMI,GAAG,CAACE,MAAJ,CAAWJ,OAAO,CAACK,GAAR,CAAYC,IAAZ,IAAoB,IAA/B,CAAN;AACD,KAZD,CAYE,OAAOC,GAAP,EAAiB;AACjBC,MAAAA,OAAO,CAACC,KAAR,CAAcF,GAAd;AACAP,MAAAA,OAAO,CAACU,IAAR,CAAa,CAAb;AACD;AACF;;AAxCwC;;;;gBAA9B7B,a,WACW,CAAC,CAAC,gBAAD,CAAD,C","sourcesContent":["import { Command, Option } from 'clipanion';\n\nimport { findConfigFile, parseConfigFile } from '@verdaccio/config';\nimport { warningUtils } from '@verdaccio/core';\nimport server from '@verdaccio/fastify-migration';\nimport { logger, setup } from '@verdaccio/logger';\nimport { ConfigRuntime } from '@verdaccio/types';\n\nexport const DEFAULT_PROCESS_NAME: string = 'verdaccio';\n\n/**\n * This command is intended to run the server with Fastify\n * as a migration step.\n * More info: https://github.com/verdaccio/verdaccio/discussions/2155\n * To try out.\n * pnpm debug:fastify\n */\nexport class FastifyServer extends Command {\n public static paths = [['fastify-server']];\n\n private port = Option.String('-l,-p,--listen,--port', {\n description: 'host:port number to listen on (default: localhost:4873)',\n });\n\n private config = Option.String('-c,--config', {\n description: 'use this configuration file (default: ./config.yaml)',\n });\n\n private initLogger(logConfig: ConfigRuntime) {\n try {\n if (logConfig.logs) {\n warningUtils.emit(warningUtils.Codes.VERDEP001);\n }\n // FUTURE: remove fallback when is ready\n setup(logConfig.log || logConfig.logs);\n } catch {\n throw new Error('error on init logger');\n }\n }\n\n public async execute() {\n try {\n const configPathLocation = findConfigFile(this.config as string);\n const configParsed = parseConfigFile(configPathLocation);\n const { web } = configParsed;\n this.initLogger(configParsed);\n\n process.title = web?.title || DEFAULT_PROCESS_NAME;\n // FIXME: need a way to get version of the package.\n // const { version, name } = require('../../package.json');\n const ser = await server({ logger, config: configParsed });\n // FIXME: harcoded, this would need to come from the configuration and the --listen flag.\n await ser.listen(process.env.PORT || 4873);\n } catch (err: any) {\n console.error(err);\n process.exit(1);\n }\n }\n}\n"],"file":"FastifyServer.js"}
|
package/build/commands/info.js
CHANGED
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.InfoCommand = void 0;
|
|
7
7
|
|
|
8
|
-
var _envinfo = _interopRequireDefault(require("envinfo"));
|
|
9
|
-
|
|
10
8
|
var _clipanion = require("clipanion");
|
|
11
9
|
|
|
10
|
+
var _envinfo = _interopRequireDefault(require("envinfo"));
|
|
11
|
+
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
14
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/info.ts"],"names":["InfoCommand","Command","execute","context","stdout","write","data","envinfo","run","System","Binaries","Virtualization","Browsers","npmGlobalPackages","process","exit"],"mappings":";;;;;;;AAAA;;AACA;;;;;;AAEO,MAAMA,WAAN,SAA0BC,kBAA1B,CAAkC;AAGnB,QAAPC,OAAO,GAAkB;AACpC,SAAKC,OAAL,CAAaC,MAAb,CAAoBC,KAApB,CAA0B,qBAA1B;AACA,UAAMC,IAAI,GAAG,MAAMC,iBAAQC,GAAR,CAAY;AAC7BC,MAAAA,MAAM,EAAE,CAAC,IAAD,EAAO,KAAP,CADqB;AAE7BC,MAAAA,QAAQ,EAAE,CAAC,MAAD,EAAS,MAAT,EAAiB,KAAjB,EAAwB,MAAxB,CAFmB;AAG7BC,MAAAA,cAAc,EAAE,CAAC,QAAD,CAHa;AAI7BC,MAAAA,QAAQ,EAAE,CAAC,QAAD,EAAW,MAAX,EAAmB,SAAnB,EAA8B,QAA9B,CAJmB;AAK7BC,MAAAA,iBAAiB,EAAE,CAAC,WAAD;AALU,KAAZ,CAAnB;AAQA,SAAKV,OAAL,CAAaC,MAAb,CAAoBC,KAApB,CAA0BC,IAA1B;AACAQ,IAAAA,OAAO,CAACC,IAAR,CAAa,CAAb;AACD;;AAfsC;;;;gBAA5Bf,W,WACW,CAAC,CAAE,QAAF,CAAD,EAAa,CAAE,IAAF,CAAb,C","sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../src/commands/info.ts"],"names":["InfoCommand","Command","execute","context","stdout","write","data","envinfo","run","System","Binaries","Virtualization","Browsers","npmGlobalPackages","process","exit"],"mappings":";;;;;;;AAAA;;AACA;;;;;;AAEO,MAAMA,WAAN,SAA0BC,kBAA1B,CAAkC;AAGnB,QAAPC,OAAO,GAAkB;AACpC,SAAKC,OAAL,CAAaC,MAAb,CAAoBC,KAApB,CAA0B,qBAA1B;AACA,UAAMC,IAAI,GAAG,MAAMC,iBAAQC,GAAR,CAAY;AAC7BC,MAAAA,MAAM,EAAE,CAAC,IAAD,EAAO,KAAP,CADqB;AAE7BC,MAAAA,QAAQ,EAAE,CAAC,MAAD,EAAS,MAAT,EAAiB,KAAjB,EAAwB,MAAxB,CAFmB;AAG7BC,MAAAA,cAAc,EAAE,CAAC,QAAD,CAHa;AAI7BC,MAAAA,QAAQ,EAAE,CAAC,QAAD,EAAW,MAAX,EAAmB,SAAnB,EAA8B,QAA9B,CAJmB;AAK7BC,MAAAA,iBAAiB,EAAE,CAAC,WAAD;AALU,KAAZ,CAAnB;AAQA,SAAKV,OAAL,CAAaC,MAAb,CAAoBC,KAApB,CAA0BC,IAA1B;AACAQ,IAAAA,OAAO,CAACC,IAAR,CAAa,CAAb;AACD;;AAfsC;;;;gBAA5Bf,W,WACW,CAAC,CAAE,QAAF,CAAD,EAAa,CAAE,IAAF,CAAb,C","sourcesContent":["import { Command } from 'clipanion';\nimport envinfo from 'envinfo';\n\nexport class InfoCommand extends Command {\n public static paths = [[`--info`], [`-i`]];\n\n public async execute(): Promise<void> {\n this.context.stdout.write('\\nEnvironment Info:');\n const data = await envinfo.run({\n System: ['OS', 'CPU'],\n Binaries: ['node', 'yarn', 'npm', 'pnpm'],\n Virtualization: ['Docker'],\n Browsers: ['Chrome', 'Edge', 'Firefox', 'Safari'],\n npmGlobalPackages: ['verdaccio'],\n });\n\n this.context.stdout.write(data);\n process.exit(0);\n }\n}\n"],"file":"info.js"}
|
package/build/commands/init.js
CHANGED
|
@@ -9,6 +9,8 @@ var _clipanion = require("clipanion");
|
|
|
9
9
|
|
|
10
10
|
var _config = require("@verdaccio/config");
|
|
11
11
|
|
|
12
|
+
var _core = require("@verdaccio/core");
|
|
13
|
+
|
|
12
14
|
var _logger = require("@verdaccio/logger");
|
|
13
15
|
|
|
14
16
|
var _nodeApi = require("@verdaccio/node-api");
|
|
@@ -34,7 +36,7 @@ class InitCommand extends _clipanion.Command {
|
|
|
34
36
|
initLogger(logConfig) {
|
|
35
37
|
try {
|
|
36
38
|
if (logConfig.logs) {
|
|
37
|
-
|
|
39
|
+
_core.warningUtils.emit(_core.warningUtils.Codes.VERDEP001);
|
|
38
40
|
} // FUTURE: remove fallback when is ready
|
|
39
41
|
|
|
40
42
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/init.ts"],"names":["DEFAULT_PROCESS_NAME","InitCommand","Command","Option","String","description","initLogger","logConfig","logs","
|
|
1
|
+
{"version":3,"sources":["../../src/commands/init.ts"],"names":["DEFAULT_PROCESS_NAME","InitCommand","Command","Option","String","description","initLogger","logConfig","logs","warningUtils","emit","Codes","VERDEP001","log","Error","execute","configPathLocation","config","configParsed","web","process","title","version","name","require","port","logger","info","err","console","error","exit","Default","Usage","details","examples"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;;;AAGO,MAAMA,oBAA4B,GAAG,WAArC;;;AAEA,MAAMC,WAAN,SAA0BC,kBAA1B,CAAkC;AAAA;AAAA;;AAAA,kCAGxBC,kBAAOC,MAAP,CAAc,uBAAd,EAAuC;AACpDC,MAAAA,WAAW,EAAE;AADuC,KAAvC,CAHwB;;AAAA,oCAiCtBF,kBAAOC,MAAP,CAAc,aAAd,EAA6B;AAC5CC,MAAAA,WAAW,EAAE;AAD+B,KAA7B,CAjCsB;AAAA;;AAqC/BC,EAAAA,UAAU,CAACC,SAAD,EAA2B;AAC3C,QAAI;AACF,UAAIA,SAAS,CAACC,IAAd,EAAoB;AAClBC,2BAAaC,IAAb,CAAkBD,mBAAaE,KAAb,CAAmBC,SAArC;AACD,OAHC,CAIF;;;AACA,yBAAML,SAAS,CAACM,GAAV,IAAiBN,SAAS,CAACC,IAAjC;AACD,KAND,CAME,MAAM;AACN,YAAM,IAAIM,KAAJ,CAAU,sBAAV,CAAN;AACD;AACF;;AAEmB,QAAPC,OAAO,GAAG;AACrB,QAAI;AACF,YAAMC,kBAAkB,GAAG,4BAAe,KAAKC,MAApB,CAA3B;AACA,YAAMC,YAAY,GAAG,6BAAgBF,kBAAhB,CAArB;AACA,WAAKV,UAAL,CAAgBY,YAAhB;AACA,YAAM;AAAEC,QAAAA;AAAF,UAAUD,YAAhB;AAEAE,MAAAA,OAAO,CAACC,KAAR,GAAgB,CAAAF,GAAG,SAAH,IAAAA,GAAG,WAAH,YAAAA,GAAG,CAAEE,KAAL,KAAcrB,oBAA9B;;AAEA,YAAM;AAAEsB,QAAAA,OAAF;AAAWC,QAAAA;AAAX,UAAoBC,OAAO,CAAC,oBAAD,CAAjC;;AAEA,YAAM,yBAAWN,YAAX,EAAyB,KAAKO,IAA9B,EAA8CH,OAA9C,EAAuDC,IAAvD,CAAN;;AACAG,qBAAOC,IAAP,CAAY,gBAAZ;AACD,KAZD,CAYE,OAAOC,GAAP,EAAiB;AACjBC,MAAAA,OAAO,CAACC,KAAR,CAAcF,GAAd;AACAR,MAAAA,OAAO,CAACW,IAAR,CAAa,CAAb;AACD;AACF;;AAlEsC;;;;gBAA5B9B,W,WACW,CAACC,mBAAQ8B,OAAT,C;;gBADX/B,W,WAQIC,mBAAQ+B,KAAR,CAAc;AAC3B5B,EAAAA,WAAW,EAAG,mBADa;AAE3B6B,EAAAA,OAAO,EAAG;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAd+B;AAe3BC,EAAAA,QAAQ,EAAE,CACR,CAAE,gDAAF,EAAoD,WAApD,CADQ,EAER,CAAE,kCAAF,EAAsC,yBAAtC,CAFQ,EAGR,CACG,kFADH,EAEG,qDAFH,CAHQ;AAfiB,CAAd,C","sourcesContent":["import { Command, Option } from 'clipanion';\n\nimport { findConfigFile, parseConfigFile } from '@verdaccio/config';\nimport { warningUtils } from '@verdaccio/core';\nimport { logger, setup } from '@verdaccio/logger';\nimport { initServer } from '@verdaccio/node-api';\nimport { ConfigRuntime } from '@verdaccio/types';\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 // eslint-disable-next-line\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 initLogger(logConfig: ConfigRuntime) {\n try {\n if (logConfig.logs) {\n warningUtils.emit(warningUtils.Codes.VERDEP001);\n }\n // FUTURE: remove fallback when is ready\n setup(logConfig.log || logConfig.logs);\n } catch {\n throw new Error('error on init logger');\n }\n }\n\n public async execute() {\n try {\n const configPathLocation = findConfigFile(this.config as string);\n const configParsed = parseConfigFile(configPathLocation);\n this.initLogger(configParsed);\n const { web } = configParsed;\n\n process.title = web?.title || DEFAULT_PROCESS_NAME;\n\n const { version, name } = require('../../package.json');\n\n await initServer(configParsed, this.port as string, version, name);\n logger.info('server started');\n } catch (err: any) {\n console.error(err);\n process.exit(1);\n }\n }\n}\n"],"file":"init.js"}
|
package/build/utils.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const MIN_NODE_VERSION = "14";
|
|
2
|
-
export declare function isVersionValid(
|
|
1
|
+
export declare const MIN_NODE_VERSION = "14.0.0";
|
|
2
|
+
export declare function isVersionValid(processVersion: any): boolean;
|
package/build/utils.js
CHANGED
|
@@ -3,17 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isVersionValid = isVersionValid;
|
|
7
6
|
exports.MIN_NODE_VERSION = void 0;
|
|
7
|
+
exports.isVersionValid = isVersionValid;
|
|
8
8
|
|
|
9
9
|
var _semver = _interopRequireDefault(require("semver"));
|
|
10
10
|
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
|
|
13
|
-
const MIN_NODE_VERSION = '14';
|
|
13
|
+
const MIN_NODE_VERSION = '14.0.0';
|
|
14
14
|
exports.MIN_NODE_VERSION = MIN_NODE_VERSION;
|
|
15
15
|
|
|
16
|
-
function isVersionValid(
|
|
16
|
+
function isVersionValid(processVersion) {
|
|
17
|
+
const version = processVersion.substr(1);
|
|
17
18
|
return _semver.default.satisfies(version, `>=${MIN_NODE_VERSION}`);
|
|
18
19
|
}
|
|
19
20
|
//# sourceMappingURL=utils.js.map
|
package/build/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils.ts"],"names":["MIN_NODE_VERSION","isVersionValid","version","semver","satisfies"],"mappings":";;;;;;;;AAAA;;;;AAEO,MAAMA,gBAAgB,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/utils.ts"],"names":["MIN_NODE_VERSION","isVersionValid","processVersion","version","substr","semver","satisfies"],"mappings":";;;;;;;;AAAA;;;;AAEO,MAAMA,gBAAgB,GAAG,QAAzB;;;AAEA,SAASC,cAAT,CAAwBC,cAAxB,EAAwC;AAC7C,QAAMC,OAAO,GAAGD,cAAc,CAACE,MAAf,CAAsB,CAAtB,CAAhB;AACA,SAAOC,gBAAOC,SAAP,CAAiBH,OAAjB,EAA2B,KAAIH,gBAAiB,EAAhD,CAAP;AACD","sourcesContent":["import semver from 'semver';\n\nexport const MIN_NODE_VERSION = '14.0.0';\n\nexport function isVersionValid(processVersion) {\n const version = processVersion.substr(1);\n return semver.satisfies(version, `>=${MIN_NODE_VERSION}`);\n}\n"],"file":"utils.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/cli",
|
|
3
|
-
"version": "6.0.0-6-next.
|
|
3
|
+
"version": "6.0.0-6-next.26",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Juan Picado",
|
|
6
6
|
"email": "juanpicado19@gmail.com"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"verdaccio"
|
|
27
27
|
],
|
|
28
28
|
"engines": {
|
|
29
|
-
"node": ">=
|
|
29
|
+
"node": ">=14",
|
|
30
30
|
"npm": ">=6"
|
|
31
31
|
},
|
|
32
32
|
"description": "verdaccio CLI",
|
|
@@ -34,11 +34,12 @@
|
|
|
34
34
|
"main": "./build/index.js",
|
|
35
35
|
"types": "build/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@verdaccio/
|
|
38
|
-
"@verdaccio/
|
|
39
|
-
"@verdaccio/
|
|
40
|
-
"@verdaccio/
|
|
41
|
-
"
|
|
37
|
+
"@verdaccio/core": "6.0.0-6-next.4",
|
|
38
|
+
"@verdaccio/config": "6.0.0-6-next.12",
|
|
39
|
+
"@verdaccio/logger": "6.0.0-6-next.8",
|
|
40
|
+
"@verdaccio/node-api": "6.0.0-6-next.25",
|
|
41
|
+
"@verdaccio/fastify-migration": "6.0.0-6-next.17",
|
|
42
|
+
"clipanion": "3.1.0",
|
|
42
43
|
"envinfo": "7.8.1",
|
|
43
44
|
"kleur": "3.0.3",
|
|
44
45
|
"semver": "7.3.5"
|
package/src/cli.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { Cli } from 'clipanion';
|
|
2
2
|
|
|
3
|
+
import { warningUtils } from '@verdaccio/core';
|
|
4
|
+
|
|
5
|
+
import { FastifyServer } from './commands/FastifyServer';
|
|
3
6
|
import { InfoCommand } from './commands/info';
|
|
4
7
|
import { InitCommand } from './commands/init';
|
|
5
8
|
import { VersionCommand } from './commands/version';
|
|
6
|
-
import {
|
|
7
|
-
import { isVersionValid, MIN_NODE_VERSION } from './utils';
|
|
9
|
+
import { MIN_NODE_VERSION, isVersionValid } from './utils';
|
|
8
10
|
|
|
9
11
|
if (process.getuid && process.getuid() === 0) {
|
|
10
|
-
|
|
12
|
+
warningUtils.emit(warningUtils.Codes.VERWAR001);
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
if (!isVersionValid(process.version)) {
|
|
@@ -28,7 +30,7 @@ const cli = new Cli({
|
|
|
28
30
|
cli.register(InfoCommand);
|
|
29
31
|
cli.register(InitCommand);
|
|
30
32
|
cli.register(VersionCommand);
|
|
31
|
-
cli.register(
|
|
33
|
+
cli.register(FastifyServer);
|
|
32
34
|
cli.runExit(args, Cli.defaultContext);
|
|
33
35
|
|
|
34
36
|
process.on('uncaughtException', function (err) {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Command, Option } from 'clipanion';
|
|
2
|
+
|
|
2
3
|
import { findConfigFile, parseConfigFile } from '@verdaccio/config';
|
|
3
|
-
import {
|
|
4
|
+
import { warningUtils } from '@verdaccio/core';
|
|
4
5
|
import server from '@verdaccio/fastify-migration';
|
|
6
|
+
import { logger, setup } from '@verdaccio/logger';
|
|
5
7
|
import { ConfigRuntime } from '@verdaccio/types';
|
|
6
8
|
|
|
7
9
|
export const DEFAULT_PROCESS_NAME: string = 'verdaccio';
|
|
@@ -9,9 +11,12 @@ export const DEFAULT_PROCESS_NAME: string = 'verdaccio';
|
|
|
9
11
|
/**
|
|
10
12
|
* This command is intended to run the server with Fastify
|
|
11
13
|
* as a migration step.
|
|
14
|
+
* More info: https://github.com/verdaccio/verdaccio/discussions/2155
|
|
15
|
+
* To try out.
|
|
16
|
+
* pnpm debug:fastify
|
|
12
17
|
*/
|
|
13
|
-
export class
|
|
14
|
-
public static paths = [['
|
|
18
|
+
export class FastifyServer extends Command {
|
|
19
|
+
public static paths = [['fastify-server']];
|
|
15
20
|
|
|
16
21
|
private port = Option.String('-l,-p,--listen,--port', {
|
|
17
22
|
description: 'host:port number to listen on (default: localhost:4873)',
|
|
@@ -24,7 +29,7 @@ export class NewServer extends Command {
|
|
|
24
29
|
private initLogger(logConfig: ConfigRuntime) {
|
|
25
30
|
try {
|
|
26
31
|
if (logConfig.logs) {
|
|
27
|
-
|
|
32
|
+
warningUtils.emit(warningUtils.Codes.VERDEP001);
|
|
28
33
|
}
|
|
29
34
|
// FUTURE: remove fallback when is ready
|
|
30
35
|
setup(logConfig.log || logConfig.logs);
|
|
@@ -41,9 +46,11 @@ export class NewServer extends Command {
|
|
|
41
46
|
this.initLogger(configParsed);
|
|
42
47
|
|
|
43
48
|
process.title = web?.title || DEFAULT_PROCESS_NAME;
|
|
49
|
+
// FIXME: need a way to get version of the package.
|
|
44
50
|
// const { version, name } = require('../../package.json');
|
|
45
51
|
const ser = await server({ logger, config: configParsed });
|
|
46
|
-
|
|
52
|
+
// FIXME: harcoded, this would need to come from the configuration and the --listen flag.
|
|
53
|
+
await ser.listen(process.env.PORT || 4873);
|
|
47
54
|
} catch (err: any) {
|
|
48
55
|
console.error(err);
|
|
49
56
|
process.exit(1);
|
package/src/commands/info.ts
CHANGED
package/src/commands/init.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Command, Option } from 'clipanion';
|
|
2
|
+
|
|
2
3
|
import { findConfigFile, parseConfigFile } from '@verdaccio/config';
|
|
3
|
-
import {
|
|
4
|
+
import { warningUtils } from '@verdaccio/core';
|
|
5
|
+
import { logger, setup } from '@verdaccio/logger';
|
|
4
6
|
import { initServer } from '@verdaccio/node-api';
|
|
5
7
|
import { ConfigRuntime } from '@verdaccio/types';
|
|
6
8
|
|
|
@@ -46,9 +48,7 @@ export class InitCommand extends Command {
|
|
|
46
48
|
private initLogger(logConfig: ConfigRuntime) {
|
|
47
49
|
try {
|
|
48
50
|
if (logConfig.logs) {
|
|
49
|
-
|
|
50
|
-
'config.logs is deprecated, rename configuration to "config.log" in singular'
|
|
51
|
-
);
|
|
51
|
+
warningUtils.emit(warningUtils.Codes.VERDEP001);
|
|
52
52
|
}
|
|
53
53
|
// FUTURE: remove fallback when is ready
|
|
54
54
|
setup(logConfig.log || logConfig.logs);
|
package/src/utils.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import semver from 'semver';
|
|
2
2
|
|
|
3
|
-
export const MIN_NODE_VERSION = '14';
|
|
3
|
+
export const MIN_NODE_VERSION = '14.0.0';
|
|
4
4
|
|
|
5
|
-
export function isVersionValid(
|
|
5
|
+
export function isVersionValid(processVersion) {
|
|
6
|
+
const version = processVersion.substr(1);
|
|
6
7
|
return semver.satisfies(version, `>=${MIN_NODE_VERSION}`);
|
|
7
8
|
}
|
package/test/utils.spec.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { isVersionValid } from '../src/utils';
|
|
2
2
|
|
|
3
3
|
test('valid version node.js', () => {
|
|
4
|
-
expect(isVersionValid('
|
|
4
|
+
expect(isVersionValid('v14.0.0')).toBeTruthy();
|
|
5
|
+
expect(isVersionValid('v15.0.0')).toBeTruthy();
|
|
6
|
+
expect(isVersionValid('v16.0.0')).toBeTruthy();
|
|
7
|
+
expect(isVersionValid('v17.0.0')).toBeTruthy();
|
|
5
8
|
});
|
|
6
9
|
|
|
7
10
|
test('is invalid version node.js', () => {
|
|
8
|
-
expect(isVersionValid('
|
|
11
|
+
expect(isVersionValid('v13.0.0')).toBeFalsy();
|
|
12
|
+
expect(isVersionValid('v12.0.0')).toBeFalsy();
|
|
13
|
+
expect(isVersionValid('v8.0.0')).toBeFalsy();
|
|
14
|
+
expect(isVersionValid('v4.0.0')).toBeFalsy();
|
|
15
|
+
expect(isVersionValid('v0.0.10')).toBeFalsy();
|
|
9
16
|
});
|
package/tsconfig.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/newServer.ts"],"names":["DEFAULT_PROCESS_NAME","NewServer","Command","Option","String","description","initLogger","logConfig","logs","process","emitWarning","log","Error","execute","configPathLocation","config","configParsed","web","title","ser","logger","listen","err","console","error","exit"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;AAGO,MAAMA,oBAA4B,GAAG,WAArC;AAEP;AACA;AACA;AACA;;;;AACO,MAAMC,SAAN,SAAwBC,kBAAxB,CAAgC;AAAA;AAAA;;AAAA,kCAGtBC,kBAAOC,MAAP,CAAc,uBAAd,EAAuC;AACpDC,MAAAA,WAAW,EAAE;AADuC,KAAvC,CAHsB;;AAAA,oCAOpBF,kBAAOC,MAAP,CAAc,aAAd,EAA6B;AAC5CC,MAAAA,WAAW,EAAE;AAD+B,KAA7B,CAPoB;AAAA;;AAW7BC,EAAAA,UAAU,CAACC,SAAD,EAA2B;AAC3C,QAAI;AACF,UAAIA,SAAS,CAACC,IAAd,EAAoB;AAClBC,QAAAA,OAAO,CAACC,WAAR,CAAoB,iEAApB;AACD,OAHC,CAIF;;;AACA,yBAAMH,SAAS,CAACI,GAAV,IAAiBJ,SAAS,CAACC,IAAjC;AACD,KAND,CAME,MAAM;AACN,YAAM,IAAII,KAAJ,CAAU,sBAAV,CAAN;AACD;AACF;;AAEmB,QAAPC,OAAO,GAAG;AACrB,QAAI;AACF,YAAMC,kBAAkB,GAAG,4BAAe,KAAKC,MAApB,CAA3B;AACA,YAAMC,YAAY,GAAG,6BAAgBF,kBAAhB,CAArB;AACA,YAAM;AAAEG,QAAAA;AAAF,UAAUD,YAAhB;AACA,WAAKV,UAAL,CAAgBU,YAAhB;AAEAP,MAAAA,OAAO,CAACS,KAAR,GAAgB,CAAAD,GAAG,SAAH,IAAAA,GAAG,WAAH,YAAAA,GAAG,CAAEC,KAAL,KAAclB,oBAA9B,CANE,CAOF;;AACA,YAAMmB,GAAG,GAAG,MAAM,+BAAO;AAAEC,QAAAA,MAAM,EAANA,cAAF;AAAUL,QAAAA,MAAM,EAAEC;AAAlB,OAAP,CAAlB;AACA,YAAMG,GAAG,CAACE,MAAJ,CAAW,IAAX,CAAN;AACD,KAVD,CAUE,OAAOC,GAAP,EAAiB;AACjBC,MAAAA,OAAO,CAACC,KAAR,CAAcF,GAAd;AACAb,MAAAA,OAAO,CAACgB,IAAR,CAAa,CAAb;AACD;AACF;;AAtCoC;;;;gBAA1BxB,S,WACW,CAAC,CAAC,KAAD,CAAD,C","sourcesContent":["import { Command, Option } from 'clipanion';\nimport { findConfigFile, parseConfigFile } from '@verdaccio/config';\nimport { setup, logger } from '@verdaccio/logger';\nimport server from '@verdaccio/fastify-migration';\nimport { ConfigRuntime } from '@verdaccio/types';\n\nexport const DEFAULT_PROCESS_NAME: string = 'verdaccio';\n\n/**\n * This command is intended to run the server with Fastify\n * as a migration step.\n */\nexport class NewServer extends Command {\n public static paths = [['new']];\n\n private port = Option.String('-l,-p,--listen,--port', {\n description: 'host:port number to listen on (default: localhost:4873)',\n });\n\n private config = Option.String('-c,--config', {\n description: 'use this configuration file (default: ./config.yaml)',\n });\n\n private initLogger(logConfig: ConfigRuntime) {\n try {\n if (logConfig.logs) {\n process.emitWarning('config.logs is deprecated, rename configuration to \"config.log\"');\n }\n // FUTURE: remove fallback when is ready\n setup(logConfig.log || logConfig.logs);\n } catch {\n throw new Error('error on init logger');\n }\n }\n\n public async execute() {\n try {\n const configPathLocation = findConfigFile(this.config as string);\n const configParsed = parseConfigFile(configPathLocation);\n const { web } = configParsed;\n this.initLogger(configParsed);\n\n process.title = web?.title || DEFAULT_PROCESS_NAME;\n // const { version, name } = require('../../package.json');\n const ser = await server({ logger, config: configParsed });\n await ser.listen(4873);\n } catch (err: any) {\n console.error(err);\n process.exit(1);\n }\n }\n}\n"],"file":"newServer.js"}
|