Skip to content

Commit

Permalink
feat: use utility@2 (#5312)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


- **Chores**
	- Updated Node.js versions in CI workflows to include version 22.
- Removed an unused parameter in the release workflow to streamline
operations.

- **Refactor**
- Improved code efficiency in HTTP client by using destructured imports.

- **Documentation**
- Updated software dependencies in `package.json` to enhance
functionality and compatibility.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
fengmk2 committed May 8, 2024
1 parent ad1591b commit 9bf5f22
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ jobs:
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
with:
os: 'ubuntu-latest, macos-latest, windows-latest'
version: '14, 16, 18, 20'
version: '14, 16, 18, 20, 22'
install: 'npm i -g npminstall && npminstall'
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
with:
checkTest: false
install: 'npm install --legacy-peer-deps --no-package-lock --no-fund'
6 changes: 3 additions & 3 deletions lib/core/dnscache_httpclient.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const dns = require('dns').promises;
const dns = require('node:dns').promises;
const LRU = require('ylru');
const { assign } = require('utility');
const HttpClient = require('./httpclient');
const utility = require('utility');
const utils = require('./utils');

const IP_REGEX = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
Expand Down Expand Up @@ -84,7 +84,7 @@ module.exports = DNSCacheHttpClient;

function formatDnsLookupUrl(host, url, address) {
if (typeof url === 'string') return url.replace(host, address);
const urlObj = utility.assign({}, url);
const urlObj = assign({}, url);
urlObj.hostname = urlObj.hostname.replace(host, address);
if (urlObj.host) {
urlObj.host = urlObj.host.replace(host, address);
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"egg-cluster": "^2.0.0",
"egg-cookies": "^2.6.1",
"egg-core": "^5.4.0",
"egg-development": "^2.7.0",
"egg-development": "^3.0.0",
"egg-errors": "^2.3.1",
"egg-i18n": "^2.1.1",
"egg-jsonp": "^2.0.0",
Expand All @@ -45,7 +45,7 @@
"extend2": "^1.0.1",
"graceful": "^1.1.0",
"humanize-ms": "^1.2.1",
"is-type-of": "^1.2.1",
"is-type-of": "^2.1.0",
"koa-bodyparser": "^4.4.1",
"koa-is-json": "^1.0.0",
"koa-override": "^3.0.0",
Expand All @@ -55,7 +55,7 @@
"sendmessage": "^2.0.0",
"urllib": "^2.33.0",
"urllib-next": "npm:urllib@^3.22.4",
"utility": "^1.17.0",
"utility": "^2.1.0",
"ylru": "^1.3.2"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion test/doc.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('test/doc.test.js', () => {

const mainNodejsVersion = parseInt(process.versions.node.split('.')[0]);

if (process.platform !== 'win32' && mainNodejsVersion >= 18) {
if (process.platform === 'linux' && mainNodejsVersion >= 18) {
const cwd = path.dirname(__dirname);
const dumi = path.join(cwd, 'node_modules', '.bin', 'dumi');
await runscript(`cross-env NODE_OPTIONS=--openssl-legacy-provider APP_ROOT=./site ${dumi} build`,
Expand Down

0 comments on commit 9bf5f22

Please sign in to comment.