Skip to content

Commit 5f0a054

Browse files
committed
feat: deno support
close #13
1 parent baec60f commit 5f0a054

17 files changed

+353
-2778
lines changed

.eslintrc.js

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

.github/workflows/release.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,22 @@ jobs:
1313
if: "! contains(github.event.head_commit.message, '[skip ci]') && ! contains(github.event.head_commit.message, '[ci skip]')"
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v3
1717

18+
- uses: denoland/setup-deno@v1
19+
with:
20+
deno-version: v1.x
21+
1822
- run: |
19-
npm ci
20-
npm run build
23+
deno task build
2124
22-
- uses: cycjimmy/semantic-release-action@v2
25+
- uses: cycjimmy/semantic-release-action@v3
2326
with:
27+
working_directory: npm
2428
extra_plugins: |
2529
@semantic-release/changelog
2630
@semantic-release/git
2731
env:
2832
GITHUB_TOKEN: ${{ github.token }}
2933
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
34+

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,4 @@ dist
103103
# TernJS port file
104104
.tern-port
105105
.DS_Store
106-
.vscode/
106+
/npm

.node-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

.tool-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
deno 1.23.1
2+
nodejs 14.19.2

.vscode/launch.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
// IntelliSense を使用して利用可能な属性を学べます。
3+
// 既存の属性の説明をホバーして表示します。
4+
// 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"request": "launch",
9+
"name": "Launch Program",
10+
"type": "pwa-node",
11+
"program": "${workspaceFolder}/src/cli.ts",
12+
"cwd": "${workspaceFolder}",
13+
"runtimeExecutable": "deno",
14+
"runtimeArgs": [
15+
"run",
16+
"--unstable",
17+
"--inspect",
18+
"--allow-all"
19+
],
20+
"attachSimplePort": 9229
21+
}
22+
]
23+
}

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"deno.enable": true,
3+
"deno.lint": true,
4+
"deno.unstable": true,
5+
}

bin/cli.js

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

build_npm.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { build, emptyDir } from "https://deno.land/x/dnt/mod.ts";
2+
3+
await emptyDir("./npm");
4+
5+
await build({
6+
entryPoints: [
7+
"./src/index.ts",
8+
{
9+
kind: "bin",
10+
name: "unity-changeset",
11+
path: "./src/cli.ts",
12+
},
13+
],
14+
outDir: "./npm",
15+
shims: {
16+
deno: true, // for Deno namespace
17+
custom: [{
18+
package: { // for fetch
19+
name: "node-fetch",
20+
version: "~2.6.7",
21+
},
22+
globalNames: [{
23+
name: "fetch",
24+
exportName: "default",
25+
}],
26+
}],
27+
},
28+
mappings: {
29+
"https://unpkg.com/cac@6.7.12/mod.ts": {
30+
name: "cac",
31+
version: "6.7.12",
32+
},
33+
},
34+
package: {
35+
// package.json properties
36+
name: "unity-changeset",
37+
version: "0.0.1",
38+
description: "Get/List Unity changeset",
39+
author: "mob-sakai <sakai861104@gmail.com>",
40+
license: "MIT",
41+
repository: {
42+
type: "git",
43+
url: "git+https://github.com/mob-sakai/unity-changeset.git",
44+
},
45+
bugs: {
46+
url: "https://github.com/mob-sakai/unity-changeset/issues",
47+
},
48+
engines: {
49+
node: ">=14",
50+
},
51+
devDependencies: {
52+
"@types/node-fetch": "^2.5.7",
53+
},
54+
},
55+
});
56+
57+
// post build steps
58+
Deno.copyFileSync("LICENSE", "npm/LICENSE");
59+
Deno.copyFileSync("README.md", "npm/README.md");
60+
Deno.copyFileSync(".releaserc.json", "npm/.releaserc.json");

deno.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"tasks": {
3+
"build": "deno run -A build_npm.ts",
4+
"test": "deno test -A src/",
5+
"lint": "deno lint src/ && deno fmt src/"
6+
}
7+
}

0 commit comments

Comments
 (0)