fetch-node-website
Advanced tools
Comparing version 5.0.3 to 6.0.0
@@ -1,23 +0,19 @@ | ||
"use strict";var _got=_interopRequireDefault(require("got")); | ||
import got from"got"; | ||
var _options=require("./options.js"); | ||
var _progress=require("./progress.js");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}} | ||
import{getOpts}from"./options.js"; | ||
import{addProgress}from"./progress.js"; | ||
const fetchNodeWebsite=async function(path,opts){ | ||
const{mirror,progress}=(0,_options.getOpts)(path,opts); | ||
export default async function fetchNodeWebsite(path,opts){ | ||
const{mirror,progress}=getOpts(path,opts); | ||
const pathA=path.replace(LEADING_SLASH_REGEXP,""); | ||
const response=await _got.default.stream(pathA,{prefixUrl:mirror}); | ||
const response=await got.stream(pathA,{prefixUrl:mirror}); | ||
(0,_progress.addProgress)(response,progress,path); | ||
addProgress(response,progress,path); | ||
return response; | ||
}; | ||
} | ||
const LEADING_SLASH_REGEXP=/^\//u; | ||
module.exports=fetchNodeWebsite; | ||
//# sourceMappingURL=main.js.map |
@@ -1,6 +0,6 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getMirrorEnv=void 0;var _process=require("process"); | ||
import{env}from"process"; | ||
const getMirrorEnv=function(){ | ||
export const getMirrorEnv=function(){ | ||
const mirrorName=MIRRORS.find(isDefinedEnv); | ||
@@ -12,8 +12,8 @@ | ||
const mirror=_process.env[mirrorName]; | ||
const mirror=env[mirrorName]; | ||
return{mirror}; | ||
};exports.getMirrorEnv=getMirrorEnv; | ||
}; | ||
const isDefinedEnv=function(name){ | ||
return _process.env[name]!==undefined&&_process.env[name].trim()!==""; | ||
return env[name]!==undefined&&env[name].trim()!==""; | ||
}; | ||
@@ -20,0 +20,0 @@ |
@@ -1,16 +0,16 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.EXAMPLE_OPTS=exports.DEFAULT_OPTS=exports.getOpts=void 0;var _filterObj=_interopRequireDefault(require("filter-obj")); | ||
var _jestValidate=require("jest-validate"); | ||
import filterObj from"filter-obj"; | ||
import{validate}from"jest-validate"; | ||
var _mirror=require("./mirror.js");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}} | ||
import{getMirrorEnv}from"./mirror.js"; | ||
const getOpts=function(path,opts={}){ | ||
export const getOpts=function(path,opts={}){ | ||
validateBasic(path,opts); | ||
(0,_jestValidate.validate)(opts,{exampleConfig:EXAMPLE_OPTS}); | ||
validate(opts,{exampleConfig:EXAMPLE_OPTS}); | ||
const optsA=(0,_filterObj.default)(opts,isDefined); | ||
const mirrorEnv=(0,_mirror.getMirrorEnv)(); | ||
const optsA=filterObj(opts,isDefined); | ||
const mirrorEnv=getMirrorEnv(); | ||
const optsB={...DEFAULT_OPTS,...mirrorEnv,...optsA}; | ||
return optsB; | ||
};exports.getOpts=getOpts; | ||
}; | ||
@@ -23,9 +23,9 @@ const validateBasic=function(path){ | ||
const DEFAULT_OPTS={ | ||
export const DEFAULT_OPTS={ | ||
progress:false, | ||
mirror:"https://nodejs.org/dist"};exports.DEFAULT_OPTS=DEFAULT_OPTS; | ||
mirror:"https://nodejs.org/dist"}; | ||
const EXAMPLE_OPTS={ | ||
...DEFAULT_OPTS};exports.EXAMPLE_OPTS=EXAMPLE_OPTS; | ||
export const EXAMPLE_OPTS={ | ||
...DEFAULT_OPTS}; | ||
@@ -32,0 +32,0 @@ |
@@ -1,13 +0,16 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.addProgress=void 0;var _stream=require("stream"); | ||
var _util=require("util"); | ||
import{finished}from"stream"; | ||
import{promisify}from"util"; | ||
var _chalk=require("chalk"); | ||
var _cliProgress=require("cli-progress"); | ||
var _figures=require("figures"); | ||
import{MultiBar}from"cli-progress"; | ||
import colorsOption from"colors-option"; | ||
import figures from"figures"; | ||
const pFinished=(0,_util.promisify)(_stream.finished); | ||
const pFinished=promisify(finished); | ||
const{green}=colorsOption(); | ||
const addProgress=async function(response,progress,path){ | ||
export const addProgress=async function(response,progress,path){ | ||
if(!progress||!showsBar()){ | ||
@@ -28,6 +31,6 @@ return; | ||
stopBar(bar); | ||
};exports.addProgress=addProgress; | ||
}; | ||
const MULTIBAR_OPTS={ | ||
format:` ${(0,_chalk.green)(_figures.nodejs)} {prefix} {bar}`, | ||
format:` ${green(figures.nodejs)} {prefix} {bar}`, | ||
barCompleteChar:"\u2588", | ||
@@ -44,3 +47,3 @@ barIncompleteChar:"\u2591", | ||
const multibar=new _cliProgress.MultiBar(MULTIBAR_OPTS); | ||
const multibar=new MultiBar(MULTIBAR_OPTS); | ||
@@ -47,0 +50,0 @@ |
{ | ||
"name": "fetch-node-website", | ||
"version": "5.0.3", | ||
"main": "build/src/main.js", | ||
"version": "6.0.0", | ||
"type": "module", | ||
"exports": "./build/src/main.js", | ||
"main": "./build/src/main.js", | ||
"files": [ | ||
"build/src", | ||
"examples", | ||
"!~" | ||
"build/src/**/*.{js,ts,map,json,sh,md}", | ||
"examples/**/*.{js,ts,map,json,sh,md}" | ||
], | ||
@@ -13,7 +14,2 @@ "scripts": { | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-push": "gulp -LL check --full" | ||
} | ||
}, | ||
"description": "Fetch releases on nodejs.org", | ||
@@ -54,21 +50,18 @@ "keywords": [ | ||
"dependencies": { | ||
"chalk": "^4.0.0", | ||
"cli-progress": "^3.7.0", | ||
"cli-progress": "^3.8.2", | ||
"colors-option": "^2.0.1", | ||
"figures": "^3.2.0", | ||
"filter-obj": "^2.0.1", | ||
"got": "^10.7.0", | ||
"jest-validate": "^25.3.0" | ||
"got": "^11.8.2", | ||
"jest-validate": "^27.0.2" | ||
}, | ||
"devDependencies": { | ||
"@ehmicky/dev-tasks": "^0.31.35", | ||
"ava": "^3.6.0", | ||
"get-stream": "^5.1.0", | ||
"gulp": "^4.0.2", | ||
"husky": "^4.2.5", | ||
"sinon": "^9.0.1", | ||
"test-each": "^2.0.0" | ||
"@ehmicky/dev-tasks": "^1.0.34", | ||
"get-stream": "^6.0.0", | ||
"sinon": "^11.1.1", | ||
"test-each": "^3.0.1" | ||
}, | ||
"engines": { | ||
"node": ">=10.17.0" | ||
"node": ">=12.20.0" | ||
} | ||
} |
[![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) | ||
[![Build](https://github.com/ehmicky/fetch-node-website/workflows/Build/badge.svg)](https://github.com/ehmicky/fetch-node-website/actions) | ||
[![Node](https://img.shields.io/node/v/fetch-node-website.svg?logo=node.js)](https://www.npmjs.com/package/fetch-node-website) | ||
[![Gitter](https://img.shields.io/gitter/room/ehmicky/fetch-node-website.svg?logo=gitter)](https://gitter.im/ehmicky/fetch-node-website) | ||
[![Twitter](https://img.shields.io/badge/%E2%80%8B-twitter-4cc61e.svg?logo=twitter)](https://twitter.com/intent/follow?screen_name=ehmicky) | ||
@@ -19,3 +18,3 @@ [![Medium](https://img.shields.io/badge/%E2%80%8B-medium-4cc61e.svg?logo=medium)](https://medium.com/@ehmicky) | ||
```js | ||
const fetchNodeWebsite = require('fetch-node-website') | ||
import fetchNodeWebsite from 'fetch-node-website' | ||
@@ -40,2 +39,6 @@ const stream = await fetchNodeWebsite('v12.8.0/node-v12.8.0-linux-x64.tar.gz') | ||
This package is an ES module and must be loaded using | ||
[an `import` or `import()` statement](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c), | ||
not `require()`. | ||
# Usage | ||
@@ -74,2 +77,6 @@ | ||
- [`get-node`](https://github.com/ehmicky/get-node): Download Node.js | ||
- [`preferred-node-version`](https://github.com/ehmicky/preferred-node-version): | ||
Get the preferred Node.js version of a project or user | ||
- [`node-version-alias`](https://github.com/ehmicky/node-version-alias): Resolve | ||
Node.js version aliases like `latest`, `lts` or `erbium` | ||
- [`normalize-node-version`](https://github.com/ehmicky/normalize-node-version): | ||
@@ -82,8 +89,4 @@ Normalize and validate Node.js versions | ||
If you found a bug or would like a new feature, _don't hesitate_ to | ||
[submit an issue on GitHub](../../issues). | ||
For any question, _don't hesitate_ to [submit an issue on GitHub](../../issues). | ||
For other questions, feel free to | ||
[chat with us on Gitter](https://gitter.im/ehmicky/fetch-node-website). | ||
Everyone is welcome regardless of personal background. We enforce a | ||
@@ -90,0 +93,0 @@ [Code of conduct](CODE_OF_CONDUCT.md) in order to promote a positive and |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
4
110
Yes
30053
11
+ Addedcolors-option@^2.0.1
+ Added@jest/types@27.5.1(transitive)
+ Added@sindresorhus/is@4.6.0(transitive)
+ Added@types/istanbul-reports@3.0.4(transitive)
+ Added@types/yargs@16.0.9(transitive)
+ Addedansi-styles@5.2.0(transitive)
+ Addedcacheable-lookup@5.0.4(transitive)
+ Addedcamelcase@6.3.0(transitive)
+ Addedcolors-option@2.0.1(transitive)
+ Addeddecompress-response@6.0.0(transitive)
+ Addedgot@11.8.6(transitive)
+ Addedhttp2-wrapper@1.0.3(transitive)
+ Addedis-plain-obj@4.1.0(transitive)
+ Addedjest-get-type@27.5.1(transitive)
+ Addedjest-validate@27.5.1(transitive)
+ Addedmimic-response@3.1.0(transitive)
+ Addedpretty-format@27.5.1(transitive)
+ Addedquick-lru@5.1.1(transitive)
+ Addedreact-is@17.0.2(transitive)
+ Addedresolve-alpn@1.2.1(transitive)
- Removedchalk@^4.0.0
- Removed@jest/types@25.5.0(transitive)
- Removed@sindresorhus/is@2.1.1(transitive)
- Removed@types/istanbul-reports@1.1.2(transitive)
- Removed@types/yargs@15.0.19(transitive)
- Removedcacheable-lookup@2.0.1(transitive)
- Removedcamelcase@5.3.1(transitive)
- Removedchalk@3.0.0(transitive)
- Removeddecompress-response@5.0.0(transitive)
- Removedduplexer3@0.1.5(transitive)
- Removedgot@10.7.0(transitive)
- Removedjest-get-type@25.2.6(transitive)
- Removedjest-validate@25.5.0(transitive)
- Removedmimic-response@2.1.0(transitive)
- Removedp-event@4.2.0(transitive)
- Removedp-finally@1.0.0(transitive)
- Removedp-timeout@3.2.0(transitive)
- Removedpretty-format@25.5.0(transitive)
- Removedreact-is@16.13.1(transitive)
- Removedto-readable-stream@2.1.0(transitive)
- Removedtype-fest@0.10.0(transitive)
Updatedcli-progress@^3.8.2
Updatedgot@^11.8.2
Updatedjest-validate@^27.0.2