fetch-node-website
Advanced tools
Comparing version 7.1.0 to 7.2.0
@@ -5,17 +5,6 @@ import{env}from"process"; | ||
export const getMirrorEnv=function(){ | ||
const mirrorName=MIRRORS.find(isDefinedEnv); | ||
if(mirrorName===undefined){ | ||
return{}; | ||
} | ||
const mirror=env[mirrorName]; | ||
return{mirror}; | ||
export const getDefaultMirror=function(){var _MIRRORS$map$find; | ||
return(_MIRRORS$map$find=MIRRORS.map(getEnv).find(Boolean))!==null&&_MIRRORS$map$find!==void 0?_MIRRORS$map$find:DEFAULT_MIRROR; | ||
}; | ||
const isDefinedEnv=function(name){ | ||
return env[name]!==undefined&&env[name].trim()!==""; | ||
}; | ||
const MIRRORS=[ | ||
@@ -26,2 +15,9 @@ "NODE_MIRROR", | ||
"NODIST_NODE_MIRROR"]; | ||
const getEnv=function(name){ | ||
return env[name]; | ||
}; | ||
const DEFAULT_MIRROR="https://nodejs.org/dist"; | ||
//# sourceMappingURL=mirror.js.map |
@@ -1,5 +0,4 @@ | ||
import{excludeKeys}from"filter-obj"; | ||
import{validate}from"jest-validate"; | ||
import isPlainObj from"is-plain-obj"; | ||
import{getMirrorEnv}from"./mirror.js"; | ||
import{getDefaultMirror}from"./mirror.js"; | ||
@@ -9,28 +8,29 @@ | ||
validateBasic(path,opts); | ||
validate(opts,{exampleConfig:EXAMPLE_OPTS}); | ||
const optsA=excludeKeys(opts,isUndefined); | ||
const mirrorEnv=getMirrorEnv(); | ||
const optsB={...DEFAULT_OPTS,...mirrorEnv,...optsA}; | ||
return optsB; | ||
const{progress=false,mirror=getDefaultMirror()}=opts; | ||
validateProgress(progress); | ||
validateMirror(mirror); | ||
return{progress,mirror}; | ||
}; | ||
const validateBasic=function(path){ | ||
const validateBasic=function(path,opts){ | ||
if(typeof path!=="string"||path.trim()===""){ | ||
throw new TypeError(`Path must be a non-empty string: ${path}`); | ||
} | ||
if(!isPlainObj(opts)){ | ||
throw new TypeError(`Options must be a plain object: ${opts}`); | ||
} | ||
}; | ||
export const DEFAULT_OPTS={ | ||
progress:false, | ||
mirror:"https://nodejs.org/dist"}; | ||
const validateProgress=function(progress){ | ||
if(typeof progress!=="boolean"){ | ||
throw new TypeError(`Option "progress" must be a boolean: ${progress}`); | ||
} | ||
}; | ||
export const EXAMPLE_OPTS={ | ||
...DEFAULT_OPTS}; | ||
const isUndefined=function(key,value){ | ||
return value===undefined; | ||
const validateMirror=function(mirror){ | ||
if(typeof mirror!=="string"){ | ||
throw new TypeError(`Option "mirror" must be a string: ${mirror}`); | ||
} | ||
}; | ||
//# sourceMappingURL=options.js.map |
{ | ||
"name": "fetch-node-website", | ||
"version": "7.1.0", | ||
"version": "7.2.0", | ||
"type": "module", | ||
@@ -50,14 +50,13 @@ "exports": "./build/src/main.js", | ||
"cli-progress": "^3.11.2", | ||
"colors-option": "^4.2.0", | ||
"colors-option": "^4.4.0", | ||
"figures": "^5.0.0", | ||
"filter-obj": "^5.1.0", | ||
"got": "^12.1.0", | ||
"jest-validate": "^28.1.3" | ||
"got": "^12.3.1", | ||
"is-plain-obj": "^4.1.0" | ||
}, | ||
"devDependencies": { | ||
"@ehmicky/dev-tasks": "^1.0.84", | ||
"@ehmicky/dev-tasks": "^1.0.94", | ||
"@types/node": "^18.0.0", | ||
"get-stream": "^6.0.0", | ||
"sinon": "^14.0.0", | ||
"test-each": "^5.2.0" | ||
"test-each": "^5.4.1" | ||
}, | ||
@@ -64,0 +63,0 @@ "engines": { |
[![Codecov](https://img.shields.io/codecov/c/github/ehmicky/fetch-node-website.svg?label=tested&logo=codecov)](https://codecov.io/gh/ehmicky/fetch-node-website) | ||
[![Node](https://img.shields.io/node/v/fetch-node-website.svg?logo=node.js)](https://www.npmjs.com/package/fetch-node-website) | ||
[![TypeScript](https://img.shields.io/badge/-typed-brightgreen?logo=typescript&colorA=gray)](/src/main.d.ts) | ||
[![TypeScript](https://img.shields.io/badge/-typed-brightgreen?logo=typescript&colorA=gray&logoColor=0096ff)](/src/main.d.ts) | ||
[![Node](https://img.shields.io/node/v/fetch-node-website.svg?logo=node.js&logoColor=66cc33)](https://www.npmjs.com/package/fetch-node-website) | ||
[![Twitter](https://img.shields.io/badge/%E2%80%8B-twitter-brightgreen.svg?logo=twitter)](https://twitter.com/intent/follow?screen_name=ehmicky) | ||
@@ -5,0 +5,0 @@ [![Medium](https://img.shields.io/badge/%E2%80%8B-medium-brightgreen.svg?logo=medium)](https://medium.com/@ehmicky) |
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
21120
5
152
+ Addedis-plain-obj@^4.1.0
- Removedfilter-obj@^5.1.0
- Removedjest-validate@^28.1.3
- Removed@jest/schemas@28.1.3(transitive)
- Removed@jest/types@28.1.3(transitive)
- Removed@sinclair/typebox@0.24.51(transitive)
- Removed@types/istanbul-lib-coverage@2.0.6(transitive)
- Removed@types/istanbul-lib-report@3.0.3(transitive)
- Removed@types/istanbul-reports@3.0.4(transitive)
- Removed@types/node@22.9.0(transitive)
- Removed@types/yargs@17.0.33(transitive)
- Removed@types/yargs-parser@21.0.3(transitive)
- Removedansi-styles@4.3.05.2.0(transitive)
- Removedcamelcase@6.3.0(transitive)
- Removedchalk@4.1.2(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedfilter-obj@5.1.0(transitive)
- Removedhas-flag@4.0.0(transitive)
- Removedjest-get-type@28.0.2(transitive)
- Removedjest-validate@28.1.3(transitive)
- Removedleven@3.1.0(transitive)
- Removedpretty-format@28.1.3(transitive)
- Removedreact-is@18.3.1(transitive)
- Removedsupports-color@7.2.0(transitive)
- Removedundici-types@6.19.8(transitive)
Updatedcolors-option@^4.4.0
Updatedgot@^12.3.1