Skip to content

Commit 638f798

Browse files
committed
add node SEA
change build folder
1 parent d87497e commit 638f798

File tree

9 files changed

+706
-11
lines changed

9 files changed

+706
-11
lines changed

.changeset/strong-mice-slide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"nsite-gateway": minor
3+
---
4+
5+
Change build folder

.github/workflows/node-sea.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build SEA
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
10+
jobs:
11+
sea-action:
12+
name: Build SEA
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest]
16+
runs-on: ${{ matrix.os }}
17+
steps:
18+
- name: Checkout
19+
id: checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js
23+
id: setup-node
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version-file: .nvmrc
27+
cache: pnpm
28+
29+
- name: Install Dependencies
30+
run: pnpm install
31+
32+
- name: Build and bundle
33+
run: pnpm build && pnpm bundle
34+
35+
- name: Find Node
36+
id: find-node
37+
run: echo "node=$(node -e 'console.log(process.argv[0]);')" >>
38+
$env:GITHUB_OUTPUT
39+
40+
- name: SEA
41+
id: sea
42+
uses: bryopsida/node-sea-action@v1
43+
with:
44+
working-dir: .
45+
output-dir: build/release
46+
executable-name: nsite-gateway
47+
sea-config-path: sea-config.json
48+
node-path: ${{ steps.find-node.outputs.node }}
49+
50+
- uses: actions/upload-artifact@v4
51+
with:
52+
name: ${{ matrix.os }}-sea
53+
path: build/release
54+
if-no-files-found: error

.github/workflows/publish-next.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ jobs:
1818

1919
- uses: pnpm/action-setup@v4
2020

21-
- name: Setup Node.js 20
21+
- name: Setup Node.js
2222
uses: actions/setup-node@v4
2323
with:
24-
node-version: 20
24+
node-version-file: .nvmrc
2525
cache: "pnpm"
2626

2727
- name: Install Dependencies

.github/workflows/version-or-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ jobs:
2626

2727
- uses: pnpm/action-setup@v4
2828

29-
- name: Setup Node.js 20
29+
- name: Setup Node.js
3030
uses: actions/setup-node@v4
3131
with:
32-
node-version: 20
32+
node-version-file: .nvmrc
3333
cache: "pnpm"
3434

3535
- name: Install Dependencies

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ build
44
data
55
.netrc
66
screenshots
7+
dist

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22
"name": "nsite-gateway",
33
"version": "0.7.0",
44
"description": "A blossom server implementation written in Typescript",
5-
"main": "build/index.js",
5+
"main": "dist/index.js",
66
"type": "module",
77
"author": "hzrd149",
88
"license": "MIT",
99
"scripts": {
10-
"start": "node build/index.js",
10+
"start": "node dist/index.js",
1111
"prepack": "tsc",
1212
"build": "tsc",
1313
"dev": "nodemon -i '**/data/**' --exec 'node' --loader @swc-node/register/esm src/index.ts",
14+
"bundle": "esbuild --bundle dist/index.js --format=esm --platform=node --outfile=build/bundle.mjs",
1415
"format": "prettier -w ."
1516
},
16-
"bin": "build/index.js",
17+
"bin": "dist/index.js",
1718
"files": [
18-
"build",
19+
"dist",
1920
"public"
2021
],
2122
"dependencies": {
@@ -57,7 +58,9 @@
5758
"@types/node": "^20.17.24",
5859
"@types/proxy-from-env": "^1.0.4",
5960
"@types/ws": "^8.18.0",
61+
"esbuild": "^0.25.1",
6062
"nodemon": "^3.1.9",
63+
"pkg": "^5.8.1",
6164
"prettier": "^3.5.3",
6265
"typescript": "^5.8.2"
6366
},

0 commit comments

Comments
 (0)