adapter-node: Add a shebang to `build/index.js`
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
- Domain
- build-system
Research direction
Find the code that generates build/index.js and check how that output is covered by existing tests. Start by searching the repository for adapter-index.js and the adapter-node build entry point. Done means the generated file begins with the Node shebang and the relevant tests pass.
Written by the indexing model from the issue text.
Description
Describe the problem
I'm trying to package a SvelteKit app, but I get this error:
❯ pnpm run package
$ svelte-kit sync && svelte-package && publint
src/lib -> dist
Running publint v0.3.25 for @natoboram/leanish...
Packing files with `pnpm pack`...
Linting...
Errors:
1. pkg.bin.leanish is build/index.js but the file is not executable. It should start with a shebang, e.g. #!/usr/bin/env node.
[ELIFECYCLE] Command failed with exit code 1.
And indeed, build/index.js contains only this:
export * from './server/adapter-index.js';
Describe the proposed solution
The generated file should instead look like this:
#!/usr/bin/env node
export * from './server/adapter-index.js';
Alternatives considered
Making a Vite plugin:
function nodeShebang(): Plugin {
return {
name: 'node-shebang',
apply: 'build',
enforce: 'post',
buildApp: {
order: 'post',
handler: async () => {
const file = 'build/index.js'
const content = await readFile(file, 'utf8')
if (content.startsWith('#!')) return
await writeFile(file, `#!/usr/bin/env node\n${content}`)
},
},
}
}
Importance
nice to have
Additional Information
- Dominant language
- JavaScript
- Stars
- 20.9k
- Forks
- 2.4k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 89
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sveltejs/kit
-
adapter-cloudflare: `cloudflare:workers` keeps using the old platform proxy after the Wrangler config reloads in devPossibly taken @svelte-triage-bot claimed this 3 days ago. Openpkg:adapter-cloudflare
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
svelte-package watch mode leaves the compiled .js of a deleted .ts file in the outputPossibly taken @svelte-triage-bot claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
types / typescript
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Prerendering no longer shows progressMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
sveltejs/kit#17163 · 4 comments ·
Maintainers usually reply within 1 day
-
sync: concurrent runs can read a truncated route_meta_data.json (JSON.parse error)Possibly taken @Nic-Polumeyv claimed this 29 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
flarum/framework#5301 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
AOSSIE-Org/BabyNest#284 ·
Maintainers usually reply within 1 day
-
status:untriaged
Difficulty 1/5 Under an hour Newbie friendliness 86/100
midnightntwrk/servicedesk#275 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
seek4science/seek#2762 ·
Maintainers usually reply within 5 days