Skip to content

Commit

Permalink
build: bundle docen application
Browse files Browse the repository at this point in the history
  • Loading branch information
DemoMacro committed Jul 13, 2023
1 parent 8918738 commit 3c51c95
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 22 deletions.
21 changes: 21 additions & 0 deletions packages/docen/bundle.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { execSync } from "child_process";
import { readFileSync } from "fs";

execSync("pnpm prepack", { stdio: "inherit" });

execSync("pnpm ncc build dist/cli.cjs -o dist/ncc", { stdio: "inherit" });

const version = readFileSync("package.json", "utf-8").match(
/"version": "(.*?)"/
)[1];

execSync(`cp dist/ncc/index.cjs dist/ncc/docen-${version}.cjs`, {
stdio: "inherit",
});

execSync(
`pnpm dlx pkg dist/ncc/docen-${version}.cjs --out-path dist/bundle -C GZip`,
{
stdio: "inherit",
}
);
2 changes: 1 addition & 1 deletion packages/docen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"scripts": {
"prepack": "unbuild",
"bundle": "pnpm prepack && ncc build dist/cli.cjs -o dist/ncc && cp dist/ncc/index.cjs dist/ncc/docen.cjs && pkg dist/ncc/docen.cjs --out-path dist/bundle -C GZip"
"bundle": "node bundle.mjs"
},
"repository": {
"type": "git",
Expand Down
5 changes: 0 additions & 5 deletions packages/docen/sea-config.json

This file was deleted.

47 changes: 31 additions & 16 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 3c51c95

Please sign in to comment.