From 3db94bcbe72d5ed7227638bfadcd01dfbb4e2951 Mon Sep 17 00:00:00 2001 From: Colin McDonnell Date: Tue, 29 Aug 2023 23:02:53 -0700 Subject: [PATCH] docs: add tabs for bun package manager --- README.md | 31 ++++++++++ cli.md | 59 +++++++++++++++++++ config/plugins/auto-unpack-natives.md | 6 ++ config/plugins/electronegativity.md | 6 ++ config/plugins/local-electron.md | 6 ++ config/plugins/vite.md | 6 ++ config/plugins/webpack.md | 12 ++++ .../react-with-typescript.md | 7 +++ guides/framework-integration/react.md | 12 ++++ guides/framework-integration/vue-2.md | 18 ++++++ import-existing-project.md | 21 +++++++ templates/typescript-+-webpack-template.md | 7 +++ templates/vite-+-typescript.md | 6 ++ templates/vite.md | 6 ++ templates/webpack-template.md | 6 ++ 15 files changed, 209 insertions(+) diff --git a/README.md b/README.md index 21a489f..aefc001 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,12 @@ yarn create electron-app my-app npm init electron-app@latest my-app ``` {% endtab %} + +{% tab title="Bun" %} +```bash +bunx create-electron-app@latest my-app +``` +{% endtab %} {% endtabs %} {% hint style="warning" %} @@ -52,6 +58,12 @@ yarn create electron-app my-app --template=webpack npm init electron-app@latest my-app -- --template=webpack ``` {% endtab %} + +{% tab title="Bun" %} +```bash +bunx create-electron-app@latest my-app -- --template=webpack +``` +{% endtab %} {% endtabs %} There are currently two first-party templates: @@ -85,6 +97,13 @@ cd my-app npm start ``` {% endtab %} + +{% tab title="Bun" %} +```bash +cd my-app +bun run start +``` +{% endtab %} {% endtabs %} ## Building distributables @@ -103,6 +122,12 @@ yarn make npm run make ``` {% endtab %} + +{% tab title="Bun" %} +```bash +bun run make +``` +{% endtab %} {% endtabs %} ## Publishing your app @@ -121,6 +146,12 @@ yarn run publish npm run publish ``` {% endtab %} + +{% tab title="Bun" %} +```bash +bun run publish +``` +{% endtab %} {% endtabs %} ## Advanced Usage diff --git a/cli.md b/cli.md index 04e4c75..b208454 100644 --- a/cli.md +++ b/cli.md @@ -31,6 +31,12 @@ yarn add --dev @electron-forge/cli npm install --save-dev @electron-forge/cli ``` {% endtab %} + +{% tab title="Bun" %} +```bash +bun add --dev @electron-forge/cli +``` +{% endtab %} {% endtabs %} ## Bootstrap commands @@ -70,6 +76,12 @@ yarn electron-forge init --template=webpack npx electron-forge init --template=webpack ``` {% endtab %} + +{% tab title="Bun" %} +```bash +npx electron-forge init --template=webpack +``` +{% endtab %} {% endtabs %} ### Import @@ -94,6 +106,12 @@ yarn electron-forge import npx electron-forge import ``` {% endtab %} + +{% tab title="Bun" %} +```bash +bunx electron-forge import +``` +{% endtab %} {% endtabs %} ## Build commands @@ -137,6 +155,15 @@ npm run package -- --arch="ia32" npx electron-forge package --arch="ia32" ``` {% endtab %} + +{% tab title="Bun" %} +```bash +# By default, the package command corresponds to a package npm script: +bun run package -- --arch="ia32" +# If there is no package script: +bunx electron-forge package --arch="ia32" +``` +{% endtab %} {% endtabs %} ### Make @@ -178,6 +205,15 @@ npm run make -- --arch="ia32" npx electron-forge make --arch="ia32" ``` {% endtab %} + +{% tab title="Bun" %} +```bash +# By default, the make command corresponds to a make npm script: +bun run make -- --arch="ia32" +# If there is no make script: +bunx electron-forge make --arch="ia32" +``` +{% endtab %} {% endtabs %} Building for ia32 and x64 architectures: @@ -194,6 +230,12 @@ yarn make --arch="ia32,x64" npm run make -- --arch="ia32,x64" ``` {% endtab %} + +{% tab title="Bun" %} +```bash +bun run make --arch="ia32,x64" +``` +{% endtab %} {% endtabs %} ### Publish @@ -230,6 +272,14 @@ yarn electron-forge publish --from-dry-run npx electron-forge publish -- --from-dry-run {% endtab %} + +{% tab title="Bun" %} +
# By default, the publish command corresponds to a publish npm script:
+bun run publish -- --from-dry-run
+# If there is no publish script:
+bunx electron-forge publish -- --from-dry-run
+
+{% endtab %} {% endtabs %} ## Dev commands @@ -274,6 +324,15 @@ npm start --enable-logging npx electron-forge start --enable-logging ``` {% endtab %} + +{% tab title="Bun" %} +```bash +# By default, the start command corresponds to a start npm script: +bun run start --enable-logging +# if there is no start script +bunx electron-forge start --enable-logging +``` +{% endtab %} {% endtabs %} ## Programmatic usage diff --git a/config/plugins/auto-unpack-natives.md b/config/plugins/auto-unpack-natives.md index 922a3db..f775637 100644 --- a/config/plugins/auto-unpack-natives.md +++ b/config/plugins/auto-unpack-natives.md @@ -22,6 +22,12 @@ yarn add --dev @electron-forge/plugin-auto-unpack-natives npm install --save-dev @electron-forge/plugin-auto-unpack-natives ``` {% endtab %} + +{% tab title="Bun" %} +```shell +bun add --dev @electron-forge/plugin-auto-unpack-natives +``` +{% endtab %} {% endtabs %} ## Usage diff --git a/config/plugins/electronegativity.md b/config/plugins/electronegativity.md index 85238ad..af2e0f5 100644 --- a/config/plugins/electronegativity.md +++ b/config/plugins/electronegativity.md @@ -22,6 +22,12 @@ yarn add --dev @electron-forge/plugin-electronegativity npm install --save-dev @electron-forge/plugin-electronegativity ``` {% endtab %} + +{% tab title="Bun" %} +```shell +bun add --dev @electron-forge/plugin-electronegativity +``` +{% endtab %} {% endtabs %} ## Usage diff --git a/config/plugins/local-electron.md b/config/plugins/local-electron.md index 28c25c6..2ac10e0 100644 --- a/config/plugins/local-electron.md +++ b/config/plugins/local-electron.md @@ -26,6 +26,12 @@ yarn add --dev @electron-forge/plugin-local-electron npm install --save-dev @electron-forge/plugin-local-electron ``` {% endtab %} + +{% tab title="Bun" %} +```bash +bun add --dev @electron-forge/plugin-local-electron +``` +{% endtab %} {% endtabs %} ### Usage diff --git a/config/plugins/vite.md b/config/plugins/vite.md index ac6bf10..867ca31 100644 --- a/config/plugins/vite.md +++ b/config/plugins/vite.md @@ -20,6 +20,12 @@ yarn add --dev @electron-forge/plugin-vite npm install --save-dev @electron-forge/plugin-vite ``` {% endtab %} + +{% tab title="Bun" %} +```shell +bun add --dev @electron-forge/plugin-vite +``` +{% endtab %} {% endtabs %} ## Usage diff --git a/config/plugins/webpack.md b/config/plugins/webpack.md index bf4eb79..9ac5778 100644 --- a/config/plugins/webpack.md +++ b/config/plugins/webpack.md @@ -20,6 +20,12 @@ yarn add --dev @electron-forge/plugin-webpack npm install --save-dev @electron-forge/plugin-webpack ``` {% endtab %} + +{% tab title="Bun" %} +```shell +bun add --dev @electron-forge/plugin-webpack +``` +{% endtab %} {% endtabs %} ## Usage @@ -249,6 +255,12 @@ yarn add --dev node-loader @vercel/webpack-asset-relocator-loader@1.7.3 npm install --save-dev node-loader @vercel/webpack-asset-relocator-loader@1.7.3 ``` {% endtab %} + +{% tab title="Bun" %} +```shell +bun add --dev node-loader @vercel/webpack-asset-relocator-loader@1.7.3 +``` +{% endtab %} {% endtabs %} {% hint style="warning" %} diff --git a/guides/framework-integration/react-with-typescript.md b/guides/framework-integration/react-with-typescript.md index 47035b8..4f6f6f2 100644 --- a/guides/framework-integration/react-with-typescript.md +++ b/guides/framework-integration/react-with-typescript.md @@ -32,6 +32,13 @@ npm install --save react react-dom npm install --save-dev @types/react @types/react-dom ``` {% endtab %} + +{% tab title="Bun" %} +```bash +bun add react react-dom +bun add --dev @types/react @types/react-dom +``` +{% endtab %} {% endtabs %} ### Integrate React code diff --git a/guides/framework-integration/react.md b/guides/framework-integration/react.md index 368385f..e3d9134 100644 --- a/guides/framework-integration/react.md +++ b/guides/framework-integration/react.md @@ -26,6 +26,12 @@ yarn add --dev @babel/core @babel/preset-react babel-loader npm install --save-dev @babel/core @babel/preset-react babel-loader ``` {% endtab %} + +{% tab title="Bun" %} +```text +bun add --dev @babel/core @babel/preset-react babel-loader +``` +{% endtab %} {% endtabs %} Set up the [`babel-loader`](https://www.npmjs.com/package/babel-loader)module with the [React preset](https://babeljs.io/docs/en/babel-preset-react) in `webpack.rules.js`: @@ -65,6 +71,12 @@ yarn add react react-dom npm install --save react react-dom ``` {% endtab %} + +{% tab title="Bun" %} +```bash +bun add react react-dom +``` +{% endtab %} {% endtabs %} ### Integrate React code diff --git a/guides/framework-integration/vue-2.md b/guides/framework-integration/vue-2.md index 5dc8a56..fc4a656 100644 --- a/guides/framework-integration/vue-2.md +++ b/guides/framework-integration/vue-2.md @@ -26,6 +26,12 @@ npm install --save vue yarn add vue ``` {% endtab %} + +{% tab title="Bun" %} +```bash +bun add vue +``` +{% endtab %} {% endtabs %} ### Integrate Vue 2 code @@ -81,6 +87,12 @@ npm install --save-dev vue-loader vue-template-compiler yarn add --dev vue-loader vue-template-compiler ``` {% endtab %} + +{% tab title="Bun" %} +```bash +bun add --dev vue-loader vue-template-compiler +``` +{% endtab %} {% endtabs %} Setting up the [`vue-loader` Webpack module](https://vue-loader.vuejs.org/guide/#webpack-configuration) is left as an exercise for the reader _(hint: `vue-loader` Webpack config should ideally go in the renderer configuration only)_. @@ -99,6 +111,12 @@ npm install --save vue yarn add vue ``` {% endtab %} + +{% tab title="Bun" %} +```bash +bun add vue +``` +{% endtab %} {% endtabs %} You should now be able to add single file components to your app, the same as you would for a "regular" web app. diff --git a/import-existing-project.md b/import-existing-project.md index 6d99548..f663b8e 100644 --- a/import-existing-project.md +++ b/import-existing-project.md @@ -77,6 +77,13 @@ cd my-app npm install --save-dev @electron-forge/cli @electron-forge/maker-squirrel @electron-forge/maker-deb @electron-forge/maker-zip ``` {% endtab %} + +{% tab title="Bun" %} +```bash +cd my-app +bun add --dev @electron-forge/cli @electron-forge/maker-squirrel @electron-forge/maker-deb @electron-forge/maker-zip +``` +{% endtab %} {% endtabs %} ### Configuring package.json @@ -156,6 +163,13 @@ cd my-app npm install electron-squirrel-startup ``` {% endtab %} + +{% tab title="Bun" %} +```bash +cd my-app +bun add electron-squirrel-startup +``` +{% endtab %} {% endtabs %} Then, add the following snippet as early as possible in the main process execution (before the `app.ready` event). @@ -186,6 +200,13 @@ cd my-app npm install --save-dev @electron-forge/publisher-s3 ``` {% endtab %} + +{% tab title="Bun" %} +```bash +cd my-app +bun add --dev @electron-forge/publisher-s3 +``` +{% endtab %} {% endtabs %} {% code title="package.json" %} diff --git a/templates/typescript-+-webpack-template.md b/templates/typescript-+-webpack-template.md index 5d7da9e..27e7e06 100644 --- a/templates/typescript-+-webpack-template.md +++ b/templates/typescript-+-webpack-template.md @@ -18,6 +18,13 @@ yarn create electron-app my-new-app --template=webpack-typescript npm init electron-app@latest my-new-app -- --template=webpack-typescript ``` {% endtab %} + +{% tab title="Bun" %} +```bash +bunx create-electron-app@latest my-new-app -- --template=webpack-typescript +``` +{% endtab %} + {% endtabs %} {% hint style="warning" %} diff --git a/templates/vite-+-typescript.md b/templates/vite-+-typescript.md index f43da02..7094a40 100644 --- a/templates/vite-+-typescript.md +++ b/templates/vite-+-typescript.md @@ -14,6 +14,12 @@ yarn create electron-app my-new-app --template=vite-typescript npm init electron-app@latest my-new-app -- --template=vite-typescript ``` {% endtab %} + +{% tab title="Bun" %} +```bash +bunx create-electron-app my-new-app --template=vite-typescript +``` +{% endtab %} {% endtabs %} Once you've initialized the template, you'll need to run `npm start` in the generated directory. diff --git a/templates/vite.md b/templates/vite.md index 15b30cb..ad4504f 100644 --- a/templates/vite.md +++ b/templates/vite.md @@ -18,6 +18,12 @@ yarn create electron-app my-new-app --template=vite npm init electron-app@latest my-new-app -- --template=vite ``` {% endtab %} + +{% tab title="Bun" %} +```bash +bunx create-electron-app my-new-app --template=vite +``` +{% endtab %} {% endtabs %} Once you've initialized the template, you'll need to run `npm start` in the generated directory. diff --git a/templates/webpack-template.md b/templates/webpack-template.md index e3990ad..71cd42f 100644 --- a/templates/webpack-template.md +++ b/templates/webpack-template.md @@ -18,6 +18,12 @@ yarn create electron-app my-new-app --template=webpack npm init electron-app@latest my-new-app -- --template=webpack ``` {% endtab %} + +{% tab title="Bun" %} +```bash +bunx create-electron-app my-new-app --template=webpack +``` +{% endtab %} {% endtabs %} Once you've initialized the template, you'll need to run `npm start` in the generated directory. See the [Webpack Plugin](../config/plugins/webpack.md) documentation for Electron Forge-specific configuration options.