@verdaccio/config 6.0.0-6-next.60 → 6.0.0-6-next.62
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 +19 -0
- package/build/parse.js +3 -3
- package/build/parse.js.map +1 -1
- package/package.json +4 -4
- package/src/parse.ts +3 -3
- package/test/__snapshots__/config-parsing.spec.ts.snap +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @verdaccio/config
|
|
2
2
|
|
|
3
|
+
## 6.0.0-6-next.62
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [378e907d]
|
|
8
|
+
- @verdaccio/core@6.0.0-6-next.62
|
|
9
|
+
- @verdaccio/utils@6.0.0-6-next.30
|
|
10
|
+
|
|
11
|
+
## 6.0.0-6-next.61
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- d167f92e: chore: rollback yaml dep support old nodejs versions
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- @verdaccio/core@6.0.0-6-next.61
|
|
20
|
+
- @verdaccio/utils@6.0.0-6-next.29
|
|
21
|
+
|
|
3
22
|
## 6.0.0-6-next.60
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
package/build/parse.js
CHANGED
|
@@ -7,8 +7,8 @@ exports.fromJStoYAML = fromJStoYAML;
|
|
|
7
7
|
exports.parseConfigFile = parseConfigFile;
|
|
8
8
|
var _debug = _interopRequireDefault(require("debug"));
|
|
9
9
|
var _fs = _interopRequireDefault(require("fs"));
|
|
10
|
+
var _jsYaml = _interopRequireDefault(require("js-yaml"));
|
|
10
11
|
var _lodash = require("lodash");
|
|
11
|
-
var _yaml = _interopRequireDefault(require("yaml"));
|
|
12
12
|
var _core = require("@verdaccio/core");
|
|
13
13
|
var _configUtils = require("./config-utils");
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -26,7 +26,7 @@ function parseConfigFile(configPath) {
|
|
|
26
26
|
debug('parsing config file: %o', configPath);
|
|
27
27
|
try {
|
|
28
28
|
if (/\.ya?ml$/i.test(configPath)) {
|
|
29
|
-
const yamlConfig =
|
|
29
|
+
const yamlConfig = _jsYaml.default.load(_fs.default.readFileSync(configPath, 'utf8'), {
|
|
30
30
|
strict: false
|
|
31
31
|
});
|
|
32
32
|
return Object.assign({}, yamlConfig, {
|
|
@@ -52,7 +52,7 @@ function parseConfigFile(configPath) {
|
|
|
52
52
|
function fromJStoYAML(config) {
|
|
53
53
|
debug('convert config from JSON to YAML');
|
|
54
54
|
if ((0, _lodash.isObject)(config)) {
|
|
55
|
-
return
|
|
55
|
+
return _jsYaml.default.dump(config);
|
|
56
56
|
} else {
|
|
57
57
|
throw new Error(`config is not a valid object`);
|
|
58
58
|
}
|
package/build/parse.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.js","names":["debug","buildDebug","parseConfigFile","configPath","fileExists","Error","test","yamlConfig","YAML","
|
|
1
|
+
{"version":3,"file":"parse.js","names":["debug","buildDebug","parseConfigFile","configPath","fileExists","Error","test","yamlConfig","YAML","load","fs","readFileSync","strict","Object","assign","config_path","jsonConfig","require","e","code","message","APP_ERROR","CONFIG_NOT_VALID","fromJStoYAML","config","isObject","dump"],"sources":["../src/parse.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport fs from 'fs';\nimport YAML from 'js-yaml';\nimport { isObject } from 'lodash';\n\nimport { APP_ERROR } from '@verdaccio/core';\nimport { ConfigYaml } from '@verdaccio/types';\n\nimport { fileExists } from './config-utils';\n\nconst debug = buildDebug('verdaccio:config:parse');\n\n/**\n * Parse a config file from yaml to JSON.\n * @param configPath the absolute path of the configuration file\n */\nexport function parseConfigFile(configPath: string): ConfigYaml & {\n // @deprecated use configPath instead\n config_path: string;\n configPath: string;\n} {\n debug('parse config file %s', configPath);\n if (!fileExists(configPath)) {\n throw new Error(`config file does not exist or not reachable`);\n }\n debug('parsing config file: %o', configPath);\n try {\n if (/\\.ya?ml$/i.test(configPath)) {\n const yamlConfig = YAML.load(fs.readFileSync(configPath, 'utf8'), {\n strict: false,\n }) as ConfigYaml;\n\n return Object.assign({}, yamlConfig, {\n configPath,\n // @deprecated use configPath instead\n config_path: configPath,\n });\n }\n\n const jsonConfig = require(configPath) as ConfigYaml;\n return Object.assign({}, jsonConfig, {\n configPath,\n // @deprecated use configPath instead\n config_path: configPath,\n });\n } catch (e: any) {\n if (e.code !== 'MODULE_NOT_FOUND') {\n debug('config module not found %o error: %o', configPath, e.message);\n throw Error(APP_ERROR.CONFIG_NOT_VALID);\n }\n\n throw e;\n }\n}\n\nexport function fromJStoYAML(config: Partial<ConfigYaml>): string | null {\n debug('convert config from JSON to YAML');\n if (isObject(config)) {\n return YAML.dump(config);\n } else {\n throw new Error(`config is not a valid object`);\n }\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AAEA;AAGA;AAA4C;AAE5C,MAAMA,KAAK,GAAG,IAAAC,cAAU,EAAC,wBAAwB,CAAC;;AAElD;AACA;AACA;AACA;AACO,SAASC,eAAe,CAACC,UAAkB,EAIhD;EACAH,KAAK,CAAC,sBAAsB,EAAEG,UAAU,CAAC;EACzC,IAAI,CAAC,IAAAC,uBAAU,EAACD,UAAU,CAAC,EAAE;IAC3B,MAAM,IAAIE,KAAK,CAAE,6CAA4C,CAAC;EAChE;EACAL,KAAK,CAAC,yBAAyB,EAAEG,UAAU,CAAC;EAC5C,IAAI;IACF,IAAI,WAAW,CAACG,IAAI,CAACH,UAAU,CAAC,EAAE;MAChC,MAAMI,UAAU,GAAGC,eAAI,CAACC,IAAI,CAACC,WAAE,CAACC,YAAY,CAACR,UAAU,EAAE,MAAM,CAAC,EAAE;QAChES,MAAM,EAAE;MACV,CAAC,CAAe;MAEhB,OAAOC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAEP,UAAU,EAAE;QACnCJ,UAAU;QACV;QACAY,WAAW,EAAEZ;MACf,CAAC,CAAC;IACJ;IAEA,MAAMa,UAAU,GAAGC,OAAO,CAACd,UAAU,CAAe;IACpD,OAAOU,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAEE,UAAU,EAAE;MACnCb,UAAU;MACV;MACAY,WAAW,EAAEZ;IACf,CAAC,CAAC;EACJ,CAAC,CAAC,OAAOe,CAAM,EAAE;IACf,IAAIA,CAAC,CAACC,IAAI,KAAK,kBAAkB,EAAE;MACjCnB,KAAK,CAAC,sCAAsC,EAAEG,UAAU,EAAEe,CAAC,CAACE,OAAO,CAAC;MACpE,MAAMf,KAAK,CAACgB,eAAS,CAACC,gBAAgB,CAAC;IACzC;IAEA,MAAMJ,CAAC;EACT;AACF;AAEO,SAASK,YAAY,CAACC,MAA2B,EAAiB;EACvExB,KAAK,CAAC,kCAAkC,CAAC;EACzC,IAAI,IAAAyB,gBAAQ,EAACD,MAAM,CAAC,EAAE;IACpB,OAAOhB,eAAI,CAACkB,IAAI,CAACF,MAAM,CAAC;EAC1B,CAAC,MAAM;IACL,MAAM,IAAInB,KAAK,CAAE,8BAA6B,CAAC;EACjD;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verdaccio/config",
|
|
3
|
-
"version": "6.0.0-6-next.
|
|
3
|
+
"version": "6.0.0-6-next.62",
|
|
4
4
|
"description": "logger",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"node": ">=12"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@verdaccio/core": "6.0.0-6-next.
|
|
33
|
-
"@verdaccio/utils": "6.0.0-6-next.
|
|
32
|
+
"@verdaccio/core": "6.0.0-6-next.62",
|
|
33
|
+
"@verdaccio/utils": "6.0.0-6-next.30",
|
|
34
34
|
"debug": "4.3.4",
|
|
35
|
-
"yaml": "
|
|
35
|
+
"js-yaml": "4.1.0",
|
|
36
36
|
"lodash": "4.17.21",
|
|
37
37
|
"minimatch": "3.1.2",
|
|
38
38
|
"yup": "0.32.11"
|
package/src/parse.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import buildDebug from 'debug';
|
|
2
2
|
import fs from 'fs';
|
|
3
|
+
import YAML from 'js-yaml';
|
|
3
4
|
import { isObject } from 'lodash';
|
|
4
|
-
import YAML from 'yaml';
|
|
5
5
|
|
|
6
6
|
import { APP_ERROR } from '@verdaccio/core';
|
|
7
7
|
import { ConfigYaml } from '@verdaccio/types';
|
|
@@ -26,7 +26,7 @@ export function parseConfigFile(configPath: string): ConfigYaml & {
|
|
|
26
26
|
debug('parsing config file: %o', configPath);
|
|
27
27
|
try {
|
|
28
28
|
if (/\.ya?ml$/i.test(configPath)) {
|
|
29
|
-
const yamlConfig = YAML.
|
|
29
|
+
const yamlConfig = YAML.load(fs.readFileSync(configPath, 'utf8'), {
|
|
30
30
|
strict: false,
|
|
31
31
|
}) as ConfigYaml;
|
|
32
32
|
|
|
@@ -56,7 +56,7 @@ export function parseConfigFile(configPath: string): ConfigYaml & {
|
|
|
56
56
|
export function fromJStoYAML(config: Partial<ConfigYaml>): string | null {
|
|
57
57
|
debug('convert config from JSON to YAML');
|
|
58
58
|
if (isObject(config)) {
|
|
59
|
-
return YAML.
|
|
59
|
+
return YAML.dump(config);
|
|
60
60
|
} else {
|
|
61
61
|
throw new Error(`config is not a valid object`);
|
|
62
62
|
}
|
|
@@ -6,7 +6,7 @@ uplinks:
|
|
|
6
6
|
npmjs:
|
|
7
7
|
url: http://localhost:4873/
|
|
8
8
|
packages:
|
|
9
|
-
|
|
9
|
+
'@*/*':
|
|
10
10
|
access: $all
|
|
11
11
|
publish: $all
|
|
12
12
|
proxy: npmjs
|
|
@@ -32,7 +32,7 @@ packages:
|
|
|
32
32
|
access: $authenticated
|
|
33
33
|
publish: $authenticated
|
|
34
34
|
proxy: npmjs
|
|
35
|
-
|
|
35
|
+
'*':
|
|
36
36
|
access: $all
|
|
37
37
|
publish: $all
|
|
38
38
|
proxy: npmjs
|