Skip to content

Commit a65916e

Browse files
authored
refactor: resturcture to single package (#4)
1 parent 72a96d4 commit a65916e

File tree

36 files changed

+86
-64
lines changed

36 files changed

+86
-64
lines changed

.github/workflows/CI.yaml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -472,30 +472,19 @@ jobs:
472472
- name: Download all artifacts
473473
uses: actions/download-artifact@v2
474474
with:
475-
path: node/artifacts
475+
path: artifacts
476476

477477
- name: Move artifacts
478-
run: pnpm artifacts --dir node
478+
run: pnpm artifacts
479479

480480
- name: List packages
481-
run: ls -R ./node/npm
481+
run: ls -R ./npm
482482
shell: bash
483483

484-
- name: Publish Node
484+
- name: Publish
485485
if: "startsWith(github.event.head_commit.message, 'chore(release): publish')"
486486
run: |
487487
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
488-
cd node
489-
pnpm publish
490-
env:
491-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
492-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
493-
494-
- name: Publish Web-Assembly
495-
if: "startsWith(github.event.head_commit.message, 'chore(release): publish')"
496-
run: |
497-
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
498-
cd wasm
499488
pnpm publish
500489
env:
501490
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/Lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
run: pnpm install --frozen-lockfile --registry https://registry.npm.taobao.org
4141

4242
- name: ESLint
43-
run: pnpm lint --dir node
43+
run: pnpm lint
4444

4545
- name: Cargo fmt
4646
run: cargo fmt -- --check

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './node/index'

node/binding.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
4+
/* auto-generated by NAPI-RS */
5+
6+
export class ExternalObject<T> {
7+
readonly '': {
8+
readonly '': unique symbol
9+
[K: symbol]: T
10+
}
11+
}
12+
export function add(a: number, b: number): number

node/index.d.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
/* tslint:disable */
2-
/* eslint-disable */
1+
export * from './binding'
32

4-
/* auto-generated by NAPI-RS */
5-
6-
export class ExternalObject<T> {
7-
readonly '': {
8-
readonly '': unique symbol
9-
[K: symbol]: T
10-
}
11-
}
12-
export function add(a: number, b: number): number
3+
export default function init(): Promise<void>

node/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
const { add } = require("./binding")
1+
const init = () => Promise.resolve()
2+
module.exports = init
3+
4+
const { add } = require('./binding')
25

36
// you can modify binding here
4-
exports.add = add
7+
module.exports.add = add

node/package.json

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,11 @@
11
{
2-
"name": "@speedy-js/source-map",
2+
"name": "node",
33
"version": "0.0.0",
4+
"private": true,
45
"description": "Speedy source-map",
5-
"main": "index.js",
6-
"types": "index.d.ts",
7-
"repository": "https://github.com/speedy-js/napi-template.git",
8-
"license": "MIT",
9-
"publishConfig": {
10-
"registry": "https://registry.npmjs.org/",
11-
"access": "public"
12-
},
13-
"keywords": [
14-
"sourcemap",
15-
"speedy",
16-
"napi",
17-
"N-API",
18-
"napi-rs"
19-
],
20-
"files": [
21-
"index.js",
22-
"index.d.ts",
23-
"binding.js"
24-
],
256
"scripts": {
26-
"artifacts": "napi artifacts",
27-
"build": "napi build --platform --release --js binding.js --pipe \"prettier -w\"",
28-
"build:debug": "napi build --platform --js binding.js --pipe \"prettier -w\"",
29-
"prepublishOnly": "napi prepublish -t npm && esbuild --minify --outfile=binding.js --allow-overwrite binding.js",
30-
"lint": "echo lint",
31-
"version": "napi version"
7+
"build": "napi build --platform --release --js binding.js --dts binding.d.ts --pipe \"prettier -w\"",
8+
"build:debug": "napi build --platform --js binding.js --dts binding.d.ts --pipe \"prettier -w\""
329
},
3310
"napi": {
3411
"name": "speedy-sourcemap",
@@ -46,6 +23,9 @@
4623
"aarch64-linux-android",
4724
"armv7-linux-androideabi"
4825
]
26+
},
27+
"package": {
28+
"name": "@speedy-js/source-map"
4929
}
5030
},
5131
"engines": {
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)