Skip to content

Commit d1e4b92

Browse files
committed
Optimize the output size of standalone binaries
1 parent 527edc3 commit d1e4b92

18 files changed

Lines changed: 370 additions & 291 deletions

.github/CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ Use `./marp-cli.js` instead of `marp` command.
4444

4545
#### Standalone binary
4646

47-
Standalone binaries created by [pkg](https://github.com/zeit/pkg) will output to `./bin` directory.
47+
Standalone binaries created by [pkg](https://yao-pkg.github.io/pkg/) will output to `./bin` directory.
4848

4949
```bash
5050
# Build & create standalone binaries
5151
npm run build:standalone
5252
```
5353

5454
```bash
55-
./bin/marp-cli-linux --help
55+
./bin/marp --help
5656
```
5757

5858
### Testing

.github/workflows/github-release.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ jobs:
4646
run: npm run build:standalone
4747
- name: Create package
4848
run: npm run standalone:pack
49-
env:
50-
MATRIX_OS: ${{ matrix.os }}
5149
- uses: actions/upload-artifact@v7
5250
with:
5351
name: assets-${{ matrix.os }}

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,9 @@ export default config
757757

758758
#### TypeScript (`marp.config.ts`)
759759

760-
If you installed `typescript` into your local project together with Marp CLI, you can write a config by TypeScript `marp.config.ts`. Marp CLI will try to transpile `.ts` with the project configuration `tsconfig.json`.
760+
If you've installed both of Marp CLI and TypeScript (up to v6) into your local Node.js project, you can write a config by TypeScript: `marp.config.ts`. Marp CLI will try to transpile `.ts` with the project setting `tsconfig.json`.
761+
762+
If you're using the standalone binary, Marp CLI will try to load `marp.config.ts` by [Node.js native TypeScript support](https://nodejs.org/learn/typescript/run-natively). In this case, the project setting `tsconfig.json` will not be used, and there are [some constraints](https://nodejs.org/learn/typescript/run-natively#constraints).
761763

762764
In TypeScript configuration, you can specify the custom engine as the generics for `defineConfig` helper, like this:
763765

package-lock.json

Lines changed: 1 addition & 194 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@
3838
"bin": {
3939
"marp": "marp-cli.js"
4040
},
41-
"pkg": {
42-
"scripts": "lib/**/*.js"
43-
},
4441
"browserslist": [
4542
"> 1% and last 3 versions",
4643
"Firefox ESR"
@@ -59,8 +56,8 @@
5956
"prepack": "npm-run-all --parallel check:* lint:* test:coverage --parallel build types",
6057
"prepare": "npx --no patch-package || exit 0",
6158
"preversion": "run-p check:* lint:* test:coverage",
62-
"standalone": "node -e \"fs.rmSync('bin',{recursive:true,force:true})\" && pkg --sea -C Brotli --out-path ./bin .",
63-
"standalone:pack": "node ./scripts/pack.mjs",
59+
"standalone": "node ./scripts/standalone/build.mjs",
60+
"standalone:pack": "node ./scripts/standalone/pack.mjs",
6461
"test": "jest",
6562
"test:coverage": "jest --coverage",
6663
"types": "node -e \"fs.rmSync('types',{recursive:true,force:true})\" && tsc --declaration --emitDeclarationOnly --outDir types",
@@ -141,7 +138,6 @@
141138
"stylelint": "^16.26.1",
142139
"stylelint-config-standard-scss": "^15.0.1",
143140
"supertest": "^7.2.2",
144-
"tar-stream": "^3.2.0",
145141
"tinyglobby": "^0.2.17",
146142
"tslib": "^2.8.1",
147143
"typed-emitter": "^2.1.0",
@@ -151,8 +147,7 @@
151147
"which": "^4.0.0",
152148
"wrap-ansi": "^9.0.2",
153149
"yargs": "^17.7.3",
154-
"yauzl": "^3.4.0",
155-
"zip-stream": "^7.0.5"
150+
"yauzl": "^3.4.0"
156151
},
157152
"dependencies": {
158153
"@marp-team/marp-core": "^4.4.0",

0 commit comments

Comments
 (0)