@npmcli/config
Advanced tools
Comparing version 8.2.1 to 8.2.2
@@ -5,8 +5,6 @@ // TODO: set the scope config from package.json or explicit cli config | ||
const nopt = require('nopt') | ||
const mapWorkspaces = require('@npmcli/map-workspaces') | ||
const rpj = require('read-package-json-fast') | ||
const log = require('proc-log') | ||
const { resolve, dirname, join } = require('path') | ||
const { homedir } = require('os') | ||
const { resolve, dirname, join } = require('node:path') | ||
const { homedir } = require('node:os') | ||
const { | ||
@@ -32,20 +30,2 @@ readFile, | ||
// define a custom getter, but turn into a normal prop | ||
// if we set it. otherwise it can't be set on child objects | ||
const settableGetter = (obj, key, get) => { | ||
Object.defineProperty(obj, key, { | ||
get, | ||
set (value) { | ||
Object.defineProperty(obj, key, { | ||
value, | ||
configurable: true, | ||
writable: true, | ||
enumerable: true, | ||
}) | ||
}, | ||
configurable: true, | ||
enumerable: true, | ||
}) | ||
} | ||
const typeDefs = require('./type-defs.js') | ||
@@ -55,9 +35,4 @@ const nerfDart = require('./nerf-dart.js') | ||
const parseField = require('./parse-field.js') | ||
const typeDescription = require('./type-description.js') | ||
const setEnvs = require('./set-envs.js') | ||
const { | ||
ErrInvalidAuth, | ||
} = require('./errors.js') | ||
// types that can be saved back to | ||
@@ -335,3 +310,17 @@ const confFileTypes = new Set([ | ||
// returns `/foo/etc/npmrc`, but better to not change it at this point. | ||
settableGetter(data, 'globalconfig', () => resolve(this.#get('prefix'), 'etc/npmrc')) | ||
// define a custom getter, but turn into a normal prop | ||
// if we set it. otherwise it can't be set on child objects | ||
Object.defineProperty(data, 'globalconfig', { | ||
get: () => resolve(this.#get('prefix'), 'etc/npmrc'), | ||
set (value) { | ||
Object.defineProperty(data, 'globalconfig', { | ||
value, | ||
configurable: true, | ||
writable: true, | ||
enumerable: true, | ||
}) | ||
}, | ||
configurable: true, | ||
enumerable: true, | ||
}) | ||
} | ||
@@ -451,2 +440,3 @@ | ||
if (authProblems.length) { | ||
const { ErrInvalidAuth } = require('./errors.js') | ||
throw new ErrInvalidAuth(authProblems) | ||
@@ -520,2 +510,3 @@ } | ||
invalidHandler (k, val, type, source, where) { | ||
const typeDescription = require('./type-description.js') | ||
log.warn( | ||
@@ -705,2 +696,3 @@ 'invalid config', | ||
if (this.localPrefix && hasPackageJson) { | ||
const rpj = require('read-package-json-fast') | ||
// if we already set localPrefix but this dir has a package.json | ||
@@ -714,2 +706,3 @@ // then we need to see if `p` is a workspace root by reading its package.json | ||
const mapWorkspaces = require('@npmcli/map-workspaces') | ||
const workspaces = await mapWorkspaces({ cwd: p, pkg }) | ||
@@ -716,0 +709,0 @@ for (const w of workspaces.values()) { |
@@ -1,2 +0,2 @@ | ||
const { URL } = require('url') | ||
const { URL } = require('node:url') | ||
@@ -3,0 +3,0 @@ /** |
// Parse a field, coercing it to the best type available. | ||
const typeDefs = require('./type-defs.js') | ||
const envReplace = require('./env-replace.js') | ||
const { resolve } = require('path') | ||
const { resolve } = require('node:path') | ||
@@ -6,0 +6,0 @@ const { parse: umaskParse } = require('./umask.js') |
const nopt = require('nopt') | ||
const { Umask, validate: validateUmask } = require('./umask.js') | ||
const { validate: validateUmask } = require('./umask.js') | ||
const semver = require('semver') | ||
class Umask {} | ||
class Semver {} | ||
const semverValid = require('semver/functions/valid') | ||
const validateSemver = (data, k, val) => { | ||
const valid = semver.valid(val) | ||
const valid = semverValid(val) | ||
if (!valid) { | ||
@@ -26,3 +28,3 @@ return false | ||
semver: { | ||
type: semver, | ||
type: Semver, | ||
validate: validateSemver, | ||
@@ -29,0 +31,0 @@ description: 'full valid SemVer string', |
@@ -1,2 +0,1 @@ | ||
class Umask {} | ||
const parse = val => { | ||
@@ -36,2 +35,2 @@ // this is run via nopt and parse field where everything is | ||
module.exports = { Umask, parse, validate } | ||
module.exports = { parse, validate } |
{ | ||
"name": "@npmcli/config", | ||
"version": "8.2.1", | ||
"version": "8.2.2", | ||
"files": [ | ||
@@ -5,0 +5,0 @@ "bin/", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
134087
3584