Skip to content

Commit ccc2b2d

Browse files
committed
[skip ci] docs: adjust headers
1 parent 7efee20 commit ccc2b2d

File tree

5 files changed

+72
-73
lines changed

5 files changed

+72
-73
lines changed

docs/.vuepress/config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ module.exports = {
3333
'upgrading'
3434
]
3535
},
36-
displayAllHeaders: true,
3736
repo: 'nklayman/vue-cli-plugin-electron-builder',
3837
docsDir: 'docs',
3938
editLinks: true,

docs/guide/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Quick Start
33
sidebarDepth: 2
44
---
55

6-
## Quick Start
6+
# Quick Start
77

88
::: warning Important
99
Your app must be created with Vue-CLI 3 (vue create my-app), will not work with Vue-CLI 2 (vue init webpack my-app)!
@@ -13,7 +13,7 @@ Your app must be created with Vue-CLI 3 (vue create my-app), will not work with
1313
These docs are for the v1.0.0-beta release of VCP Electron Builder. If you were previously using an older version of vue-cli-plugin-electron-builder (<1.0.0), please see the [upgrade guide](./upgrading.md) or [view the old docs](https://github.com/nklayman/vue-cli-plugin-electron-builder/tree/legacy).
1414
:::
1515

16-
### Installation
16+
## Installation
1717

1818
Open a terminal in the directory of your app created with Vue-CLI 3.
1919

@@ -23,7 +23,7 @@ Then, install and invoke the generator of vue-cli-plugin-electron-builder by run
2323

2424
That's It! You're ready to go!
2525

26-
### To start a development server
26+
## To start a development server
2727

2828
If you use [Yarn](https://yarnpkg.com/en/) (strongly recommended):
2929

@@ -33,7 +33,7 @@ or if you use NPM:
3333

3434
`npm run serve:electron`
3535

36-
### To build your app
36+
## To build your app
3737

3838
With Yarn:
3939

docs/guide/configuration.md

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
sidebarDepth: 2
33
---
44

5-
## Configuration
5+
# Configuration
66

7-
### Configuring Electron Builder
7+
## Configuring Electron Builder
88

99
To see available options, check out [Electron Builder Configuration Options](https://www.electron.build/configuration/configuration)
1010

@@ -14,21 +14,21 @@ They can be placed under the `builderOptions` key in vue-cli-plugin-electron-bui
1414
// vue.config.js
1515

1616
module.exports = {
17-
pluginOptions: {
18-
electronBuilder: {
19-
builderOptions: {
20-
// options placed here will be merged with default configuration and passed to electron-builder
21-
}
17+
pluginOptions: {
18+
electronBuilder: {
19+
builderOptions: {
20+
// options placed here will be merged with default configuration and passed to electron-builder
21+
}
22+
}
2223
}
23-
}
2424
}
2525
```
2626

2727
:::tip
2828
All CLI arguments passed to `build:electron` will be forwarded to electron-builder.
2929
:::
3030

31-
### Webpack configuration
31+
## Webpack configuration
3232

3333
Your regular config is used for bundling the renderer process (your app). To modify the webpack config for the electron main process only, use the `chainWebpackMainProcess` function under vue-cli-plugin-electron-builder's plugin options in `vue.config.js`. Use `chainWebpackRendererProcess` customize your app's webpack config for Electron builds only. To learn more about webpack chaining, see [webpack-chain](https://github.com/mozilla-neutrino/webpack-chain). The function should take a config argument, modify it through webpack-chain, and then return it.
3434

@@ -38,32 +38,32 @@ Your regular config is used for bundling the renderer process (your app). To mod
3838
// vue.config.js
3939

4040
module.exports = {
41-
configureWebpack: {
42-
// Configuration applied to all builds
43-
},
44-
pluginOptions: {
45-
electronBuilder: {
46-
chainWebpackMainProcess: config => {
47-
// Chain webpack config for electron main process only
48-
},
49-
chainWebpackRendererProcess: config => {
50-
// Chain webpack config for electron renderer process only
51-
// The following example will set IS_ELECTRON to true in your app
52-
config.plugin('define').tap(args => {
53-
args[0]['IS_ELECTRON'] = true
54-
return args
55-
})
56-
// If you do not return the config property, your app may break!
57-
return config
58-
},
59-
// Use this to change the entrypoint of your app's main process
60-
mainProcessFile: 'src/myBackgroundFile.js'
41+
configureWebpack: {
42+
// Configuration applied to all builds
43+
},
44+
pluginOptions: {
45+
electronBuilder: {
46+
chainWebpackMainProcess: config => {
47+
// Chain webpack config for electron main process only
48+
},
49+
chainWebpackRendererProcess: config => {
50+
// Chain webpack config for electron renderer process only
51+
// The following example will set IS_ELECTRON to true in your app
52+
config.plugin('define').tap(args => {
53+
args[0]['IS_ELECTRON'] = true
54+
return args
55+
})
56+
// If you do not return the config property, your app may break!
57+
return config
58+
},
59+
// Use this to change the entrypoint of your app's main process
60+
mainProcessFile: 'src/myBackgroundFile.js'
61+
}
6162
}
62-
}
6363
}
6464
```
6565

66-
### Changing the output directory
66+
## Changing the output directory
6767

6868
If you don't want your files outputted into dist_electron, you can choose a custom folder in vue-cli-plugin-electron-builder's plugin options.
6969

@@ -73,29 +73,29 @@ If you don't want your files outputted into dist_electron, you can choose a cust
7373
// vue.config.js
7474

7575
module.exports = {
76-
pluginOptions: {
77-
electronBuilder: {
78-
outputDir: 'electron-builder-output-dir'
76+
pluginOptions: {
77+
electronBuilder: {
78+
outputDir: 'electron-builder-output-dir'
79+
}
7980
}
80-
}
8181
}
8282
```
8383

84-
### TypeScript Options
84+
## TypeScript Options
8585

8686
Typescript support is automatic and requires no configuration, just add the `@vue/typescript` cli plugin. There are a few options for configuring typescript if necessary:
8787

8888
```javascript
8989
// vue.config.js
9090

9191
module.exports = {
92-
pluginOptions: {
93-
electronBuilder: {
94-
// option: default // description
95-
disableMainProcessTypescript: false, // Manually disable typescript plugin for main process. Enable if you want to use regular js for the main process (src/background.js by default).
96-
mainProcessTypeChecking: false // Manually enable type checking during webpck bundling for background file.
92+
pluginOptions: {
93+
electronBuilder: {
94+
// option: default // description
95+
disableMainProcessTypescript: false, // Manually disable typescript plugin for main process. Enable if you want to use regular js for the main process (src/background.js by default).
96+
mainProcessTypeChecking: false // Manually enable type checking during webpck bundling for background file.
97+
}
9798
}
98-
}
9999
}
100100
```
101101

docs/guide/guide.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22
sidebarDepth: 2
33
---
44

5-
## Guide
5+
# Guide
66

7-
### Handling static assets
7+
## Handling static assets
88

9-
#### Renderer process (main app)
9+
### Renderer process (main app)
1010

1111
In the renderer process, static assets work similarly to a regular app. Read Vue CLI's documentation [here](https://cli.vuejs.org/guide/html-and-static-assets.html) before continuing. However, there are a few changes made:
1212

13-
- The `__static` global variable is added. It provides a path to your public directory in both development and production. Use this to read/write files in your app's public directory.
14-
- In production, the `process.env.BASE_URL` is replaced with the path to your app's files.
13+
- The `__static` global variable is added. It provides a path to your public directory in both development and production. Use this to read/write files in your app's public directory.
14+
- In production, the `process.env.BASE_URL` is replaced with the path to your app's files.
1515

1616
**Note: `__static` is not available in regular build/serve. It should only be used in electron to read/write files on disk. To import a file (img, script, etc...) and not have it be transpiled by webpack, use the `process.env.BASE_URL` instead.**
1717

18-
#### Main process (background.js)
18+
### Main process (background.js)
1919

2020
The main process won't have access to `process.env.BASE_URL` or `src/assets`. However, you can still use `__static` to get a path to your public directory in development and production.
2121

22-
#### Examples:
22+
### Examples:
2323

2424
```vue
2525
<!-- Renderer process only -->
@@ -43,7 +43,7 @@ console.log(fileContents)
4343
</script>
4444
```
4545

46-
### Folder Structure
46+
## Folder Structure
4747

4848
```
4949
├── dist_electron/
@@ -61,24 +61,24 @@ console.log(fileContents)
6161
├── ...
6262
```
6363

64-
### How it works
64+
## How it works
6565

66-
#### Build command
66+
### Build command
6767

6868
The build command consists of three main phases: render build, main build, and electron-builder build:
6969

7070
1. Render build: This phase calls `vue-cli-service build` with some custom configuration so it works properly with electron. (The render process is your standard app.)
7171
2. Main build: This phase is where vue-cli-plugin-electron-builder bundles your background file for the main process (`src/background.js`).
7272
3. Electron-builder build: This phase uses [electron-builder](https://www.electron.build) to turn your web app code into an desktop app powered by [Electron](https://electronjs.org).
7373

74-
#### Serve command
74+
### Serve command
7575

7676
The serve command also consists of 3 main phases: main build, dev server launch, and electron launch:
7777

7878
1. Dev server launch: This phase starts the built in dev server with a few modifications to work properly with electron.
7979
2. Main build: This phase, like in the build command, bundles your app's main process, but in development mode.
8080
3. Electron launch: This phase launches electron and tells it to load the url of the above dev server.
8181

82-
### Is this plugin production ready?
82+
## Is this plugin production ready?
8383

8484
This plugin is nearly production ready. It has test coverage for everything but the UI interface and proper logging of errors. It needs to be used a little bit more in large applications before it is considered safe to use in a large production environment. Please try it in your app and report any bugs or feature requests.

docs/guide/testingAndDebugging.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22
sidebarDepth: 2
33
---
44

5-
## Testing and Debugging
5+
# Testing and Debugging
66

7-
### Debugging
7+
## Debugging
88

9-
#### Renderer Process (Main App)
9+
### Renderer Process (Main App)
1010

1111
You can debug the renderer process using [Vue Devtools](https://github.com/vuejs/vue-devtools). Vue Devtools are automatically installed for you (powered by [electron-devtools-installer](https://github.com/MarshallOfSound/electron-devtools-installer)).
1212

13-
#### Main Process (Background File)
13+
### Main Process (Background File)
1414

1515
First, read [Electron's instructions](https://electronjs.org/docs/tutorial/debugging-main-process#command-line-switches) for debugging the main process. Before launching Electron through your debugger, run `serve:electron` in debug mode with the `--debug` argument. This will prevent Electron from launching automatically and enable source map support. Make sure to set the background file `dist_electron/background.js`.
1616

1717
::: tip
1818
If you are testing with spectron, make sure to set `process.env.IS_TEST` to `true`. This will prevent dev tools from being loaded which results in errors.
1919
:::
2020

21-
### Testing
21+
## Testing
2222

2323
:::tip
2424
If you don't want to use Spectron, you can still use this function, just set `noSpectron` to `true`
@@ -34,15 +34,15 @@ vue-cli-plugin-electron-builder exports a `testWithSpectron` function. This func
3434
const { testWithSpectron } = require('vue-cli-plugin-electron-builder')
3535

3636
test('a window is created', async () => {
37-
const { stdout, url, stopServe, app } = await testWithSpectron()
38-
// stdout is the log of serve:electron
39-
console.log(`serve:electron returned: ${stdout}`)
40-
// url is the url for the dev server created with serve:electron
41-
console.log(`the dev server url is: ${url}`)
42-
// app is a spectron instance. It is attached to the dev server, launched, and waited for to load.
43-
expect(await app.client.getWindowCount()).toBe(1)
44-
// Before your tests end, make sure to stop the dev server and spectron
45-
await stopServe()
37+
const { stdout, url, stopServe, app } = await testWithSpectron()
38+
// stdout is the log of serve:electron
39+
console.log(`serve:electron returned: ${stdout}`)
40+
// url is the url for the dev server created with serve:electron
41+
console.log(`the dev server url is: ${url}`)
42+
// app is a spectron instance. It is attached to the dev server, launched, and waited for to load.
43+
expect(await app.client.getWindowCount()).toBe(1)
44+
// Before your tests end, make sure to stop the dev server and spectron
45+
await stopServe()
4646
})
4747
```
4848

0 commit comments

Comments
 (0)