Skip to content

Commit

Permalink
add --bun option and document bunx --bun
Browse files Browse the repository at this point in the history
  • Loading branch information
rubys committed Apr 14, 2024
1 parent 4ac4943 commit 910eaca
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ To run once:

```
npx --yes @flydotio/dockerfile@latest
bunx --bun @flydotio/dockerfile@latest
```

Or install it with your favorite package manager:
Expand All @@ -23,7 +24,7 @@ pnpm add -D @flydotio/dockerfile
yarn add @flydotio/dockerfile --dev
```

Once installed, you can run and re-run using `npx dockerfile` for Node.js applications or `bunx dockerfile` for Bun applications.
Once installed, you can run and re-run using `npx dockerfile` for Node.js applications or `bunx --bun dockerfile` for Bun applications.

Options are saved between runs into `package.json`. To invert a boolean options, add or remove a no- prefix from the option name.

Expand Down
5 changes: 3 additions & 2 deletions gdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import * as ShellQuote from 'shell-quote'
// defaults for all the flags that will be saved
export const defaults = {
alpine: false,
bun: false,
build: '',
cache: false,
cmd: '',
Expand Down Expand Up @@ -637,7 +638,7 @@ export class GDF {

// Is the packager bun?
get bun() {
return this.packager === 'bun'
return this.options.bun || this.packager === 'bun'
}

// How to install python (switched from buster to bullseye)
Expand Down Expand Up @@ -740,7 +741,7 @@ export class GDF {
} else if (this.#pj.main) {
return [this.packager === 'bun' ? 'bun' : 'node', this.#pj.main]
} else if (this.svelte) {
return ['bun', './build/index.js']
return [this.bun ? 'bun' : 'node', './build/index.js']
} else if (this.packager === 'bun') {
return ['bun', 'index.ts']
} else {
Expand Down
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ const options = yargs((hideBin(process.argv)))
describe: 'if set to "defer" will run build at deploy time',
type: 'string'
})
.option('bun', {
describe: 'use bun instead of node',
type: 'boolean'
})
.option('cmd', {
describe: 'CMD to be used in the Dockerfile',
type: 'string'
Expand Down

0 comments on commit 910eaca

Please sign in to comment.