{"id":16392976,"url":"https://github.com/yjl9903/presea","last_synced_at":"2025-03-21T02:32:18.289Z","repository":{"id":153949050,"uuid":"630171249","full_name":"yjl9903/presea","owner":"yjl9903","description":"An utility function for bundling Node.js single executable applications.","archived":false,"fork":false,"pushed_at":"2024-03-27T12:25:30.000Z","size":524,"stargazers_count":14,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-16T14:36:21.396Z","etag":null,"topics":["ncc","nodejs","single-executable","unbuild"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/presea","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yjl9903.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-19T20:22:38.000Z","updated_at":"2024-06-21T08:45:45.000Z","dependencies_parsed_at":"2024-03-27T12:50:04.274Z","dependency_job_id":null,"html_url":"https://github.com/yjl9903/presea","commit_stats":null,"previous_names":["yjl9903/presea","yjl9903/unbuild-sea"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjl9903%2Fpresea","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjl9903%2Fpresea/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjl9903%2Fpresea/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjl9903%2Fpresea/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yjl9903","download_url":"https://codeload.github.com/yjl9903/presea/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244725583,"owners_count":20499632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ncc","nodejs","single-executable","unbuild"],"created_at":"2024-10-11T04:52:00.651Z","updated_at":"2025-03-21T02:32:18.008Z","avatar_url":"https://github.com/yjl9903.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# presea\n\n[![version](https://img.shields.io/npm/v/presea?label=presea)](https://www.npmjs.com/package/presea) [![CI](https://github.com/yjl9903/presea/actions/workflows/ci.yaml/badge.svg)](https://github.com/yjl9903/presea/actions/workflows/ci.yaml)\n\nAn utility function for bundling Node.js single executable applications.\n\nFrom [Node.js 20](https://nodejs.org/en/blog/announcements/v20-release-announce), it supports Single Executable Applications experimentally. This package integrates the binary bundle steps with [unbuild](https://github.com/unjs/unbuild) following [Single executable applications | Node.js v20.0.0 Document](https://nodejs.org/api/single-executable-applications.html).\n\n## Installation\n\n```bash\nnpm i -D presea\n```\n\n## Usage\n\n```ts\nimport { bundle } from 'presea'\n\nawait bundle('path/to/package')\n```\n\n### CLI\n\nThis is working in progress.\n\n```bash\nnpm i -g presea\n\necho \"console.log('Hello')\" \u003e cli.js\n\npresea cli.js\n```\n\n### GitHub Actions\n\nHere is an example GitHub Actions config to bundle single executable applications.\n\nYou should replace `\u003cbin\u003e` to your own binary name which is the same as your `package.json` or your build config.\n\n```yaml\nname: Release\n\non:\n  push:\n    tags:\n      - 'v*'\n\njobs:\n  bundle:\n    name: Bundle on ${{ matrix.target }}\n\n    runs-on: ${{ matrix.os }}\n\n    strategy:\n      fail-fast: false\n      matrix:\n        include:\n          - target: linux\n            os: ubuntu-latest\n            binary: ./dist/\u003cbin\u003e\n          - target: windows\n            os: windows-latest\n            binary: .\\dist\\\u003cbin\u003e.exe\n\n    steps:\n      - uses: actions/checkout@v3\n\n      - name: Setup pnpm\n        uses: pnpm/action-setup@v2.2.4\n\n      - name: Setup node\n        uses: actions/setup-node@v3\n        with:\n          node-version: 20.x\n          cache: pnpm\n\n      - name: Install\n        run: pnpm install\n\n      - name: Build\n        run: pnpm build  # now binary is located at matrix.binary\n\n      # Upload to release and so on...\n```\n\n### unbuild\n\n\u003e **Warning**\n\u003e\n\u003e Currently, SEA only supports for a single script, and can not require other node_modules.\n\u003e\n\u003e But unbuild can not bundle the whole project into a single script.\n\u003e\n\u003e See [feat: unbuild bundle into a single script](https://github.com/yjl9903/presea/issues/9).\n\nYou should provide field `bin` in your `package.json` like the following config.\n\n```JSON\n{\n  \"bin\": {\n    \"hello\": \"./dist/hello.mjs\"\n  }\n}\n```\n\nImport presea preset in your `build.config.ts`.\n\n```ts\n// build.config.ts\n\nimport { defineBuildConfig } from 'unbuild';\n\nimport { Sea } from 'presea/unbuild';\n\nexport default defineBuildConfig({\n  preset: Sea(),\n  // Your config...\n});\n```\n\nThen, just run `unbuild` and the bundled single executable application is in your output directory.\n\n```bash\n$ npx unbuild\n\n$ ./dist/hello world\nHello, world!\n```\n\n## Development\n\n+ Clone this repository\n+ Use `pnpm` as the package manager (`npm i -g pnpm`)\n+ Install dependencies using `pnpm install`\n+ Build the module using `pnpm build` or stub the module using `pnpm dev`\n+ Test the bundle using `cd example \u0026\u0026 pnpm i \u0026\u0026 pnpm build`\n\n## License\n\nMIT License © 2023 [XLor](https://github.com/yjl9903)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyjl9903%2Fpresea","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyjl9903%2Fpresea","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyjl9903%2Fpresea/lists"}