Skip to content
This repository has been archived by the owner on Dec 6, 2021. It is now read-only.

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Sep 20, 2018
1 parent 8b7e387 commit d4b0e1b
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/poi/lib/plugins/utils/shared-cli-options.js
Expand Up @@ -6,7 +6,7 @@ module.exports = command => {
.option('inspect-webpack', {
desc: 'Print webpack config and quit (default: false)'
})
.option('progress', {
.option('no-progress', {
desc: 'Show build progress (default: true)'
})
.option('jsx', {
Expand Down
9 changes: 8 additions & 1 deletion website/docs/README.md
Expand Up @@ -37,4 +37,11 @@ yarn global create-poi-app@next
create-poi-app my-app
```

Then follow the instructions and you're all set.
Then follow the instructions and you're all set.

In the `package.json` that is generated by above command, there're two main npm scripts:

- `"build": "poi build"` Create an optimized production build of your app
- `"dev": "poi dev"` Start a development server for your app

For more CLI usages, please check out [CLI reference](./cli.md).
4 changes: 4 additions & 0 deletions website/docs/cli.md
Expand Up @@ -4,6 +4,10 @@ sidebar: auto

# CLI Reference

Run `poi` to get auto-generated help.

Run `poi <command> --help` to get auto-generated help for specified command.

## Base Directory

Set the base directory to load files via CLI flag `--baseDir`:
Expand Down
13 changes: 11 additions & 2 deletions website/docs/config.md
Expand Up @@ -37,14 +37,22 @@ Specify public URL of the output directory when referenced in a browser. A relat

The value of the option is prefixed to every URL created by the runtime or loaders. Because of this the value of this option ends with `/` in most cases.

## html

- Type: `Object`

Customize the HTML template for your app [entry](#entry).

It accepts all options in [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin#options).

## pages

- Type: `Object`
- Default: `undefined`

Build app in multi-page mode. The value should be an object where the key is the name of the page, the value is an object used to customize the page.

When this option is used the [`entry`](#entry) option will be ignore.
When this option is used the [`entry`](#entry) option and [`html`](#html) option will be ignore.

For instance you can generate `index.html` and `sub-page.html` like this:

Expand All @@ -68,6 +76,7 @@ Properties:
- `filename`: The filename of generated HTML file, it default to `$page_name + '.html'`.
- `template`: The template HTML file that is used to render the generated HTML file. If not given, a default template file will be used.
- `chunks`: Include specific chunks in this page. Pages by default will always generate a `$page_name` chunk, optionally with `chunk-vendors` chunk and `chunk-common` chunk in production build, these chunks are included by default. You can use this option to customize it.
- ...basically all options in [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin#options).

## constants

Expand Down Expand Up @@ -104,7 +113,7 @@ By default Babel would only transpile modules outside `node_modules` directory,
Specify the options of the default Babel preset we use:

- `jsx`: `default: 'react'` You can also set it to `'vue'` or any JSX pragma like `'h'` for Preact. This can be overridden via CLI flag `--jsx`.
- `jsxPragma`: `default: 'React.createFragment'`
- `jsxPragmaFrag`: `default: 'React.createFragment'`
- `loose`: `default: false` Enable loose transformation.

Note that the default Babel preset will not be used if you're using a custom Babel config file, however you can still add the preset to your Babel config file if you want:
Expand Down
12 changes: 12 additions & 0 deletions website/docs/plugin-dev.md
Expand Up @@ -38,6 +38,18 @@ The plugin name, it's mainly used to retrieve plugin options from config file. F

See the [Generators](#generators-2) section.

### commandModes

- __Type__: `{ [command: string]: string }`

Set the mode for the commands added via the plugin. For example we set the mode to `production` in the plugin that adds the `build` command:

```js
exports.commandModes = {
build: 'production'
}
```

## Plugin API

### api.mode
Expand Down

0 comments on commit d4b0e1b

Please sign in to comment.