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
12 changes: 6 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
node-version: "24"
registry-url: "https://registry.npmjs.org"
- name: Install OS dependencies
run: |
sudo apt-get update
Expand All @@ -44,7 +44,7 @@ jobs:
- name: Publish
run: npm publish --access public
env:
NPM_CONFIG_PROVENANCE: 'true'
NPM_CONFIG_PROVENANCE: "true"

publish-nightly:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
Expand All @@ -58,8 +58,8 @@ jobs:
uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
node-version: "24"
registry-url: "https://registry.npmjs.org"
- name: Install OS dependencies
run: |
sudo apt-get update
Expand All @@ -72,4 +72,4 @@ jobs:
- name: Publish
run: npm publish --provenance --tag next
env:
NPM_CONFIG_PROVENANCE: 'true'
NPM_CONFIG_PROVENANCE: "true"
32 changes: 8 additions & 24 deletions esbuild.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// SOURCE: https://github.com/peterpeterparker/create-ic/blob/main/esbuild.mjs
import esbuild from "esbuild";
import { existsSync, mkdirSync, writeFileSync } from "fs";
import { join } from "path";
import NodeResolve from "@esbuild-plugins/node-resolve";

const dist = join(process.cwd(), "dist");

Expand All @@ -15,28 +13,14 @@ const script = await esbuild.build({
bundle: true,
minify: true,
platform: "node",
format: "esm",
write: false,
plugins: [
NodeResolve.NodeResolvePlugin({
extensions: [".ts", ".js"],
onResolved: (resolved) => {
// We want all node modules in the same bundle.
// Except for the node-hid module which needs to be outside to work properly.
// There is another library with the name "hw-transport-node-hid-noevents"
// That's why need such a fine-grained check.
if (
resolved.includes("node_modules") &&
resolved.includes("node-hid") &&
!resolved.includes("noevents")
) {
return {
external: true,
};
}
return resolved;
},
}),
],
// Only native modules must be external (can't be bundled)
external: ["node-hid"],
// ESM doesn't have require(), so we create it for any deps that need it
banner: {
js: `import { createRequire } from 'module'; const require = createRequire(import.meta.url);`,
},
});

writeFileSync("dist/index.js", `${script.outputFiles[0].text}`);
writeFileSync("dist/index.mjs", script.outputFiles[0].text);
5 changes: 2 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Run CLI
# Run CLI (builds first)
run *commands:
npx ts-node ./src/index.ts {{commands}}
npm run build --silent && node ./dist/index.mjs {{commands}}

# Alias for run
alias r := run

Loading