Skip to content

Commit 33c5cf1

Browse files
authored
chore: updated everything (#27)
1 parent fffa179 commit 33c5cf1

File tree

12 files changed

+646
-3169
lines changed

12 files changed

+646
-3169
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ jobs:
1010
strategy:
1111
matrix:
1212
os: ['ubuntu-latest']
13-
node: ['12.x']
14-
deno: ['0.42.0']
13+
node: ['14.x']
14+
deno: ['1.3.2']
1515
fail-fast: false
1616
runs-on: ${{ matrix.os }}
1717
name: build-${{ matrix.os }}
@@ -43,8 +43,8 @@ jobs:
4343
strategy:
4444
matrix:
4545
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
46-
node: ['12.x']
47-
deno: ['0.42.0']
46+
node: ['14.x']
47+
deno: ['1.3.2']
4848
fail-fast: false
4949
runs-on: ${{ matrix.os }}
5050
name: test-${{ matrix.os }}
@@ -61,12 +61,12 @@ jobs:
6161
node-version: ${{ matrix.node }}
6262
- name: Install dependencies
6363
run: yarn install
64-
- name: Install now
65-
run: npm i -g now
64+
- name: Install vercel
65+
run: npm i -g vercel
6666
if: matrix.os == 'windows-latest'
6767
- name: Update package version and tag
6868
run: deno run --unstable --allow-env --allow-read --allow-write .github/workflows/update-version.ts
6969
- name: Run tests
70-
run: deno test --unstable --allow-env --allow-write --allow-net --allow-run .github/workflows/tests.ts
70+
run: deno test --unstable --allow-env --allow-read --allow-write --allow-net --allow-run .github/workflows/tests.ts
7171
env:
72-
NOW_TOKEN: ${{ secrets.NOW_TOKEN }}
72+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}

.github/workflows/tests.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import {
22
assert,
3-
assertStrContains,
4-
} from 'https://deno.land/std@v0.42.0/testing/asserts.ts';
5-
import { join } from 'https://deno.land/std@v0.42.0/path/mod.ts';
3+
assertStringContains
4+
} from 'https://deno.land/std@0.68.0/testing/asserts.ts';
5+
import { join } from 'https://deno.land/std@0.68.0/path/mod.ts';
66

77
const isWin = Deno.build.os == 'windows';
8-
const runNow = isWin ? ['now.cmd'] : ['npx', 'now'];
8+
const runNow = isWin ? ['vercel.cmd'] : ['npx', 'vercel'];
99

1010
Deno.test({
11-
name: 'deploy to now',
11+
name: 'deploy to vercel',
1212
async fn() {
1313
const proc = Deno.run({
14-
cmd: runNow.concat('-c', '-f', '-t', Deno.env.get('NOW_TOKEN')!),
14+
cmd: runNow.concat('-c', '-f', '-t', Deno.env.get('VERCEL_TOKEN')!),
1515
cwd: join(Deno.cwd(), 'example'),
1616
stdout: 'piped',
1717
stderr: 'piped',
@@ -26,20 +26,20 @@ Deno.test({
2626
const req = await fetch(`${url}/api/version`);
2727
assert(req.ok);
2828
const text = await req.text();
29-
assertStrContains(text, 'Welcome to deno');
30-
assertStrContains(text, '🦕');
29+
assertStringContains(text, 'Welcome to deno');
30+
assertStringContains(text, '🦕');
3131
},
3232
});
3333

3434
Deno.test({
35-
name: 'deploy to now with specific version',
35+
name: 'deploy to vercel with specific version',
3636
async fn() {
3737
const proc = Deno.run({
3838
cmd: runNow.concat(
3939
'-c',
4040
'-f',
4141
'-t',
42-
Deno.env.get('NOW_TOKEN')!,
42+
Deno.env.get('VERCEL_TOKEN')!,
4343
'--build-env',
4444
'DENO_VERSION=0.40.0'
4545
),
@@ -57,19 +57,19 @@ Deno.test({
5757
const req = await fetch(`${url}/api/version`);
5858
assert(req.ok);
5959
const text = await req.text();
60-
assertStrContains(text, 'Welcome to deno');
61-
assertStrContains(text, '0.40.0');
62-
assertStrContains(text, '🦕');
60+
assertStringContains(text, 'Welcome to deno');
61+
assertStringContains(text, '0.40.0');
62+
assertStringContains(text, '🦕');
6363
},
6464
});
6565

6666
// TODO(lucacasonato): reenable test on macOS
6767
if (Deno.build.os === 'linux') {
6868
Deno.test({
69-
name: 'run on now dev',
69+
name: 'run on vercel dev',
7070
async fn() {
7171
const proc = Deno.run({
72-
cmd: runNow.concat('dev', '-t', Deno.env.get('NOW_TOKEN')!),
72+
cmd: runNow.concat('dev', '-t', Deno.env.get('VERCEL_TOKEN')!),
7373
cwd: join(Deno.cwd(), 'example'),
7474
stdout: 'inherit',
7575
stderr: 'inherit',
@@ -80,8 +80,8 @@ if (Deno.build.os === 'linux') {
8080
const req = await fetch(`http://localhost:3000/api/version`);
8181
if (req.ok) {
8282
const text = await req.text();
83-
assertStrContains(text, 'Welcome to deno');
84-
assertStrContains(text, '🦕');
83+
assertStringContains(text, 'Welcome to deno');
84+
assertStringContains(text, '🦕');
8585
proc.kill(2);
8686
proc.close();
8787
Deno.exit(0);
@@ -93,7 +93,7 @@ if (Deno.build.os === 'linux') {
9393
}
9494
proc.kill(2);
9595
proc.close();
96-
throw Error('Failed to send request to now dev');
96+
throw Error('Failed to send request to vercel dev');
9797
},
9898
});
9999
}

.github/workflows/update-version.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
readJson,
33
writeJson,
44
ensureDir,
5-
} from 'https://deno.land/std@v0.42.0/fs/mod.ts';
5+
} from 'https://deno.land/std@0.68.0/fs/mod.ts';
66
const sha = Deno.env.get('GITHUB_SHA');
77
if (!sha) {
88
throw Error('No GITHUB_SHA specified.');
@@ -17,11 +17,11 @@ pkg.name = name;
1717
pkg.version = tag;
1818
await writeJson('package.json', pkg, { spaces: 2 });
1919

20-
const now: any = await readJson('example/now.json');
21-
now.functions['api/**/*.ts'].runtime = `${name}@${tag}`;
22-
await writeJson('example/now.json', now, { spaces: 2 });
23-
await ensureDir('example/.now');
24-
await writeJson('example/.now/project.json', {
20+
const vercel: any = await readJson('example/vercel.json');
21+
vercel.functions['api/**/*.ts'].runtime = `${name}@${tag}`;
22+
await writeJson('example/vercel.json', vercel, { spaces: 2 });
23+
await ensureDir('example/.vercel');
24+
await writeJson('example/.vercel/project.json', {
2525
projectId: 'QmT3dw3FcMmKeRh24bRCTR6iF5VCp6kB5CNjgGePK57cC6',
2626
orgId: 'eTmgUytG3YzmHs86JcUzFSmc',
2727
});

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
dist
22
node_modules
3-
.now
3+
.vercel
44
.vscode

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This builder allows you to run [Deno](https://deno.land) as a lambda on `vercel`
99
If you're unfamiliar with `vercel` runtimes, please read the [runtime docs](https://vercel.com/docs/runtimes) first. This runtime can be used like any other Community Runtime.
1010

1111
```json
12-
// now.json
12+
// vercel.json
1313
{
1414
"functions": {
1515
"api/**/*.{j,t}s": {
@@ -49,10 +49,10 @@ That's the simplest way to use this runtime!
4949

5050
### Specific Deno version
5151

52-
To use a specific version of Deno you can specify a environment variable in your `now.json`:
52+
To use a specific version of Deno you can specify a environment variable in your `vercel.json`:
5353

5454
```json
55-
// now.json
55+
// vercel.json
5656
{
5757
"functions": {
5858
...
@@ -65,10 +65,10 @@ To use a specific version of Deno you can specify a environment variable in your
6565

6666
### Unstable mode
6767

68-
To use Deno's `unstable` mode you can specify the environment variable `DENO_UNSTABLE` in your `now.json`:
68+
To use Deno's `unstable` mode you can specify the environment variable `DENO_UNSTABLE` in your `vercel.json`:
6969

7070
```json
71-
// now.json
71+
// vercel.json
7272
{
7373
"functions": {
7474
...

example/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
.now
1+
.vercel

example/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
7-
<title>Zeit Now Deno</title>
7+
<title>Vercel Deno</title>
88
</head>
99
<body>
1010
<div id="content">contacting api...</div>
File renamed without changes.

package.json

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,29 @@
1313
"dev": "tsc --watch",
1414
"build": "tsc",
1515
"prepublishOnly": "tsc",
16-
"test": "tsc && jest",
1716
"typecheck": "tsc --noEmit"
1817
},
1918
"files": [
2019
"dist"
2120
],
2221
"dependencies": {
23-
"@now/build-utils": "^0.9.6",
2422
"@types/command-exists": "^1.2.0",
2523
"@types/which": "^1.3.2",
26-
"acorn": "^6.4.1",
27-
"command-exists": "^1.2.8",
28-
"execa": "^1.0.0",
29-
"fs-extra": "^7.0.1",
30-
"now": "^18.0.0",
24+
"@vercel/build-utils": "^2.5.1",
25+
"acorn": "^8.0.1",
26+
"command-exists": "^1.2.9",
27+
"execa": "^4.0.3",
28+
"fs-extra": "^9.0.1",
29+
"vercel": "^20.1.0",
3130
"which": "^2.0.2"
3231
},
3332
"devDependencies": {
34-
"@types/execa": "^0.9.0",
35-
"@types/fs-extra": "^7.0.0",
36-
"jest": "^24.8.0",
33+
"@types/execa": "^2.0.0",
34+
"@types/fs-extra": "^9.0.1",
3735
"ms": "^2.1.2",
3836
"node-fetch": "^2.6.0",
39-
"prettier": "^1.18.2",
40-
"typescript": "3.5.2"
37+
"prettier": "^2.1.1",
38+
"typescript": "^4.0.2"
4139
},
4240
"prettier": {
4341
"useTabs": false,

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
DownloadedFiles,
1212
Files,
1313
debug,
14-
} from '@now/build-utils';
14+
} from '@vercel/build-utils';
1515
import {
1616
ensureDeno,
1717
replaceBinDeno,
@@ -81,6 +81,7 @@ async function buildDenoLambda(
8181

8282
debug('building single file');
8383
const entrypointPath = downloadedFiles[entrypoint].fsPath;
84+
console.log(entrypointPath);
8485
const entrypointDirname = path.dirname(entrypointPath);
8586

8687
const extname = path.extname(entrypointPath);

0 commit comments

Comments
 (0)