Skip to content

Commit c65e264

Browse files
authored
revert: revert #245 (#247)
This reverts commit 281a09c aka #245 so we can re-publish it as a breaking change.
1 parent c1595bc commit c65e264

File tree

162 files changed

+1443
-334
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+1443
-334
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ jobs:
1313
strategy:
1414
matrix:
1515
node-version:
16-
- lts/-1
17-
- lts/*
18-
- latest
16+
- 18
17+
- 20
1918

2019
steps:
2120
- uses: actions/checkout@v4

.vscode/settings.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
{
2-
"editor.defaultFormatter": "esbenp.prettier-vscode",
32
"editor.codeActionsOnSave": {
43
"source.fixAll": "explicit"
54
},
6-
"editor.formatOnSave": true,
5+
"editor.defaultFormatter": "esbenp.prettier-vscode",
76

87
// controlled by the .editorconfig at root since we can't map vscode settings directly to files
98
// https://github.com/microsoft/vscode/issues/35350
10-
"files.insertFinalNewline": false,
11-
12-
"search.exclude": {
13-
"coverage": true
14-
}
9+
"files.insertFinalNewline": false
1510
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ console.log(
109109
}),
110110
);
111111

112-
// generate Node.js: Axios output
113-
console.log(snippet.convert('node', 'axios'));
112+
// generate Node.js: Unirest output
113+
console.log(snippet.convert('node', 'unirest'));
114114
```
115115

116116
### addTarget(target)

integrations/node.Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ WORKDIR /src
1313
ADD package.json /src/
1414

1515
# https://www.npmjs.com/package/axios
16-
RUN npm install axios && \
16+
# https://www.npmjs.com/package/request
17+
# Installing node-fetch@2 because as of 3.0 is't now an ESM-only package.
18+
# https://www.npmjs.com/package/node-fetch
19+
RUN npm install axios request node-fetch@2 && \
1720
npm install
1821

1922
ADD . /src

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,14 @@
5353
"ocaml",
5454
"php",
5555
"python",
56+
"request",
5657
"requests",
5758
"ruby",
5859
"shell",
5960
"snippet",
6061
"swift",
6162
"swift",
63+
"unirest",
6264
"xhr",
6365
"xmlhttprequest"
6466
],

src/fixtures/customTarget.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import type { Target } from '../targets/index.js';
22

3-
import { axios } from '../targets/node/axios/client.js';
3+
import { request } from '../targets/node/request/client.js';
44

55
export const customTarget = {
66
info: {
7-
key: 'node-variant',
8-
title: 'Node Variant',
7+
key: 'js-variant',
8+
title: 'JavaScript Variant',
99
extname: '.js',
10-
default: 'axios',
10+
default: 'request',
1111
},
1212
clientsById: {
13-
axios,
13+
request,
1414
},
1515
} as unknown as Target;

src/helpers/__snapshots__/utils.test.ts.snap

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ exports[`availableTargets > returns all available targets 1`] = `
150150
"title": "jQuery",
151151
},
152152
],
153-
"default": "fetch",
153+
"default": "xhr",
154154
"key": "javascript",
155155
"title": "JavaScript",
156156
},
@@ -192,23 +192,39 @@ exports[`availableTargets > returns all available targets 1`] = `
192192
"link": "http://nodejs.org/api/http.html#http_http_request_options_callback",
193193
"title": "HTTP",
194194
},
195+
{
196+
"description": "Simplified HTTP request client",
197+
"extname": ".cjs",
198+
"installation": "npm install request --save",
199+
"key": "request",
200+
"link": "https://github.com/request/request",
201+
"title": "Request",
202+
},
203+
{
204+
"description": "Lightweight HTTP Request Client Library",
205+
"extname": ".cjs",
206+
"key": "unirest",
207+
"link": "http://unirest.io/nodejs.html",
208+
"title": "Unirest",
209+
},
195210
{
196211
"description": "Promise based HTTP client for the browser and node.js",
197-
"extname": ".js",
212+
"extname": ".cjs",
198213
"installation": "npm install axios --save",
199214
"key": "axios",
200215
"link": "https://github.com/axios/axios",
201216
"title": "Axios",
202217
},
203218
{
204-
"description": "Perform asynchronous HTTP requests with the Fetch API",
205-
"extname": ".js",
219+
"description": "Simplified HTTP node-fetch client",
220+
"extname": ".cjs",
221+
"installation": "npm install node-fetch@2 --save",
206222
"key": "fetch",
207-
"link": "https://nodejs.org/docs/latest/api/globals.html#fetch",
208-
"title": "fetch",
223+
"link": "https://github.com/bitinn/node-fetch",
224+
"title": "Fetch",
209225
},
210226
],
211-
"default": "fetch",
227+
"default": "native",
212228
"key": "node",
213229
"title": "Node.js",
214230
},

src/helpers/utils.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('extname', () => {
2222
expect(extname('c', 'libcurl')).toBe('.c');
2323
expect(extname('clojure', 'clj_http')).toBe('.clj');
2424
expect(extname('javascript', 'axios')).toBe('.js');
25-
expect(extname('node', 'axios')).toBe('.js');
25+
expect(extname('node', 'axios')).toBe('.cjs');
2626
});
2727

2828
it('returns empty string if the extension is not found', () => {

src/integration.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const ENVIRONMENT_CONFIG = {
2121
c: ['libcurl'],
2222
csharp: ['httpclient', 'restsharp'],
2323
go: ['native'],
24-
node: ['axios', 'fetch'],
24+
node: ['axios', 'fetch', 'native', 'request'],
2525
php: ['curl', 'guzzle'],
2626
python: ['requests'],
2727
shell: ['curl'],
@@ -30,7 +30,7 @@ const ENVIRONMENT_CONFIG = {
3030
// When running tests locally, or within a CI environment, we shold limit the targets that
3131
// we're testing so as to not require a mess of dependency requirements that would be better
3232
// served within a container.
33-
node: ['fetch'],
33+
node: ['native'],
3434
php: ['curl'],
3535
python: ['requests'],
3636
shell: ['curl'],

src/targets/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const targetFilter: TargetId[] = [
3131
/** useful for debuggin, only run a particular set of targets */
3232
const clientFilter: ClientId[] = [
3333
// put your clientId here:
34-
// 'axios',
34+
// 'unirest',
3535
];
3636

3737
/** useful for debuggin, only run a particular set of fixtures */

0 commit comments

Comments
 (0)