Skip to content

Commit 27647d6

Browse files
committed
Update all packages
1 parent bcd41bc commit 27647d6

19 files changed

Lines changed: 187 additions & 260 deletions

File tree

.editorconfig

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
# EditorConfig helps developers define and maintain consistent
2-
# coding styles between different editors or IDEs
3-
# http://editorconfig.org
1+
# https://editorconfig.org
42
root = true
53

64
[*]
7-
indent_style = space
8-
indent_size = 2
9-
end_of_line = lf
105
charset = utf-8
11-
trim_trailing_whitespace = true
6+
end_of_line = lf
7+
indent_size = 2
8+
indent_style = space
129
insert_final_newline = true
10+
trim_trailing_whitespace = true

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,11 @@ jobs:
277277
publish:
278278
name: Publish
279279
runs-on: ubuntu-latest
280+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
280281
needs:
281282
- test-macos-binding
282283
- test-linux-x64-gnu-binding
283-
- test-linux-x64-musl-binding
284+
# - test-linux-x64-musl-binding
284285
- test-linux-aarch64-gnu-binding
285286
- test-linux-aarch64-musl-binding
286287
steps:

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# https://prettier.io/docs/en/ignore.html
2+
/index.d.ts
3+
/index.js
4+
/node_modules
5+
/target

.prettierrc.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# https://prettier.io/docs/en/configuration.html
2+
arrowParens: avoid
3+
endOfLine: lf
4+
trailingComma: none
5+
tabWidth: 2
6+
semi: true
7+
singleQuote: true
8+
printWidth: 100

LICENSE

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

LICENSE.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2025 Simon Oulevay (Alpha Hydrae)
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 13 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,20 @@
1-
# `@napi-rs/package-template`
1+
# `@alphahydrae/exec`
22

3-
![https://github.com/napi-rs/package-template/actions](https://github.com/napi-rs/package-template/workflows/CI/badge.svg)
3+
The [`execvp` function](https://linux.die.net/man/3/execvp) for Node.js.
44

5-
> Template project for writing node packages with napi-rs.
6-
7-
# Usage
8-
9-
1. Click **Use this template**.
10-
2. **Clone** your project.
11-
3. Run `yarn install` to install dependencies.
12-
4. Run `npx napi rename -n [name]` command under the project folder to rename your package.
13-
14-
## Install this test package
15-
16-
```
17-
yarn add @napi-rs/package-template
18-
```
19-
20-
## Support matrix
21-
22-
### Operating Systems
23-
24-
| | node14 | node16 | node18 |
25-
| ---------------- | ------ | ------ | ------ |
26-
| Windows x64 ||||
27-
| Windows x32 ||||
28-
| Windows arm64 ||||
29-
| macOS x64 ||||
30-
| macOS arm64 ||||
31-
| Linux x64 gnu ||||
32-
| Linux x64 musl ||||
33-
| Linux arm gnu ||||
34-
| Linux arm64 gnu ||||
35-
| Linux arm64 musl ||||
36-
| Android arm64 ||||
37-
| Android armv7 ||||
38-
| FreeBSD x64 ||||
39-
40-
## Ability
41-
42-
### Build
43-
44-
After `yarn build/npm run build` command, you can see `package-template.[darwin|win32|linux].node` file in project root. This is the native addon built from [lib.rs](./src/lib.rs).
45-
46-
### Test
47-
48-
With [ava](https://github.com/avajs/ava), run `yarn test/npm run test` to testing native addon. You can also switch to another testing framework if you want.
49-
50-
### CI
51-
52-
With GitHub Actions, each commit and pull request will be built and tested automatically in [`node@14`, `node@16`, `@node18`] x [`macOS`, `Linux`, `Windows`] matrix. You will never be afraid of the native addon broken in these platforms.
53-
54-
### Release
55-
56-
Release native package is very difficult in old days. Native packages may ask developers who use it to install `build toolchain` like `gcc/llvm`, `node-gyp` or something more.
57-
58-
With `GitHub actions`, we can easily prebuild a `binary` for major platforms. And with `N-API`, we should never be afraid of **ABI Compatible**.
59-
60-
The other problem is how to deliver prebuild `binary` to users. Downloading it in `postinstall` script is a common way that most packages do it right now. The problem with this solution is it introduced many other packages to download binary that has not been used by `runtime codes`. The other problem is some users may not easily download the binary from `GitHub/CDN` if they are behind a private network (But in most cases, they have a private NPM mirror).
61-
62-
In this package, we choose a better way to solve this problem. We release different `npm packages` for different platforms. And add it to `optionalDependencies` before releasing the `Major` package to npm.
63-
64-
`NPM` will choose which native package should download from `registry` automatically. You can see [npm](./npm) dir for details. And you can also run `yarn add @napi-rs/package-template` to see how it works.
65-
66-
## Develop requirements
67-
68-
- Install the latest `Rust`
69-
- Install `Node.js@10+` which fully supported `Node-API`
70-
- Install `yarn@1.x`
71-
72-
## Test in local
73-
74-
- yarn
75-
- yarn build
76-
- yarn test
77-
78-
And you will see:
5+
## Install this package
796

807
```bash
81-
$ ava --verbose
82-
83-
✔ sync function from native code
84-
✔ sleep function from native code (201ms)
85-
86-
87-
2 tests passed
88-
✨ Done in 1.12s.
8+
npm i @alphahydrae/exec
899
```
9010

91-
## Release package
92-
93-
Ensure you have set your **NPM_TOKEN** in the `GitHub` project setting.
94-
95-
In `Settings -> Secrets`, add **NPM_TOKEN** into it.
96-
97-
When you want to release the package:
98-
99-
```
100-
npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease [--preid=<prerelease-id>] | from-git]
101-
102-
git push
103-
```
11+
## Support matrix
10412

105-
GitHub actions will do the rest job for you.
13+
| OS & Architecture | Node 18 | Node 20 | Node 22 |
14+
| ----------------- | ------- | ------- | ------- |
15+
| macOS x64 ||||
16+
| macOS arm64 ||||
17+
| Linux x64 gnu ||||
18+
| Linux x64 musl ||||
19+
| Linux arm64 gnu ||||
20+
| Linux arm64 musl ||||

exec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const { doNotCloseOnExit, execvp } = require('./index.js');
2+
3+
doNotCloseOnExit(process.stdin.fd);
4+
doNotCloseOnExit(process.stdout.fd);
5+
doNotCloseOnExit(process.stderr.fd);
6+
execvp('ls', [process.argv0, 'tests']);

index2.js

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

npm/darwin-arm64/package.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
{
2-
"name": "@napi-rs/package-template-darwin-arm64",
3-
"version": "1.0.0",
2+
"name": "@alphahydrae/exec-darwin-arm64",
3+
"description": "The execvp function for Node.js",
4+
"license": "MIT",
5+
"keywords": [
6+
"exec",
7+
"execvp"
8+
],
9+
"version": "0.1.0",
410
"os": [
511
"darwin"
612
],
713
"cpu": [
814
"arm64"
915
],
10-
"main": "package-template.darwin-arm64.node",
16+
"main": "exec.darwin-arm64.node",
1117
"files": [
12-
"package-template.darwin-arm64.node"
18+
"exec.darwin-arm64.node"
1319
],
14-
"description": "Template project for writing node package with napi-rs",
15-
"keywords": [
16-
"execvp"
17-
],
18-
"license": "MIT",
19-
"engines": {
20-
"node": ">= 10"
20+
"repository": {
21+
"type": "git",
22+
"url": "git+https://github.com/AlphaHydrae/node-exec.git"
2123
},
22-
"publishConfig": {
23-
"registry": "https://registry.npmjs.org/",
24-
"access": "public"
25-
},
26-
"repository": "git@github.com:napi-rs/package-template.git"
24+
"engines": {
25+
"node": "^18 || ^20 || ^22"
26+
}
2727
}

0 commit comments

Comments
 (0)