Skip to content

Commit

Permalink
feat: use node sea to create single-executable-applications
Browse files Browse the repository at this point in the history
  • Loading branch information
DemoMacro committed Jun 30, 2023
1 parent 4315366 commit 27c1d0b
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 10 deletions.
10 changes: 10 additions & 0 deletions packages/docen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ $ pnpm add -D docen

## Usage

```bash
Usage: docen [command] [options]

Options:
-s, --source Source directory
-t, --target Target directory
-v, --version Show version number
-h, --help Show help
```

## License

- [MIT](LICENSE) © [Demo Macro](https://imst.xyz/)
16 changes: 15 additions & 1 deletion packages/docen/build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,19 @@ import { defineBuildConfig } from "unbuild";

export default defineBuildConfig({
declaration: true,
entries: ["src/index", "src/cli"],
entries: [
"src/index",
"src/cli",
{
input: "src/index",
format: "cjs",
},
{
input: "src/cli",
format: "cjs",
},
],
rollup: {
emitCJS: true,
},
});
12 changes: 9 additions & 3 deletions packages/docen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
"name": "docen",
"version": "0.0.0",
"description": "Programmatically and command-line implementation of document formatting, powered by Demo Macro.",
"main": "dist/index.mjs",
"main": "dist/index.cjs",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"bin": {
"docen": "dist/cli.mjs"
"docen": "dist/cli.cjs"
},
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"scripts": {
"prepack": "unbuild"
Expand All @@ -32,7 +38,7 @@
},
"homepage": "https://github.com/DemoMacro/docen#readme",
"dependencies": {
"@funish/cli": "0.0.4",
"@funish/cli": "0.0.4-edge.0",
"file-type": "18.5.0",
"mammoth": "1.6.0"
}
Expand Down
5 changes: 5 additions & 0 deletions packages/docen/sea-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"main": "dist/ncc/index.cjs",
"output": "dist/prep.blob",
"disableExperimentalSEAWarning": true
}
6 changes: 6 additions & 0 deletions packages/docen/sea.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pnpm prepack
pnpm ncc build dist/cli.cjs -o dist/ncc
node --experimental-sea-config sea-config.json
Copy-Item (Get-Command node).Source dist/docen.exe
npx postject dist/docen.exe NODE_SEA_BLOB dist/prep.blob `
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
20 changes: 14 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 27c1d0b

Please sign in to comment.