From 9194edbf747507f9192992b0965f9a54641578da Mon Sep 17 00:00:00 2001 From: Ryan Christian Date: Sat, 5 Feb 2022 13:54:39 -0600 Subject: [PATCH 1/2] chore: Revising docs, updates help info for --template flag --- README.md | 16 ++++++++-------- packages/cli/lib/commands/build.js | 2 +- packages/cli/lib/commands/watch.js | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 11ecaf3b6..481d1d9ae 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ The above command pulls the template from [preactjs-templates/default], prompts The purpose of official preact project templates are to provide opinionated development tooling setups so that users can get started with actual app code as fast as possible. However, these templates are un-opinionated in terms of how you structure your app code and what libraries you use in addition to preact.js. -All official project templates are repos in the [preactjs-templates organization]. When a new template is added to the organization, you will be able to run `preact create ` to use that template. +All official project templates are repos in the [preactjs-templates organization]. When a new template is added to the organization, you will be able to run `npx preact-cli create ` to use that template. Current available templates include: @@ -81,7 +81,7 @@ Current available templates include: - [widget-typescript] - Widget template implemented in TypeScript -> 💁 Tip: Any Github repo with a `'template'` folder can be used as a custom template:
`preact create / ` +> 💁 Tip: Any Github repo with a `'template'` folder can be used as a custom template:
`npx preact-cli create / ` ### CLI Options @@ -90,7 +90,7 @@ Current available templates include: Create a project to quick start development. ``` -$ preact create +$ npx preact-cli create --name The application name. --cwd A directory to use instead of $PWD. @@ -100,7 +100,7 @@ $ preact create --install Installs dependencies. [boolean] [default: true] ``` -Note: If you don't specify enough data to the `preact create` command, it will prompt the required questions. +Note: If you don't specify enough data to the `npx preact-cli create` command, it will prompt the required questions. #### preact build @@ -118,7 +118,7 @@ $ preact build --sw Generate and attach a Service Worker (default true) --babelConfig Path to custom Babel config (default .babelrc) --json Generate build stats for bundle analysis - --template Path to custom HTML template + --template Path to custom HTML template (default 'src/template.html') --preload Adds preload tags to the document its assets (default false) --analyze Launch interactive Analyzer to inspect production bundle(s) --prerender Renders route(s) into generated static HTML (default true) @@ -150,7 +150,7 @@ $ preact watch --cacert Path to optional CA certificate override --prerender Pre-render static content on first run --prerenderUrls Path to pre-rendered routes config (default prerender-urls.json) - --template Path to custom HTML template + --template Path to custom HTML template (default 'src/template.html') --refresh Enables experimental preact-refresh functionality -c, --config Path to custom CLI config (default preact.config.js) -H, --host Set server hostname (default 0.0.0.0) @@ -192,7 +192,7 @@ To make customizing your configuration easier, preact-cli supports plugins. Visi #### Browserslist -You may customize your list of supported browser versions by declaring a [`"browserslist"`] key within your `package.json`. Changing these values will modify your JavaScript (via [`babel-preset-env`]) and your CSS (via [`autoprefixer`](https://github.com/postcss/autoprefixer)) output. +You may customize your list of supported browser versions by declaring a [`"browserslist"`] key within your `package.json`. Changing these values will modify your JavaScript (via [`@babel/preset-env`]) and your CSS (via [`autoprefixer`](https://github.com/postcss/autoprefixer)) output. By default, `preact-cli` emulates the following config: @@ -385,7 +385,7 @@ Automatic code splitting is applied to all JavaScript and TypeScript files in th [webpack config helpers wiki]: https://github.com/preactjs/preact-cli/wiki/Webpack-Config-Helpers [recipes wiki]: https://github.com/preactjs/preact-cli/wiki/Config-Recipes [prpl]: https://developers.google.com/web/fundamentals/performance/prpl-pattern -[`babel-preset-env`]: https://github.com/babel/babel-preset-env#targetsbrowsers +[`@babel/preset-env`]: https://babeljs.io/docs/en/babel-preset-env.html [proof]: https://googlechrome.github.io/lighthouse/viewer/?gist=142af6838482417af741d966e7804346 [preact cli preset]: https://github.com/preactjs/preact-cli/blob/master/packages/cli/lib/lib/babel-config.js [service workers]: https://developers.google.com/web/fundamentals/getting-started/primers/service-workers diff --git a/packages/cli/lib/commands/build.js b/packages/cli/lib/commands/build.js index 2745ccda9..0f7059b43 100644 --- a/packages/cli/lib/commands/build.js +++ b/packages/cli/lib/commands/build.js @@ -42,7 +42,7 @@ const options = [ }, { name: '--template', - description: 'Path to custom HTML template', + description: 'Path to custom HTML template (default "src/template.html")', }, { name: '--preload', diff --git a/packages/cli/lib/commands/watch.js b/packages/cli/lib/commands/watch.js index a64bb8232..50e67119d 100644 --- a/packages/cli/lib/commands/watch.js +++ b/packages/cli/lib/commands/watch.js @@ -70,7 +70,7 @@ const options = [ }, { name: '--template', - description: 'Path to custom HTML template', + description: 'Path to custom HTML template (default "src/template.html")', }, { name: '--refresh', From 29584eaa0ae09d32350da069a6cd9ec04b0dcc94 Mon Sep 17 00:00:00 2001 From: Ryan Christian Date: Sat, 5 Feb 2022 13:55:39 -0600 Subject: [PATCH 2/2] docs: Adding changeset --- .changeset/shiny-poems-return.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/shiny-poems-return.md diff --git a/.changeset/shiny-poems-return.md b/.changeset/shiny-poems-return.md new file mode 100644 index 000000000..c0ecc31ff --- /dev/null +++ b/.changeset/shiny-poems-return.md @@ -0,0 +1,5 @@ +--- +'preact-cli': patch +--- + +Clarifies when the `--template` flag is necessary in the CLI help information.