Skip to content

Commit b6cba8f

Browse files
authored
Merge pull request #21 from Navigraph/bun
Migrate to Bun, remove unused scripts and speed up builds
2 parents 9442ef5 + 1efe5d0 commit b6cba8f

File tree

255 files changed

+3057
-12932
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

255 files changed

+3057
-12932
lines changed

.cargo/config.toml

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,3 @@
1-
[target.wasm32-wasip1]
2-
rustflags = [
3-
"-Ctarget-feature=-crt-static,+bulk-memory",
4-
"-Clink-self-contained=no",
5-
"-Clink-arg=-l",
6-
"-Clink-arg=c",
7-
"-Clink-arg=/workdir/MSFS_SDK/WASM/wasi-sysroot/lib/wasm32-wasi/libclang_rt.builtins-wasm32.a",
8-
"-Clink-arg=-L",
9-
"-Clink-arg=/workdir/MSFS_SDK/WASM/wasi-sysroot/lib/wasm32-wasi",
10-
"-Clink-arg=--export-table",
11-
"-Clink-arg=--allow-undefined",
12-
"-Clink-arg=--export-dynamic",
13-
"-Clink-arg=--export=__wasm_call_ctors",
14-
"-Clink-arg=--export=malloc",
15-
"-Clink-arg=--export=free",
16-
"-Clink-arg=--export=mark_decommit_pages",
17-
"-Clink-arg=--export=mallinfo",
18-
"-Clink-arg=--export=mchunkit_begin",
19-
"-Clink-arg=--export=mchunkit_next",
20-
"-Clink-arg=--export=get_pages_state",
21-
]
22-
23-
[build]
24-
target = "wasm32-wasip1"
1+
[build]
2+
target = "wasm32-wasip1"
3+
target-dir = "targets/2020"

.dockerignore

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

.eslintrc

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

.github/workflows/cache.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Store rust cache
22

3-
# This workflow is needed since any cache created
3+
# This workflow is needed since any cache created
44
# on a feature-branch will NOT be available on any other ref.
55
# See: https://github.com/actions/cache/issues/79
66

@@ -48,4 +48,4 @@ jobs:
4848
key: rust-targets
4949

5050
- name: Build WASM
51-
run: bun run build:wasm && bun run package
51+
run: bun run build:wasm

.github/workflows/pr.yml

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,34 @@ jobs:
3636
if: ${{ needs.filter.outputs.js-interface == 'true' && !github.event.pull_request.draft && !contains(github.event.pull_request.labels.*.name , 'release') }}
3737
steps:
3838
- uses: actions/checkout@v4
39-
40-
- uses: actions/setup-node@v4
39+
40+
- uses: oven-sh/setup-bun@v2
4141
with:
42-
node-version: "18"
43-
cache: "npm"
42+
bun-version: latest
4443

4544
- name: Install node modules
46-
run: npm ci
45+
run: bun i --frozen-lockfile
4746

4847
- name: Run linting
49-
run: npm run lint:js -- --max-warnings 0
48+
run: bun lint --max-warnings 0
49+
50+
typecheck:
51+
name: Check types 🕵️‍♂️
52+
runs-on: ubuntu-latest
53+
needs: [filter]
54+
if: ${{ needs.filter.outputs.js-interface == 'true' && !github.event.pull_request.draft && !contains(github.event.pull_request.labels.*.name , 'release') }}
55+
steps:
56+
- uses: actions/checkout@v4
57+
58+
- uses: oven-sh/setup-bun@v2
59+
with:
60+
bun-version: latest
61+
62+
- name: Install node modules
63+
run: bun i --frozen-lockfile
64+
65+
- name: Check types
66+
run: bun typecheck
5067

5168
build-test:
5269
name: Build & test 🛠️
@@ -63,15 +80,38 @@ jobs:
6380
echo NAVIGATION_DATA_SIGNED_URL=${{ secrets.NAVIGATION_DATA_SIGNED_URL }} >> .env
6481
echo SENTRY_URL=${{ secrets.SENTRY_URL }} >> .env
6582
83+
- uses: oven-sh/setup-bun@v2
84+
with:
85+
bun-version: latest
86+
87+
- name: Install node modules
88+
run: bun i --frozen-lockfile
89+
90+
- name: Set up Docker Buildx
91+
uses: docker/setup-buildx-action@v3
92+
93+
- name: Build cargo-msfs image
94+
uses: docker/build-push-action@v5
95+
with:
96+
context: .
97+
file: Dockerfile
98+
tags: navigation-data-interface-wasm-build:latest
99+
load: true
100+
cache-from: type=gha
101+
cache-to: type=gha
102+
103+
- name: Cache target directories
104+
uses: actions/cache@v4
105+
with:
106+
path: targets
107+
key: rust-targets
66108

67109
- name: Build WASM
68-
run: ./scripts/workflow.sh
110+
run: bun run build:wasm && bun run package
69111

70-
71112
- name: Upload WASM module to GitHub
72113
uses: actions/upload-artifact@v4
73114
with:
74-
name: msfs_navigation_data_interface
115+
name: wasm
75116
path: |
76-
./2020.zip
77-
./2024.zip
117+
./wasm.zip

.github/workflows/pre-release.yml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,40 @@ jobs:
1818
run: |
1919
echo SENTRY_URL=${{ secrets.SENTRY_URL }} >> .env
2020
21+
- uses: oven-sh/setup-bun@v2
22+
with:
23+
bun-version: latest
24+
25+
- name: Install node modules
26+
run: bun i --frozen-lockfile
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
31+
- name: Build cargo-msfs image
32+
uses: docker/build-push-action@v5
33+
with:
34+
context: .
35+
file: Dockerfile
36+
tags: navigation-data-interface-wasm-build:latest
37+
load: true
38+
cache-from: type=gha
39+
cache-to: type=gha
40+
41+
- name: Cache target directories
42+
uses: actions/cache@v4
43+
with:
44+
path: targets
45+
key: rust-targets
46+
2147
- name: Build WASM
22-
run: ./scripts/workflow.sh
48+
run: bun run build:wasm && bun run package
2349

2450
- name: Pre-Release
2551
uses: softprops/action-gh-release@v1
2652
with:
2753
files: |
28-
./2020.zip
29-
./2024.zip
54+
./wasm.zip
3055
prerelease: true
3156
generate_release_notes: true
3257

@@ -51,4 +76,4 @@ jobs:
5176
# - name: Publish to NPM
5277
# env:
5378
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
54-
# run: cd src/js && npm publish --tag next
79+
# run: cd src/js && npm publish --tag next

.github/workflows/release.yml

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
- "!v*-rc*"
66
- "!v*-alpha*"
77
- "!v*-beta*"
8-
8+
99
name: Create release
1010
run-name: Create release for `${{ github.ref_name }}`
1111

@@ -19,15 +19,40 @@ jobs:
1919
run: |
2020
echo SENTRY_URL=${{ secrets.SENTRY_URL }} >> .env
2121
22+
- uses: oven-sh/setup-bun@v2
23+
with:
24+
bun-version: latest
25+
26+
- name: Install node modules
27+
run: bun i --frozen-lockfile
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Build cargo-msfs image
33+
uses: docker/build-push-action@v5
34+
with:
35+
context: .
36+
file: Dockerfile
37+
tags: navigation-data-interface-wasm-build:latest
38+
load: true
39+
cache-from: type=gha
40+
cache-to: type=gha
41+
42+
- name: Cache target directories
43+
uses: actions/cache@v4
44+
with:
45+
path: targets
46+
key: rust-targets
47+
2248
- name: Build WASM
23-
run: ./scripts/workflow.sh
49+
run: bun run build:wasm && bun run package
2450

2551
- name: Release
2652
uses: softprops/action-gh-release@v1
2753
with:
2854
files: |
29-
./2020.zip
30-
./2024.zip
55+
./wasm.zip
3156
generate_release_notes: true
3257

3358
# Enable in future to automate publishing of NPM package
@@ -36,19 +61,17 @@ jobs:
3661
steps:
3762
- uses: actions/checkout@v4
3863

39-
- uses: actions/setup-node@v4
64+
- uses: oven-sh/setup-bun@v2
4065
with:
41-
node-version: "18"
42-
registry-url: 'https://registry.npmjs.org'
43-
cache: "npm"
66+
bun-version: latest
4467

4568
- name: Install node modules
46-
run: npm ci
69+
run: bun i --frozen-lockfile
4770

4871
- name: Build JS Interface
49-
run: cd src/js && npm run build
72+
run: cd src/ts && bun run build
5073

5174
- name: Publish to NPM
5275
env:
53-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
54-
run: cd src/js && npm publish
76+
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
77+
run: cd src/ts && bun publish

.gitignore

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,14 @@ _PackageInt
55
tsconfig.tsbuildinfo
66
.vs
77
examples/aircraft/NavigationDataInterfaceAircraftProject.xml.user
8-
examples/aircraft/PackageSources/html_ui/Pages/VCockpit/Instruments/Navigraph/NavigationDataInterfaceSample
9-
examples/aircraft/PackageSources/SimObjects/Airplanes/Navigraph_Navigation_Data_Interface_Aircraft/panel/msfs_navigation_data_interface.wasm
10-
out
11-
out20
12-
out24
8+
example/aircraft/PackageSources/html_ui/Pages/VCockpit/Instruments/Navigraph/NavigationDataInterfaceSample
9+
example/aircraft/PackageSources/SimObjects/Airplanes/Navigraph_Navigation_Data_Interface_Aircraft/panel/msfs_navigation_data_interface.wasm
1310

1411
# Rust
1512
# will have compiled files and executables
1613
debug/
17-
target/
14+
targets
1815

19-
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
20-
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
21-
# Cargo.lock
22-
# Who put this here
2316

2417
# These are backup files generated by rustfmt
2518
**/*.rs.bk
@@ -32,5 +25,5 @@ target/
3225
*.local
3326
.DS_Store
3427

35-
test_work/
36-
dist
28+
dist
29+

.prettierignore

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

.prettierrc

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
{
2-
"trailingComma": "all",
3-
"printWidth": 120,
4-
"singleQuote": false,
5-
"arrowParens": "avoid",
6-
"semi": false,
7-
"endOfLine": "auto",
8-
"plugins": ["@ianvs/prettier-plugin-sort-imports"],
9-
"importOrder": ["<THIRD_PARTY_MODULES>", "@[A-Z](.*)", "^[./]"]
10-
}
2+
"trailingComma": "all",
3+
"printWidth": 120,
4+
"singleQuote": false,
5+
"arrowParens": "avoid",
6+
"semi": true,
7+
"endOfLine": "auto"
8+
}

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM rust:1.84
1+
FROM rust:1.84.1
22

33
# Install needed packages and clean up
44
RUN apt update && \
@@ -19,6 +19,9 @@ RUN rustup target install wasm32-wasip1
1919
# Install cargo-msfs
2020
RUN cargo install --git https://github.com/navigraph/cargo-msfs
2121

22+
# Cache bust arg to re-install both SDKs
23+
ARG CACHEBUST
24+
2225
# Install MSFS2020 and MSFS2024 SDK
2326
RUN cargo-msfs install msfs2020 && \
2427
cargo-msfs install msfs2024

0 commit comments

Comments
 (0)