Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to docusaurus #176

Draft
wants to merge 7 commits into
base: v6
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .gitbook/assets/Untitled-2022-08-26-1442.png
Binary file not shown.
30 changes: 0 additions & 30 deletions .github/workflows/add-to-project.yml

This file was deleted.

52 changes: 0 additions & 52 deletions .github/workflows/auto-fix-lint.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/lint.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
6 changes: 0 additions & 6 deletions .markdownlint.json

This file was deleted.

1 change: 0 additions & 1 deletion .markdownlintignore

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Electron Forge is an all-in-one tool for packaging and distributing Electron app

To get started with Electron Forge, we first need to initialize a new project with `create-electron-app`. This script is a convenient wrapper around Forge's [Init](cli.md#Init) command.

{% hint style="warning" %}
:::warning
Electron Forge currently only supports npm and Yarn Classic. If you are using Yarn >=2, please use the `nodeLinker: node-modules` install mode.
{% endhint %}
:::

```bash
npm init electron-app@latest my-app
Expand All @@ -37,9 +37,9 @@ There are currently four first-party templates:

Both of these templates are built around plugins that bundle your JavaScript code for production and includes a dev server to provide a better developer experience.

{% hint style="info" %}
:::info
We highly recommend using these templates when initializing your app to take advantage of modern front-end JavaScript tooling.
{% endhint %}
:::

To learn more about authoring your own templates for Electron Forge, check out the [Writing Templates](advanced/extending-electron-forge/writing-templates.md) guide!

Expand Down
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
87 changes: 87 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
description: Quickly scaffold an Electron project with a full build pipeline
---

# Getting Started

## Overview

Electron Forge is an all-in-one tool for packaging and distributing Electron applications. It combines many single-purpose packages to create a full build pipeline that works out of the box, complete with code signing, installers, and artifact publishing. For advanced workflows, custom build logic can be added in the Forge lifecycle through its [Plugin API](config/plugins/). Custom build and storage targets can be handled by creating your own [Makers](config/makers/) and [Publishers](config/publishers/).

## Creating a new app

To get started with Electron Forge, we first need to initialize a new project with `create-electron-app`. This script is a convenient wrapper around Forge's [Init](cli.md#Init) command.

:::warning
Electron Forge currently only supports npm and Yarn Classic. If you are using Yarn >=2, please use the `nodeLinker: node-modules` install mode.
:::

```bash
npm init electron-app@latest my-app
```

### Using templates

Forge's initialization scripts can add additional template code with the `--template=[template-name]` flag.

```bash
npm init electron-app@latest my-app -- --template=webpack
```

There are currently four first-party templates:

* `webpack`
* `webpack-typescript`
* `vite`
* `vite-typescript`

Both of these templates are built around plugins that bundle your JavaScript code for production and includes a dev server to provide a better developer experience.

:::info
We highly recommend using these templates when initializing your app to take advantage of modern front-end JavaScript tooling.
:::

To learn more about authoring your own templates for Electron Forge, check out the [Writing Templates](advanced/extending-electron-forge/writing-templates.md) guide!

## Starting your app

You should now have a directory called `my-app` with all the files you need for a basic Electron app.

```bash
cd my-app
npm start
```

## Building distributables

So you've got an **amazing** application there, and you want to package it all up and share it with the world. If you run the `make` script, Electron Forge will generate you platform specific distributables for you to share with everyone. For more information on what kind of distributables you can make, check out the [Makers](config/makers/) documentation.

```bash
npm run make
```

## Publishing your app

Now you have distributables that you can share with your users. If you run the `publish` script, Electron Forge will then publish the platform-specific distributables for you, using the publishing method of your choice. For example, if you want to publish your assets to GitHub, you can install the GitHub publisher dependency using:

```bash
npm install --save-dev @electron-forge/publisher-github
```

Once you have [configured the publisher according to the documentation](config/publishers/github), run the following command to upload your distributables:

```bash
npm run publish
```

For more information on what publishers we currently support, check out the [Publishers](config/publishers/) documentation.

## Advanced Usage

Once you've got a basic app starting, building and publishing, it's time to add your custom configuration, which can be done in the `forge.config.js` file. Configuration options are specified in the [Configuration Docs](https://www.electronforge.io/configuration).

You can also check out the documentation on some of our more advanced features like:

* [Adding plugins](config/plugins/)
* [Debugging your app](advanced/debugging.md)
* [Writing your own makers, publishers and plugins](advanced/extending-electron-forge/)
16 changes: 8 additions & 8 deletions SUMMARY.md → docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

## Configuration <a href="#config" id="config"></a>

* [Overview](config/configuration.md)
* [Overview](config/configuration.mdx)
* [Plugins](config/plugins/README.md)
* [Webpack Plugin](config/plugins/webpack.md)
* [Vite Plugin](config/plugins/vite.md)
* [Webpack Plugin](config/plugins/webpack.mdx)
* [Vite Plugin](config/plugins/vite.mdx)
* [Electronegativity Plugin](config/plugins/electronegativity.md)
* [Auto Unpack Native Modules Plugin](config/plugins/auto-unpack-natives.md)
* [Local Electron Plugin](config/plugins/local-electron.md)
* [Fuses Plugin](config/plugins/fuses.md)
* [Makers](config/makers/README.md)
* [Fuses Plugin](config/plugins/fuses.mdx)
* [Makers](config/makers/README.mdx)
* [AppX](config/makers/appx.md)
* [deb](config/makers/deb.md)
* [DMG](config/makers/dmg.md)
Expand Down Expand Up @@ -55,9 +55,9 @@
* [Custom App Icons](guides/create-and-add-icons.md)
* [Framework Integration](guides/framework-integration/README.md)
* [Parcel](guides/framework-integration/parcel.md)
* [React](guides/framework-integration/react.md)
* [React with TypeScript](guides/framework-integration/react-with-typescript.md)
* [Vue 3](guides/framework-integration/vue-3.md)
* [React](guides/framework-integration/react.mdx)
* [React with TypeScript](guides/framework-integration/react-with-typescript.mdx)
* [Vue 3](guides/framework-integration/vue-3.mdx)
* [Developing with WSL](guides/developing-with-wsl.md)

## Advanced
Expand Down
File renamed without changes.
13 changes: 6 additions & 7 deletions advanced/debugging.md → docs/advanced/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ In Electron apps, the main and renderer processes have different debugging mecha

This guide goes over Forge-specific ways of debugging the main process through the command line or with a code editor.

{% hint style="info" %}
:::info
Each section in this guide assumes your `package.json` has a `"start": "electron-forge start"` script.
{% endhint %}
:::

For more general information on debugging Electron apps, see the [main Electron docs on Application Debugging](https://www.electronjs.org/docs/latest/tutorial/application-debugging#renderer-process).

Expand All @@ -23,16 +23,15 @@ npm run start -- --inspect-electron

Once your app is active, open [`chrome://inspect`](chrome://inspect) in any Chromium-based browser to attach a debugger to the main process of your app.

{% hint style="info" %}
:::info
To add a breakpoint at the first line of execution when debugging, you can use Forge's `--inspect-brk-electron` flag instead.
{% endhint %}
:::

## Debugging with VS Code

To debug the main process through VS Code, add the following [Node.js launch configuration](https://code.visualstudio.com/docs/nodejs/nodejs-debugging):

{% code title=".vscode/launch.json" %}
```json5
```json title=".vscode/launch.json"
{
"configurations": [
{
Expand All @@ -54,7 +53,7 @@ To debug the main process through VS Code, add the following [Node.js launch con
]
}
```
{% endcode %}


Once this configuration is added, launch the app via VS Code's Run and Debug view to start debugging.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This method must synchronously return a boolean indicating whether or not this m

If the issue is a missing dependency you should log out a **helpful** error message telling the developer exactly what is missing and if possible how to get it.

```javascript
```jsx
export default class MyMaker extends MakerBase {
isSupportedOnCurrentPlatform () {
return process.platform === 'linux' && this.isFakeRootInstalled();
Expand All @@ -36,7 +36,7 @@ The `config` for the maker will be available on `this.config`.

The options object is documented in [`MakerOptions`](https://js.electronforge.io/interfaces/_electron_forge_maker_base.MakerOptions.html).

```javascript
```jsx
export default class MyMaker extends MakerBase {
async make (opts) {
const pathToMagicInstaller = await makeMagicInstaller(opts.dir);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ An Electron Forge Plugin has to export a single class that extends our base plug

If implemented this method will be once during plugin initialization inside Forge, this method is called only once and shouldn't result in any side effects being executed. You must return an object in a similar format to `forgeConfig.hooks`. i.e. an object map between hook names and an array of hook functions.

The possible hook names and the parameters passed to the hook function you return are documented over in the [Configuration](../../config/configuration.md) section of the docs.
The possible hook names and the parameters passed to the hook function you return are documented over in the [Configuration](../../config/configuration.mdx) section of the docs.

```javascript
```jsx
export default class MyPlugin extends PluginBase {
getHooks () {
return {
Expand All @@ -28,11 +28,11 @@ If implemented, this method will be called every time the user runs `electron-fo

Please note that overriding the start logic here only works in **development** if you want to change how an app runs once packaged you will need to use a build hook to inject code into the packaged app.

{% hint style="info" %}
:::info
`StartOptions`is explained further [in the API docs](https://js.electronforge.io/interfaces/\_electron\_forge\_shared\_types.StartOptions.html).
{% endhint %}
:::

```javascript
```jsx
export default class MyPlugin extends Pluginbase {
async startLogic (opts) {
await this.compileMainProcess();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The `config` for the publisher will be available on `this.config`.

The options object is documented in [`PublisherOptions`](https://js.electronforge.io/interfaces/_electron_forge_publisher_base.PublisherOptions.html).

```javascript
```jsx
export default class MyPublisher extends PublisherBase {
async publish (opts) {
for (const result of opts.makeResults) {
Expand Down
Loading