Skip to content

Commit

Permalink
ci: fix publish script
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Jul 11, 2024
1 parent e621316 commit 20be999
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 51 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ jobs:
path: artifacts
- name: create npm dirs
run: |
pnpm napi create-npm-dirs
pnpm napi artifacts --build-output-dir packages/core
pnpm napi create-npm-dirs --package-json-path packages/core/package.json
pnpm napi artifacts --package-json-path packages/core/package.json --build-output-dir packages/core
- name: List packages
run: ls -R ./npm
shell: bash
Expand All @@ -332,11 +332,11 @@ jobs:
if git log -1 --pretty=%B | grep "^v\?[0-9]\+\.[0-9]\+\.[0-9]\+$";
then
pnpm napi pre-publish -t npm --package-json-path packages/core/package.json
pnpm publish --filter=@oxc/node-core --access public
pnpm publish --filter=@oxc/node-core --access public --no-git-checks
elif git log -1 --pretty=%B | grep "^v\?[0-9]\+\.[0-9]\+\.[0-9]\+";
then
pnpm napi pre-publish -t npm --package-json-path packages/core/package.json
pnpm --filter=@oxc/node-core publish --tag next --access public
pnpm --filter=@oxc/node-core publish --tag next --access public --no-git-checks
else
echo "Not a release, skipping publish"
fi
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,4 @@ target/
*.node
*.wasm
pgo-data
/npm
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

Fast and friendly Node.js devtools based on [OXC](https://github.com/oxc-project/oxc)

## `@oxc/node-core`
## `@oxc-node/core`

Transformer and register for Node.js projects.

### Usage

```bash
node --import @oxc/node-core ./path/to/entry.ts
node --import @oxc-node/core ./path/to/entry.ts
```
21 changes: 1 addition & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"typescript": "^5.5.3"
},
"scripts": {
"build": "napi build --platform --release -o packages/core",
"build": "napi build --platform --release -o packages/core --package-json-path packages/core/package.json",
"format": "taplo fmt && prettier --write . && cargo fmt",
"lint": "oxlint",
"test": "pnpm --filter=integrate-module* run test",
Expand All @@ -41,24 +41,5 @@
"trailingComma": "all",
"singleQuote": true,
"arrowParens": "always"
},
"napi": {
"binaryName": "oxc-node",
"packageName": "@oxc/node-core",
"targets": [
"x86_64-apple-darwin",
"aarch64-apple-darwin",
"x86_64-pc-windows-msvc",
"x86_64-unknown-linux-gnu",
"aarch64-linux-android",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"aarch64-pc-windows-msvc",
"armv7-unknown-linux-gnueabihf",
"x86_64-unknown-linux-musl",
"i686-pc-windows-msvc",
"armv7-linux-androideabi",
"wasm32-wasip1-threads"
]
}
}
9 changes: 9 additions & 0 deletions packages/core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# `@oxc-node/core`

Transformer and register for Node.js projects.

## Usage

```bash
node --import @oxc-node/core ./path/to/entry.ts
```
2 changes: 1 addition & 1 deletion packages/core/browser.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from '@oxc/node-core-wasm32-wasi'
export * from '@oxc-node/core-wasm32-wasi'
42 changes: 21 additions & 21 deletions packages/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function requireNative() {
loadErrors.push(e)
}
try {
return require('@oxc/node-core-android-arm64')
return require('@oxc-node/core-android-arm64')
} catch (e) {
loadErrors.push(e)
}
Expand All @@ -77,7 +77,7 @@ function requireNative() {
loadErrors.push(e)
}
try {
return require('@oxc/node-core-android-arm-eabi')
return require('@oxc-node/core-android-arm-eabi')
} catch (e) {
loadErrors.push(e)
}
Expand All @@ -93,7 +93,7 @@ function requireNative() {
loadErrors.push(e)
}
try {
return require('@oxc/node-core-win32-x64-msvc')
return require('@oxc-node/core-win32-x64-msvc')
} catch (e) {
loadErrors.push(e)
}
Expand All @@ -105,7 +105,7 @@ function requireNative() {
loadErrors.push(e)
}
try {
return require('@oxc/node-core-win32-ia32-msvc')
return require('@oxc-node/core-win32-ia32-msvc')
} catch (e) {
loadErrors.push(e)
}
Expand All @@ -117,7 +117,7 @@ function requireNative() {
loadErrors.push(e)
}
try {
return require('@oxc/node-core-win32-arm64-msvc')
return require('@oxc-node/core-win32-arm64-msvc')
} catch (e) {
loadErrors.push(e)
}
Expand All @@ -132,7 +132,7 @@ function requireNative() {
loadErrors.push(e)
}
try {
return require('@oxc/node-core-darwin-universal')
return require('@oxc-node/core-darwin-universal')
} catch (e) {
loadErrors.push(e)
}
Expand All @@ -144,7 +144,7 @@ function requireNative() {
loadErrors.push(e)
}
try {
return require('@oxc/node-core-darwin-x64')
return require('@oxc-node/core-darwin-x64')
} catch (e) {
loadErrors.push(e)
}
Expand All @@ -156,7 +156,7 @@ function requireNative() {
loadErrors.push(e)
}
try {
return require('@oxc/node-core-darwin-arm64')
return require('@oxc-node/core-darwin-arm64')
} catch (e) {
loadErrors.push(e)
}
Expand All @@ -172,7 +172,7 @@ function requireNative() {
loadErrors.push(e)
}
try {
return require('@oxc/node-core-freebsd-x64')
return require('@oxc-node/core-freebsd-x64')
} catch (e) {
loadErrors.push(e)
}
Expand All @@ -184,7 +184,7 @@ function requireNative() {
loadErrors.push(e)
}
try {
return require('@oxc/node-core-freebsd-arm64')
return require('@oxc-node/core-freebsd-arm64')
} catch (e) {
loadErrors.push(e)
}
Expand All @@ -201,7 +201,7 @@ function requireNative() {
loadErrors.push(e)
}
try {
return require('@oxc/node-core-linux-x64-musl')
return require('@oxc-node/core-linux-x64-musl')
} catch (e) {
loadErrors.push(e)
}
Expand All @@ -213,7 +213,7 @@ function requireNative() {
loadErrors.push(e)
}
try {
return require('@oxc/node-core-linux-x64-gnu')
return require('@oxc-node/core-linux-x64-gnu')
} catch (e) {
loadErrors.push(e)
}
Expand All @@ -227,7 +227,7 @@ function requireNative() {
loadErrors.push(e)
}
try {
return require('@oxc/node-core-linux-arm64-musl')
return require('@oxc-node/core-linux-arm64-musl')
} catch (e) {
loadErrors.push(e)
}
Expand All @@ -239,7 +239,7 @@ function requireNative() {
loadErrors.push(e)
}
try {
return require('@oxc/node-core-linux-arm64-gnu')
return require('@oxc-node/core-linux-arm64-gnu')
} catch (e) {
loadErrors.push(e)
}
Expand All @@ -253,7 +253,7 @@ function requireNative() {
loadErrors.push(e)
}
try {
return require('@oxc/node-core-linux-arm-musleabihf')
return require('@oxc-node/core-linux-arm-musleabihf')
} catch (e) {
loadErrors.push(e)
}
Expand All @@ -265,7 +265,7 @@ function requireNative() {
loadErrors.push(e)
}
try {
return require('@oxc/node-core-linux-arm-gnueabihf')
return require('@oxc-node/core-linux-arm-gnueabihf')
} catch (e) {
loadErrors.push(e)
}
Expand All @@ -279,7 +279,7 @@ function requireNative() {
loadErrors.push(e)
}
try {
return require('@oxc/node-core-linux-riscv64-musl')
return require('@oxc-node/core-linux-riscv64-musl')
} catch (e) {
loadErrors.push(e)
}
Expand All @@ -291,7 +291,7 @@ function requireNative() {
loadErrors.push(e)
}
try {
return require('@oxc/node-core-linux-riscv64-gnu')
return require('@oxc-node/core-linux-riscv64-gnu')
} catch (e) {
loadErrors.push(e)
}
Expand All @@ -304,7 +304,7 @@ function requireNative() {
loadErrors.push(e)
}
try {
return require('@oxc/node-core-linux-ppc64-gnu')
return require('@oxc-node/core-linux-ppc64-gnu')
} catch (e) {
loadErrors.push(e)
}
Expand All @@ -316,7 +316,7 @@ function requireNative() {
loadErrors.push(e)
}
try {
return require('@oxc/node-core-linux-s390x-gnu')
return require('@oxc-node/core-linux-s390x-gnu')
} catch (e) {
loadErrors.push(e)
}
Expand All @@ -341,7 +341,7 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
}
if (!nativeBinding) {
try {
nativeBinding = require('@oxc/node-core-wasm32-wasi')
nativeBinding = require('@oxc-node/core-wasm32-wasi')
} catch (err) {
if (process.env.NAPI_RS_FORCE_WASI) {
console.error(err)
Expand Down
4 changes: 2 additions & 2 deletions packages/core/oxc-node.wasi.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ if (__nodeFs.existsSync(__wasmDebugFilePath)) {
__wasmFilePath = __wasmDebugFilePath
} else if (!__nodeFs.existsSync(__wasmFilePath)) {
try {
__wasmFilePath = __nodePath.resolve('@oxc/node-core-wasm32-wasi')
__wasmFilePath = __nodePath.resolve('@oxc-node/core-wasm32-wasi')
} catch {
throw new Error('Cannot find oxc-node.wasm32-wasi.wasm file, and @oxc/node-core-wasm32-wasi package is not installed.')
throw new Error('Cannot find oxc-node.wasm32-wasi.wasm file, and @oxc-node/core-wasm32-wasi package is not installed.')
}
}

Expand Down
24 changes: 23 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@oxc/node-core",
"name": "@oxc-node/core",
"version": "0.0.0",
"main": "./index.js",
"browser": "./browser.js",
Expand Down Expand Up @@ -30,6 +30,28 @@
"import": "./register.mjs"
}
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"napi": {
"binaryName": "oxc-node",
"targets": [
"x86_64-apple-darwin",
"aarch64-apple-darwin",
"x86_64-pc-windows-msvc",
"x86_64-unknown-linux-gnu",
"aarch64-linux-android",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"aarch64-pc-windows-msvc",
"armv7-unknown-linux-gnueabihf",
"x86_64-unknown-linux-musl",
"i686-pc-windows-msvc",
"armv7-linux-androideabi",
"wasm32-wasip1-threads"
]
},
"funding": [
{
"type": "github",
Expand Down

0 comments on commit 20be999

Please sign in to comment.