Skip to content

Commit cba3742

Browse files
committed
feat: 😋 implement basic file list function
0 parents  commit cba3742

32 files changed

+5665
-0
lines changed

‎.cargo/config.toml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[target.x86_64-pc-windows-msvc]
2+
rustflags = ["-C", "target-feature=+crt-static"]

‎.editorconfig‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors or IDEs
3+
# http://editorconfig.org
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 2
9+
end_of_line = lf
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

‎.gitattributes‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
3+
4+
5+
*.ts text eol=lf merge=union
6+
*.tsx text eol=lf merge=union
7+
*.rs text eol=lf merge=union
8+
*.js text eol=lf merge=union
9+
*.json text eol=lf merge=union
10+
*.debug text eol=lf merge=union
11+
12+
# Generated codes
13+
index.js linguist-detectable=false
14+
index.d.ts linguist-detectable=false
15+
hyper-fs.wasi-browser.js linguist-detectable=false
16+
hyper-fs.wasi.cjs linguist-detectable=false
17+
wasi-worker-browser.mjs linguist-detectable=false
18+
wasi-worker.mjs linguist-detectable=false

‎.github/renovate.json‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": ["config:base", "group:allNonMajor", ":preserveSemverRanges", ":disablePeerDependencies"],
4+
"labels": ["dependencies"],
5+
"packageRules": [
6+
{
7+
"matchPackageNames": ["@napi/cli", "napi", "napi-build", "napi-derive"],
8+
"addLabels": ["napi-rs"],
9+
"groupName": "napi-rs"
10+
},
11+
{
12+
"matchPackagePatterns": ["^eslint", "^@typescript-eslint"],
13+
"groupName": "linter"
14+
}
15+
],
16+
"commitMessagePrefix": "chore: ",
17+
"commitMessageAction": "bump up",
18+
"commitMessageTopic": "{{depName}} version",
19+
"ignoreDeps": []
20+
}

‎.github/workflows/CI.yml‎

Lines changed: 268 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,268 @@
1+
name: CI
2+
env:
3+
DEBUG: napi:*
4+
APP_NAME: hyper-fs
5+
MACOSX_DEPLOYMENT_TARGET: '10.13'
6+
CARGO_INCREMENTAL: '1'
7+
'on':
8+
push:
9+
branches:
10+
- main
11+
tags-ignore:
12+
- '**'
13+
paths-ignore:
14+
- '**/*.md'
15+
- LICENSE
16+
- '**/*.gitignore'
17+
- .editorconfig
18+
- docs/**
19+
pull_request: null
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: true
23+
jobs:
24+
lint:
25+
name: Lint
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v6
29+
- name: Setup node
30+
uses: actions/setup-node@v6
31+
with:
32+
node-version: 24
33+
cache: yarn
34+
- name: Install
35+
uses: dtolnay/rust-toolchain@stable
36+
with:
37+
components: clippy, rustfmt
38+
- name: Install dependencies
39+
run: yarn install
40+
- name: Oxlint
41+
run: yarn lint
42+
- name: Cargo fmt
43+
run: cargo fmt -- --check
44+
- name: Clippy
45+
run: cargo clippy
46+
build:
47+
strategy:
48+
fail-fast: false
49+
matrix:
50+
settings:
51+
- host: macos-latest
52+
target: x86_64-apple-darwin
53+
build: yarn build --target x86_64-apple-darwin
54+
- host: windows-latest
55+
build: yarn build --target x86_64-pc-windows-msvc
56+
target: x86_64-pc-windows-msvc
57+
- host: ubuntu-latest
58+
target: x86_64-unknown-linux-gnu
59+
build: yarn build --target x86_64-unknown-linux-gnu --use-napi-cross
60+
- host: macos-latest
61+
target: aarch64-apple-darwin
62+
build: yarn build --target aarch64-apple-darwin
63+
name: stable - ${{ matrix.settings.target }} - node@22
64+
runs-on: ${{ matrix.settings.host }}
65+
steps:
66+
- uses: actions/checkout@v6
67+
- name: Setup node
68+
uses: actions/setup-node@v6
69+
with:
70+
node-version: 24
71+
cache: yarn
72+
- name: Install
73+
uses: dtolnay/rust-toolchain@stable
74+
with:
75+
toolchain: stable
76+
targets: ${{ matrix.settings.target }}
77+
- name: Cache cargo
78+
uses: actions/cache@v4
79+
with:
80+
path: |
81+
~/.cargo/registry/index/
82+
~/.cargo/registry/cache/
83+
~/.cargo/git/db/
84+
~/.napi-rs
85+
.cargo-cache
86+
target/
87+
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
88+
- uses: mlugg/setup-zig@v2
89+
if: ${{ contains(matrix.settings.target, 'musl') }}
90+
with:
91+
version: 0.14.1
92+
- name: Install cargo-zigbuild
93+
uses: taiki-e/install-action@v2
94+
if: ${{ contains(matrix.settings.target, 'musl') }}
95+
env:
96+
GITHUB_TOKEN: ${{ github.token }}
97+
with:
98+
tool: cargo-zigbuild
99+
- name: Setup toolchain
100+
run: ${{ matrix.settings.setup }}
101+
if: ${{ matrix.settings.setup }}
102+
shell: bash
103+
- name: Install dependencies
104+
run: yarn install
105+
- name: Build
106+
run: ${{ matrix.settings.build }}
107+
shell: bash
108+
- name: Upload artifact
109+
uses: actions/upload-artifact@v5
110+
with:
111+
name: bindings-${{ matrix.settings.target }}
112+
path: |
113+
${{ env.APP_NAME }}.*.node
114+
${{ env.APP_NAME }}.*.wasm
115+
if-no-files-found: error
116+
test-macOS-windows-binding:
117+
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
118+
needs:
119+
- build
120+
strategy:
121+
fail-fast: false
122+
matrix:
123+
settings:
124+
- host: windows-latest
125+
target: x86_64-pc-windows-msvc
126+
architecture: x64
127+
- host: macos-latest
128+
target: aarch64-apple-darwin
129+
architecture: arm64
130+
- host: macos-latest
131+
target: x86_64-apple-darwin
132+
architecture: x64
133+
node:
134+
- '20'
135+
- '22'
136+
runs-on: ${{ matrix.settings.host }}
137+
steps:
138+
- uses: actions/checkout@v6
139+
- name: Setup node
140+
uses: actions/setup-node@v6
141+
with:
142+
node-version: ${{ matrix.node }}
143+
cache: yarn
144+
architecture: ${{ matrix.settings.architecture }}
145+
- name: Install dependencies
146+
run: yarn install
147+
- name: Download artifacts
148+
uses: actions/download-artifact@v6
149+
with:
150+
name: bindings-${{ matrix.settings.target }}
151+
path: .
152+
- name: List packages
153+
run: ls -R .
154+
shell: bash
155+
- name: Test bindings
156+
run: yarn test
157+
test-linux-binding:
158+
name: Test ${{ matrix.target }} - node@${{ matrix.node }}
159+
needs:
160+
- build
161+
strategy:
162+
fail-fast: false
163+
matrix:
164+
target:
165+
- x86_64-unknown-linux-gnu
166+
node:
167+
- '20'
168+
- '22'
169+
runs-on: ${{ contains(matrix.target, 'aarch64') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
170+
steps:
171+
- uses: actions/checkout@v6
172+
- name: Setup node
173+
uses: actions/setup-node@v6
174+
with:
175+
node-version: ${{ matrix.node }}
176+
cache: yarn
177+
- name: Output docker params
178+
id: docker
179+
run: |
180+
node -e "
181+
if ('${{ matrix.target }}'.startsWith('aarch64')) {
182+
console.log('PLATFORM=linux/arm64')
183+
} else if ('${{ matrix.target }}'.startsWith('armv7')) {
184+
console.log('PLATFORM=linux/arm/v7')
185+
} else {
186+
console.log('PLATFORM=linux/amd64')
187+
}
188+
" >> $GITHUB_OUTPUT
189+
node -e "
190+
if ('${{ matrix.target }}'.endsWith('-musl')) {
191+
console.log('IMAGE=node:${{ matrix.node }}-alpine')
192+
} else {
193+
console.log('IMAGE=node:${{ matrix.node }}-slim')
194+
}
195+
" >> $GITHUB_OUTPUT
196+
- name: Install dependencies
197+
run: |
198+
yarn config set --json supportedArchitectures.cpu '["current", "arm64", "x64", "arm"]'
199+
yarn config set --json supportedArchitectures.libc '["current", "musl", "gnu"]'
200+
yarn install
201+
- name: Download artifacts
202+
uses: actions/download-artifact@v6
203+
with:
204+
name: bindings-${{ matrix.target }}
205+
path: .
206+
- name: List packages
207+
run: ls -R .
208+
shell: bash
209+
- name: Set up QEMU
210+
uses: docker/setup-qemu-action@v3
211+
if: ${{ contains(matrix.target, 'armv7') }}
212+
with:
213+
platforms: all
214+
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
215+
if: ${{ contains(matrix.target, 'armv7') }}
216+
- name: Test bindings
217+
uses: addnab/docker-run-action@v3
218+
with:
219+
image: ${{ steps.docker.outputs.IMAGE }}
220+
options: '-v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace }} --platform ${{ steps.docker.outputs.PLATFORM }}'
221+
run: yarn test
222+
publish:
223+
name: Publish
224+
runs-on: ubuntu-latest
225+
permissions:
226+
contents: write
227+
id-token: write
228+
needs:
229+
- lint
230+
- test-macOS-windows-binding
231+
- test-linux-binding
232+
steps:
233+
- uses: actions/checkout@v6
234+
- name: Setup node
235+
uses: actions/setup-node@v6
236+
with:
237+
node-version: 24
238+
cache: yarn
239+
- name: Install dependencies
240+
run: yarn install
241+
- name: create npm dirs
242+
run: yarn napi create-npm-dirs
243+
- name: Download all artifacts
244+
uses: actions/download-artifact@v6
245+
with:
246+
path: artifacts
247+
- name: Move artifacts
248+
run: yarn artifacts
249+
- name: List packages
250+
run: ls -R ./npm
251+
shell: bash
252+
- name: Publish
253+
run: |
254+
npm config set provenance true
255+
if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
256+
then
257+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
258+
npm publish --access public
259+
elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
260+
then
261+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
262+
npm publish --tag next --access public
263+
else
264+
echo "Not a release, skipping publish"
265+
fi
266+
env:
267+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
268+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)