Skip to content

Commit cccd5a5

Browse files
committed
Migrated to Vercel
1 parent e74bcb8 commit cccd5a5

File tree

8 files changed

+30
-31
lines changed

8 files changed

+30
-31
lines changed

Diff for: README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
# zeit-now-node-server
1+
# vercel-node-server
22

3-
An unofficial package allowing you to create Node [`http.Server`](https://nodejs.org/api/http.html#http_class_http_server) instances of your [Zeit](https://zeit.co/) [`@now/node`](https://zeit.co/docs/builders#official-builders/node-js) lambdas.
3+
An unofficial package allowing you to create Node [`http.Server`](https://nodejs.org/api/http.html#http_class_http_server) instances of your [Vercel](https://vercel.com/) [Node](https://vercel.com/docs/runtimes#official-runtimes) lambdas.
44

55
Enables you to write unit/integration tests for your lambdas, or to perform manual testing against a local server instance.
66

7-
[![npm](https://img.shields.io/npm/v/zeit-now-node-server.svg?style=flat-square)](http://npm.im/zeit-now-node-server)
8-
[![MIT License](https://img.shields.io/npm/l/zeit-now-node-server.svg?style=flat-square)](http://opensource.org/licenses/MIT)
9-
[![Travis](https://img.shields.io/travis/ctrlplusb/zeit-now-node-server.svg?style=flat-square)](https://travis-ci.org/ctrlplusb/zeit-now-node-server)
10-
[![Codecov](https://img.shields.io/codecov/c/github/ctrlplusb/zeit-now-node-server.svg?style=flat-square)](https://codecov.io/github/ctrlplusb/zeit-now-node-server)
7+
[![npm](https://img.shields.io/npm/v/vercel-node-server.svg?style=flat-square)](http://npm.im/vercel-node-server)
8+
[![MIT License](https://img.shields.io/npm/l/vercel-node-server.svg?style=flat-square)](http://opensource.org/licenses/MIT)
9+
[![Travis](https://img.shields.io/travis/ctrlplusb/vercel-node-server.svg?style=flat-square)](https://travis-ci.org/ctrlplusb/vercel-node-server)
10+
[![Codecov](https://img.shields.io/codecov/c/github/ctrlplusb/vercel-node-server.svg?style=flat-square)](https://codecov.io/github/ctrlplusb/vercel-node-server)
1111

1212
## Installation
1313

1414
```bash
15-
npm install zeit-now-node-server
15+
npm install vercel-node-server
1616
```
1717

1818
## Supported API
1919

20-
This package has taken the code from the official [`@now/node`](https://zeit.co/docs/builders#official-builders/node-js) builder in order to ensure maximum API compatibility. As far as I am aware we have 100% API coverage.
20+
This package has taken the code from the official [`@vercel/node`](https://vercel.com/docs/runtimes#official-runtimes) builder in order to ensure maximum API compatibility. As far as I am aware we have 100% API coverage.
2121

2222
## Unit testing your lambdas
2323

@@ -28,15 +28,15 @@ We will be making use of the [`test-listen`](https://github.com/zeit/test-listen
2828
We will also make use of [`axios`](https://github.com/axios/axios) in order to make the request against our lambda.
2929

3030
```javascript
31-
import { createServer } from 'zeit-now-node-server';
31+
import { createServer } from 'vercel-node-server';
3232
import listen from 'test-listen';
3333
import axios from 'axios';
3434
import helloLambda from './api/hello';
3535

3636
let server;
3737
let url;
3838

39-
beforeAll(() => {
39+
beforeAll(async () => {
4040
server = createServer(routeUnderTest);
4141
url = await listen(server);
4242
});
@@ -45,7 +45,7 @@ afterAll(() => {
4545
server.close();
4646
});
4747

48-
it('should return the expected response' async () => {
48+
it('should return the expected response', async () => {
4949
const response = await axios.get(url, { params: { name: 'Pearl' } });
5050
expect(response.data).toBe('Hello Pearl');
5151
});
@@ -64,7 +64,7 @@ const helloLambda = (req, res) => {
6464
You can create a Node [`http.Server`](https://nodejs.org/api/http.html#http_class_http_server) instance like so.
6565

6666
```javascript
67-
import { createServer } from 'zeit-node-now-server';
67+
import { createServer } from 'vercel-node-server';
6868
import helloLambda from './api/hello';
6969

7070
const server = createServer(helloLambda);

Diff for: jest.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ const path = require('path');
55
module.exports = {
66
preset: 'ts-jest',
77
testEnvironment: 'node',
8-
testMatch: ['<rootDir>/test/**/*.test.ts'],
98
};

Diff for: package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"name": "zeit-now-node-server",
3-
"version": "1.0.1",
4-
"description": "Create a server for your Zeit @now/node lambdas in order to test them",
2+
"name": "vercel-node-server",
3+
"version": "2.0.0",
4+
"description": "Create a server for your Vercel Node lambdas in order to test them",
55
"license": "MIT",
66
"author": "Sean Matheson",
77
"main": "dist/index.js",
8-
"module": "dist/zeit-now-node-server.esm.js",
8+
"module": "dist/vercel-node-server.esm.js",
99
"typings": "dist/index.d.ts",
1010
"repository": {
1111
"type": "git",
12-
"url": "https://github.com/ctrlplusb/zeit-now-node-server.git"
12+
"url": "https://github.com/ctrlplusb/vercel-node-server.git"
1313
},
1414
"files": [
1515
"dist"
@@ -36,7 +36,6 @@
3636
"trailingComma": "es5"
3737
},
3838
"devDependencies": {
39-
"@now/node": "^1.0.2",
4039
"@types/content-type": "^1.1.3",
4140
"@types/cookie": "^0.3.3",
4241
"@types/jest": "^25.2.1",
@@ -54,6 +53,7 @@
5453
"typescript": "^3.8.3"
5554
},
5655
"dependencies": {
56+
"@vercel/node": "^1.6.1",
5757
"content-type": "^1.0.4",
5858
"cookie": "^0.4.1",
5959
"micro": "^9.3.4",
File renamed without changes.

Diff for: test/zeit-now-node-server.test.ts renamed to src/__tests__/vercel-node-server.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { NowRequest, NowResponse } from '@now/node';
1+
import { NowRequest, NowResponse } from '@vercel/node';
22
import { Server } from 'http';
33
import axios from 'axios';
44
import fs from 'fs';
55
import path from 'path';
66
import listen from 'test-listen';
7-
import { createServer } from '../src';
7+
import { createServer } from '../';
88

99
let server: Server;
1010
let url: string;
@@ -137,7 +137,7 @@ it('body - json', async () => {
137137
});
138138

139139
describe('request handling', () => {
140-
it.only('body - invalid json', async () => {
140+
it('body - invalid json', async () => {
141141
// ARRANGE
142142
route = () => {};
143143

Diff for: src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
NowRequestBody,
55
NowRequest,
66
NowResponse,
7-
} from '@now/node';
7+
} from '@vercel/node';
88
import { IncomingMessage, ServerResponse } from 'http';
99
import { parse } from 'cookie';
1010
import { parse as parseContentType } from 'content-type';

Diff for: tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"include": ["src", "types", "test"],
2+
"include": ["src", "types", "src/test"],
33
"compilerOptions": {
44
"target": "es5",
55
"module": "esnext",

Diff for: yarn.lock

+7-7
Original file line numberDiff line numberDiff line change
@@ -1312,13 +1312,6 @@
13121312
"@types/yargs" "^15.0.0"
13131313
chalk "^3.0.0"
13141314

1315-
"@now/node@^1.0.2":
1316-
version "1.0.2"
1317-
resolved "https://registry.yarnpkg.com/@now/node/-/node-1.0.2.tgz#484e595d992d52728f5b6e82c0310b5a7ceba851"
1318-
integrity sha512-jGcpqOyQuxbYz0yBAV+Y5VTmuCF+geai1zOQPPKBNzsh+9j5Yoo8f0ImaGYkJeTQv19exKf3hHa5OcA4q4+5qg==
1319-
dependencies:
1320-
"@types/node" "*"
1321-
13221315
"@rollup/plugin-commonjs@^11.0.0":
13231316
version "11.1.0"
13241317
resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-11.1.0.tgz#60636c7a722f54b41e419e1709df05c7234557ef"
@@ -1603,6 +1596,13 @@
16031596
semver "^6.3.0"
16041597
tsutils "^3.17.1"
16051598

1599+
"@vercel/node@^1.6.1":
1600+
version "1.6.1"
1601+
resolved "https://registry.yarnpkg.com/@vercel/node/-/node-1.6.1.tgz#03b08cb88a2ea82bb80603e81ae61e7e283ace5a"
1602+
integrity sha512-sCxhMtShD2kCcpznmYO5HaCG3LaqaJVm0xZiJq8BuGIuSNWgS/aXi5IESFa01whsafaS7WhdMTlAwNPPOvH5lg==
1603+
dependencies:
1604+
"@types/node" "*"
1605+
16061606
abab@^2.0.0:
16071607
version "2.0.2"
16081608
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.2.tgz#a2fba1b122c69a85caa02d10f9270c7219709a9d"

0 commit comments

Comments
 (0)