create-vite-taro 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -14
- package/index.js +9 -4
- package/package.json +1 -1
- package/templates/default/README.md +16 -10
- package/templates/default/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,23 +6,23 @@ Create a Vite 8 + React 19 + Taro app for WeChat Mini Program and H5 targets.
|
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
8
|
# Create a new app from the default template
|
|
9
|
-
|
|
9
|
+
npm create vite-taro@latest my-app
|
|
10
10
|
|
|
11
11
|
# Enter the project and install dependencies
|
|
12
12
|
cd my-app
|
|
13
|
-
|
|
13
|
+
npm install
|
|
14
14
|
|
|
15
15
|
# WeChat Mini Program: rebuild dist/wx in watch mode
|
|
16
|
-
|
|
16
|
+
npm run dev:wx
|
|
17
17
|
|
|
18
18
|
# H5: start the Vite dev server
|
|
19
|
-
|
|
19
|
+
npm run dev:h5
|
|
20
20
|
|
|
21
21
|
# Then open the standard Vite dev URL in your browser
|
|
22
22
|
# http://localhost:5173
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
You can keep `
|
|
25
|
+
You can keep `npm run dev:wx` and `npm run dev:h5` running at the same time in separate terminals.
|
|
26
26
|
|
|
27
27
|
Note: Because of WeChat DevTools and Mini Program runtime limitations, hot reload/fast rebuilds for the WeChat target may not always apply cleanly. For day-to-day iteration, prefer the H5 Vite dev server for fast feedback, and periodically verify the Mini Program result in WeChat DevTools.
|
|
28
28
|
|
|
@@ -31,25 +31,25 @@ Set `VITE_PLUGIN_TARO_WECHAT_APP_ID` in the generated `.env.local` to your WeCha
|
|
|
31
31
|
## Other package managers
|
|
32
32
|
|
|
33
33
|
```sh
|
|
34
|
-
|
|
34
|
+
pnpm create vite-taro my-app
|
|
35
35
|
yarn create vite-taro my-app
|
|
36
36
|
bun create vite-taro my-app
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
## Scripts
|
|
40
40
|
|
|
41
|
-
|
|
|
41
|
+
| Command | Description |
|
|
42
42
|
| --- | --- |
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
45
|
-
| `
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
48
|
-
| `
|
|
43
|
+
| `npm run dev:wx` | Build the WeChat Mini Program in watch mode. |
|
|
44
|
+
| `npm run dev:h5` | Start the H5 dev server with Vite 8 hot reload. |
|
|
45
|
+
| `npm run build:wx` | Build the WeChat Mini Program output into `dist/wx`. |
|
|
46
|
+
| `npm run build:h5` | Build the H5 output into `dist/h5`. |
|
|
47
|
+
| `npm run preview:h5` | Preview the built H5 output. |
|
|
48
|
+
| `npm run typecheck` | Typecheck with `tsgo`. |
|
|
49
49
|
|
|
50
50
|
## Troubleshooting
|
|
51
51
|
|
|
52
52
|
| Problem | Check |
|
|
53
53
|
| --- | --- |
|
|
54
|
-
| `pnpm install` says dependency build scripts were ignored | Run `pnpm approve-builds
|
|
54
|
+
| `pnpm install` says dependency build scripts were ignored | Run `pnpm approve-builds` and approve the requested dependency build scripts. |
|
|
55
55
|
|
package/index.js
CHANGED
|
@@ -15,8 +15,8 @@ const renamedFiles = {
|
|
|
15
15
|
_gitignore: '.gitignore'
|
|
16
16
|
}
|
|
17
17
|
const helpText = `Usage:
|
|
18
|
-
pnpm create vite-taro [project-name]
|
|
19
18
|
npm create vite-taro@latest [project-name]
|
|
19
|
+
pnpm create vite-taro [project-name]
|
|
20
20
|
yarn create vite-taro [project-name]
|
|
21
21
|
bun create vite-taro [project-name]
|
|
22
22
|
|
|
@@ -50,8 +50,8 @@ console.log(`\nCreated ${projectName} in ${projectPath}\n`)
|
|
|
50
50
|
console.log('Next steps:')
|
|
51
51
|
if (cdCommand) console.log(` ${cdCommand}`)
|
|
52
52
|
console.log(` ${packageManager} install`)
|
|
53
|
-
console.log(` ${packageManager
|
|
54
|
-
console.log(` ${packageManager
|
|
53
|
+
console.log(` ${getScriptCommand(packageManager, 'dev:wx')}`)
|
|
54
|
+
console.log(` ${getScriptCommand(packageManager, 'dev:h5')}`)
|
|
55
55
|
|
|
56
56
|
function parseArgs(args) {
|
|
57
57
|
const options = {
|
|
@@ -178,7 +178,12 @@ function getPackageManager() {
|
|
|
178
178
|
if (userAgent.startsWith('yarn')) return 'yarn'
|
|
179
179
|
if (userAgent.startsWith('bun')) return 'bun'
|
|
180
180
|
if (userAgent.startsWith('npm')) return 'npm'
|
|
181
|
-
return '
|
|
181
|
+
return 'npm'
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function getScriptCommand(packageManager, scriptName) {
|
|
185
|
+
if (packageManager === 'npm' || packageManager === 'bun') return `${packageManager} run ${scriptName}`
|
|
186
|
+
return `${packageManager} ${scriptName}`
|
|
182
187
|
}
|
|
183
188
|
|
|
184
189
|
function getDisplayProjectPath(projectPath) {
|
package/package.json
CHANGED
|
@@ -8,19 +8,19 @@ Docs and source: <https://github.com/sep2/vite-plugin-taro>
|
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
10
|
# Install dependencies after scaffolding
|
|
11
|
-
|
|
11
|
+
npm install
|
|
12
12
|
|
|
13
13
|
# WeChat Mini Program: rebuild dist/wx in watch mode
|
|
14
|
-
|
|
14
|
+
npm run dev:wx
|
|
15
15
|
|
|
16
16
|
# H5: start the Vite dev server
|
|
17
|
-
|
|
17
|
+
npm run dev:h5
|
|
18
18
|
|
|
19
19
|
# Then open the standard Vite dev URL in your browser
|
|
20
20
|
# http://localhost:5173
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
You can keep `
|
|
23
|
+
You can keep `npm run dev:wx` and `npm run dev:h5` running at the same time in separate terminals.
|
|
24
24
|
|
|
25
25
|
Note: Because of WeChat DevTools and Mini Program runtime limitations, hot reload/fast rebuilds for the WeChat target may not always apply cleanly. For day-to-day iteration, prefer the H5 Vite dev server for fast feedback, and periodically verify the Mini Program result in WeChat DevTools.
|
|
26
26
|
|
|
@@ -29,10 +29,16 @@ Set `VITE_PLUGIN_TARO_WECHAT_APP_ID` in `.env.local` to your WeChat App ID, then
|
|
|
29
29
|
## Scripts
|
|
30
30
|
|
|
31
31
|
```sh
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
npm run dev:wx # Build the WeChat Mini Program in watch mode
|
|
33
|
+
npm run dev:h5 # Start the H5 dev server
|
|
34
|
+
npm run build:wx # Build dist/wx
|
|
35
|
+
npm run build:h5 # Build dist/h5
|
|
36
|
+
npm run preview:h5 # Preview dist/h5
|
|
37
|
+
npm run typecheck # Typecheck with tsgo
|
|
38
38
|
```
|
|
39
|
+
|
|
40
|
+
## Troubleshooting
|
|
41
|
+
|
|
42
|
+
| Problem | Check |
|
|
43
|
+
| --- | --- |
|
|
44
|
+
| `pnpm install` says dependency build scripts were ignored | Run `pnpm approve-builds` and approve the requested dependency build scripts. |
|