Skip to content

Commit

Permalink
feat: remove ip and debug deps (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Jun 13, 2024
1 parent 559fe5b commit edf338e
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 138 deletions.
72 changes: 0 additions & 72 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

53 changes: 11 additions & 42 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,17 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI
name: CI for 2.x

on:
push:
branches:
- main
- master
- 2.x
branches: [ 2.x ]
pull_request:
branches:
- main
- master
- 2.x
schedule:
- cron: '0 2 * * *'
branches: [ 2.x ]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
node-version: [8, 10, 12, 14, 16]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- name: Checkout Git Source
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install Dependencies
run: npm i -g npminstall@5 && npminstall

- name: Continuous Integration
run: npm run ci

- name: Code Coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
Job:
name: Node.js
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
with:
os: 'ubuntu-latest, macos-latest, windows-latest'
version: '8, 10, 12, 14, 16'
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Release

on:
push:
branches: [ 2.x ]

jobs:
release:
name: Node.js
uses: node-modules/github-actions/.github/workflows/node-release.yml@master
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

[![NPM version][npm-image]][npm-url]
[![Node.js CI](https://github.com/node-modules/urllib/actions/workflows/nodejs.yml/badge.svg)](https://github.com/node-modules/urllib/actions/workflows/nodejs.yml)
[![Test coverage][codecov-image]][codecov-url]
[![codecov](https://codecov.io/gh/node-modules/urllib/branch/2.x/graph/badge.svg?token=xXIihkywZr)](https://codecov.io/gh/node-modules/urllib)
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/urllib.svg?style=flat-square
[npm-url]: https://npmjs.org/package/urllib
[codecov-image]: https://codecov.io/gh/node-modules/urllib/branch/master/graph/badge.svg
[codecov-url]: https://codecov.io/gh/node-modules/urllib
[snyk-image]: https://snyk.io/test/npm/urllib/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/urllib
[download-image]: https://img.shields.io/npm/dm/urllib.svg?style=flat-square
Expand Down
7 changes: 4 additions & 3 deletions examples/timing.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var agent = new http.Agent({ keepAlive: true });
var url = process.argv[2] || 'https://cnodejs.org';
console.log('timing: %s', url);

var count = 10000;
var count = 1;

function request(index) {
if (index === count) {
Expand All @@ -19,8 +19,9 @@ function request(index) {
urllib.request(url, {
// data: { wd: 'nodejs' },
timing: true,
httpsAgent: httpsAgent,
agent: agent,
// httpsAgent: httpsAgent,
// agent: agent,
method: 'POST',
}, function (err, data, res) {
if (err) {
console.log(err);
Expand Down
2 changes: 1 addition & 1 deletion lib/detect_proxy_agent.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var debug = require('debug')('urllib:detect_proxy_agent');
var debug = require('util').debuglog('urllib:detect_proxy_agent');
var getProxyFromURI = require('./get_proxy_from_uri');

var proxyAgents = {};
Expand Down
2 changes: 1 addition & 1 deletion lib/httpclient2.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

var util = require('util');
var debug = require('debug')('urllib');
var debug = require('util').debuglog('urllib');
var ms = require('humanize-ms');
var HttpClient = require('./httpclient');

Expand Down
10 changes: 5 additions & 5 deletions lib/urllib.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use strict';

var debug = require('debug')('urllib');
var debug = require('util').debuglog('urllib');
var path = require('path');
var dns = require('dns');
var net = require('net');
var http = require('http');
var https = require('https');
var urlutil = require('url');
var URL = urlutil.URL;
var util = require('util');
var qs = require('qs');
var ip = require('ip');
var querystring = require('querystring');
var zlib = require('zlib');
var ua = require('default-user-agent');
Expand Down Expand Up @@ -1009,11 +1009,11 @@ function requestWithCallback(url, args, callback) {

if (args.checkAddress) {
var hostname = parsedUrl.hostname;
// if request hostname is ip, custom lookup wont excute
// if request hostname is ip, custom lookup wont execute
var family = null;
if (ip.isV4Format(hostname)) {
if (net.isIPv4(hostname)) {
family = 4;
} else if (ip.isV6Format(hostname)) {
} else if (net.isIPv6(hostname)) {
family = 6;
}
if (family) {
Expand Down
12 changes: 1 addition & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,12 @@
"dependencies": {
"any-promise": "^1.3.0",
"content-type": "^1.0.2",
"debug": "^2.6.9",
"default-user-agent": "^1.0.0",
"digest-header": "^1.0.0",
"ee-first": "~1.1.1",
"formstream": "^1.1.0",
"humanize-ms": "^1.2.0",
"iconv-lite": "^0.4.15",
"ip": "^1.1.5",
"pump": "^3.0.0",
"qs": "^6.4.0",
"statuses": "^1.3.1",
Expand All @@ -67,8 +65,7 @@
"busboy": "^0.2.14",
"co": "*",
"coffee": "1",
"egg-ci": "^1.15.0",
"git-contributor": "^1.0.10",
"git-contributor": "2",
"http-proxy": "^1.16.2",
"istanbul": "*",
"jshint": "*",
Expand All @@ -87,12 +84,5 @@
"engines": {
"node": ">= 0.10.0"
},
"ci": {
"type": "github",
"os": {
"github": "linux, windows, macos"
},
"version": "8, 10, 12, 14, 16"
},
"license": "MIT"
}

0 comments on commit edf338e

Please sign in to comment.