Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
- uses: actions/setup-node@v6
with:
node-version: '24'
- name: Setup nu
uses: hustcer/setup-nu@v3
- name: Build Setup Script
run: |
npm i -g pnpm
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/use-nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
- uses: actions/setup-node@v6
with:
node-version: '24'
- name: Setup nu
uses: hustcer/setup-nu@v3
- name: Build Setup Script
run: |
npm i -g pnpm
Expand Down
37 changes: 37 additions & 0 deletions nu/build.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env nu
# Description: Build the setup-nu action
# This script replaces the complex build command in package.json

# Get the project root directory
let root = $env.FILE_PWD | path dirname

# Step 1: Remove dist directory
let dist_dir = $root | path join dist
if ($dist_dir | path exists) {
rm -rf $dist_dir
print $'Removed ($dist_dir)'
}

# Step 2: Build with ncc
print 'Building with ncc...'
cd $root
^ncc build src/index.ts --minify

# Step 3: Rename exec-child.js to exec-child.cjs
let exec_child_js = $dist_dir | path join exec-child.js
let exec_child_cjs = $dist_dir | path join exec-child.cjs
if ($exec_child_js | path exists) {
mv $exec_child_js $exec_child_cjs
print $'Renamed exec-child.js to exec-child.cjs'
}

# Step 4: Replace 'exec-child.js' with 'exec-child.cjs' in index.js
let index_js = $dist_dir | path join index.js
if ($index_js | path exists) {
open --raw $index_js
| str replace -a 'exec-child.js' 'exec-child.cjs'
| save -f $index_js
print $'Updated references in index.js'
}

print 'Build completed!'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"scripts": {
"fmt": "biome format . --write",
"lint": "biome lint **/*.ts",
"build": "rm -rf dist/ && ncc build src/index.ts --minify && mv dist/exec-child.js dist/exec-child.cjs && node -e \"const fs=require('fs');const f='dist/index.js';fs.writeFileSync(f,fs.readFileSync(f,'utf8').replace(/exec-child\\.js/g,'exec-child.cjs'))\"",
"build": "nu nu/build.nu",
"run": "pnpm run build && RUNNER_TOOL_CACHE=./runner/cache RUNNER_TEMP=./runner/temp node dist/index.js"
},
"repository": {
Expand Down