You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extracts project creation functionality from `preact-cli` into `create-preact-cli`
7
+
8
+
Setting up new `preact-cli` projects with `npx` is slow, as all dependencies of `preact-cli` would need to be installed, even though only a handful are used for project initialization. On the other hand, suggesting global installs is less than attractive due to NPM's poor default install location (requires `sudo`) and this can get out of sync over time.
9
+
10
+
By extracting project initialization into its own package, we can provide much, much faster project setup times.
11
+
12
+
To setup a new project, users will use `npm init preact-cli ...` or `yarn create preact-cli ...`.
13
+
14
+
Additionally, the `--yarn` flag has been removed in favour of using the yarn initializer (`yarn create`).
The above command pulls the template from [preactjs-templates/default], prompts for some information, and generates the project at `./my-project/`.
@@ -65,7 +67,7 @@ The above command pulls the template from [preactjs-templates/default], prompts
65
67
66
68
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.
67
69
68
-
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 <template-name> <project-name>` to use that template.
70
+
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 `npm init preact-cli <template-name> <project-name>` to use that template.
69
71
70
72
Current available templates include:
71
73
@@ -81,35 +83,40 @@ Current available templates include:
81
83
82
84
-[widget-typescript] - Widget template implemented in TypeScript
83
85
84
-
> 💁 Tip: Any Github repo with a `'template'` folder can be used as a custom template: <br /> `npx preact-cli create <username>/<repository> <project-name>`
86
+
> 💁 Tip: Any Github repo with a `'template'` folder can be used as a custom template: <br /> `npm init preact-cli <username>/<repository> <project-name>`
Note: If you don't specify enough data to the `npx preact-cli create` command, it will prompt the required questions.
104
-
105
112
#### preact build
106
113
107
114
Create a production build
108
115
109
116
You can disable `default: true` flags by prefixing them with `--no-<option>`; for example, `--no-sw`, `--no-prerender`, and `--no-inline-css`.
110
117
111
118
```
112
-
$ preact build
119
+
$ [npm run / yarn] preact build
113
120
114
121
--src Specify source directory (default src)
115
122
--dest Specify output directory (default build)
@@ -134,7 +141,7 @@ $ preact build
134
141
Spin up a development server with multiple features like `hot-module-replacement`, `module-watcher`
135
142
136
143
```
137
-
$ preact watch
144
+
$ [npm run / yarn] preact watch
138
145
139
146
--src Specify source directory (default src)
140
147
--cwd A directory to use instead of $PWD (default .)
@@ -161,18 +168,14 @@ Note:
161
168
1. You can run dev server using `HTTPS` then you can use the following `HTTPS=true preact watch`
162
169
2. You can run the dev server on a different port using `PORT=8091 preact watch`
163
170
164
-
#### preact list
171
+
#### preact info
165
172
166
-
Lists all the official preactjs-cli repositories
173
+
Prints debugging information concerning the local environment.
167
174
168
175
```sh
169
-
$ preact list
176
+
$ [npm run / yarn] preact info
170
177
```
171
178
172
-
#### preact info
173
-
174
-
Prints debugging information concerning the local environment.
175
-
176
179
### Pre-rendering
177
180
178
181
Preact CLI in order to follow [PRPL] pattern renders initial route (`/`) into generated static `index.html` - this ensures that users get to see your page before any JavaScript is run, and thus providing users with slow devices or poor connection your website's content much faster.
0 commit comments