Skip to content

Commit b8a4b4b

Browse files
committed
refactor: drop node 14.15 support
1 parent 6d45e95 commit b8a4b4b

File tree

7 files changed

+6
-27
lines changed

7 files changed

+6
-27
lines changed

.github/workflows/unit-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
node-version: ['14.15', '16']
18+
node-version: ['14.17', '16']
1919

2020
steps:
2121
- uses: actions/checkout@v3

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757

5858
### Node.js
5959

60-
Node.js >= 14.15.0 (推荐 v14.17.0 及以上)
60+
Node.js >= v14.17.0
6161

6262
```bash
6363
npm i jike-sdk

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"vitest": "^0.7.11"
7272
},
7373
"engines": {
74-
"node": ">=14.15.0"
74+
"node": ">=14.17.0"
7575
},
7676
"volta": {
7777
"node": "16.14.2"

src/globals.d.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/node-shim.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { randomUUID } from 'crypto'
21
import {
32
File,
43
FormData,
@@ -23,8 +22,4 @@ if (!globals.FormData) {
2322
globals.FormData = FormData
2423
}
2524

26-
// UUID
27-
if (!globals.crypto) globals.crypto = {}
28-
if (!globals.crypto.randomUUID) globals.crypto.randomUUID = randomUUID
29-
30-
export { fetch, Headers, Request, Response, FormData, randomUUID }
25+
export { fetch, Headers, Request, Response, FormData }

src/utils.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
export const generateUUID = (): string | undefined => {
22
try {
3-
if ((globalThis?.crypto as any)?.randomUUID) {
4-
return (globalThis.crypto as any).randomUUID()
5-
} else if (IS_NODE) {
6-
return randomUUID()
7-
}
3+
return globalThis?.crypto?.randomUUID?.()
84
// eslint-disable-next-line no-empty
95
} catch {}
106
return undefined

tsup.config.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ const modern = (): Options => {
2222
target: 'es2019',
2323
format: ['esm'],
2424
splitting: false,
25-
define: {
26-
IS_NODE: 'false',
27-
},
2825
minifySyntax: true,
2926
esbuildOptions: (options) => {
3027
options.outExtension = {}
@@ -34,13 +31,10 @@ const modern = (): Options => {
3431

3532
const node = (): Options => ({
3633
...common,
37-
target: 'node14.15',
34+
target: 'node14.17',
3835
platform: 'node',
3936
format: ['esm'],
4037
clean: true,
41-
define: {
42-
IS_NODE: 'true',
43-
},
4438
minifySyntax: true,
4539
inject: [$r('src/node-shim.ts')],
4640
esbuildOptions: (options) => {

0 commit comments

Comments
 (0)