create-vite-taro 0.2.0 → 0.2.2

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 CHANGED
@@ -45,7 +45,7 @@ bun create vite-taro my-app
45
45
  | `npm run build:wx` | Build the WeChat Mini Program output into `dist/wx`. |
46
46
  | `npm run build:h5` | Build the H5 output into `dist/h5`. |
47
47
  | `npm run preview:h5` | Preview the built H5 output. |
48
- | `npm run typecheck` | Typecheck with `tsgo`. |
48
+ | `npm run typecheck` | Typecheck with `tsc`. |
49
49
 
50
50
  ## Troubleshooting
51
51
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-vite-taro",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Create Vite 8 + React 19 + Taro apps for H5 and WeChat Mini Program targets.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -34,7 +34,7 @@ npm run dev:h5 # Start the H5 dev server
34
34
  npm run build:wx # Build dist/wx
35
35
  npm run build:h5 # Build dist/h5
36
36
  npm run preview:h5 # Preview dist/h5
37
- npm run typecheck # Typecheck with tsgo
37
+ npm run typecheck # Typecheck with tsc
38
38
  ```
39
39
 
40
40
  ## Troubleshooting
@@ -9,7 +9,7 @@
9
9
  "build:wx": "cross-env NODE_ENV=production VITE_PLUGIN_TARO_TARGET=wx vite build",
10
10
  "build:h5": "cross-env NODE_ENV=production VITE_PLUGIN_TARO_TARGET=h5 vite build",
11
11
  "preview:h5": "cross-env NODE_ENV=production VITE_PLUGIN_TARO_TARGET=h5 vite preview --outDir dist/h5",
12
- "typecheck": "tsgo -b"
12
+ "typecheck": "tsc -b"
13
13
  },
14
14
  "dependencies": {
15
15
  "react": "^19.2.7",
@@ -19,9 +19,10 @@
19
19
  "@types/node": "^26.0.0",
20
20
  "@types/react": "^19.2.17",
21
21
  "@types/react-dom": "^19.2.3",
22
- "@typescript/native-preview": "latest",
22
+ "typescript": "^7.0.1-rc",
23
23
  "cross-env": "^10.1.0",
24
+ "tailwindcss": "^4.3.1",
24
25
  "vite": "^8.0.16",
25
- "vite-plugin-taro": "^0.2.0"
26
+ "vite-plugin-taro": "^0.2.2"
26
27
  }
27
28
  }
@@ -1,6 +1,8 @@
1
1
  import Taro from 'virtual:taro/api'
2
2
  import { useState } from 'react'
3
3
 
4
+ const isWechatTarget = import.meta.env.VITE_PLUGIN_TARO_TARGET === 'wx'
5
+
4
6
  interface NavigationBarNavInfo {
5
7
  height: number
6
8
  top: number
@@ -44,7 +46,7 @@ function createFallbackMenuInfo(screenWidth: number): NavigationBarMenuInfo {
44
46
  }
45
47
 
46
48
  function getMenuInfo(screenWidth: number): NavigationBarMenuInfo {
47
- if (IS_WEAPP) {
49
+ if (isWechatTarget) {
48
50
  const menuButtonInfo = Taro.getMenuButtonBoundingClientRect()
49
51
  if (menuButtonInfo.width > 0 && menuButtonInfo.height > 0) return menuButtonInfo
50
52
  }
@@ -55,7 +57,7 @@ function getMenuInfo(screenWidth: number): NavigationBarMenuInfo {
55
57
  export function initNavigationBar(): NavigationBarInfo {
56
58
  const windowInfo = Taro.getWindowInfo()
57
59
  const screenWidth = windowInfo.screenWidth || 375
58
- const statusBarHeight = IS_WEAPP ? (windowInfo.statusBarHeight ?? 44) : 0
60
+ const statusBarHeight = isWechatTarget ? (windowInfo.statusBarHeight ?? 44) : 0
59
61
  const menuInfo = getMenuInfo(screenWidth)
60
62
  const menuButtonStatusBarGap = Math.max(0, menuInfo.top - statusBarHeight)
61
63
  const navBarHeight = menuButtonStatusBarGap * 2 + menuInfo.height + statusBarHeight
@@ -0,0 +1,3 @@
1
+ interface ImportMetaEnv {
2
+ readonly VITE_PLUGIN_TARO_TARGET: 'wx' | 'h5'
3
+ }
@@ -1,11 +1,11 @@
1
1
  import Taro from 'virtual:taro/api'
2
2
  import { Button, Text, View } from 'virtual:taro/components'
3
- import { NavigationBar } from "../../components/navigation-bar/navigation-bar.tsx"
3
+ import { NavigationBar } from '../../components/navigation-bar/navigation-bar.tsx'
4
4
 
5
5
  function IndexPage() {
6
6
  return (
7
7
  <View className="flex flex-col h-screen overflow-hidden">
8
- <NavigationBar title={'Vite Taro App'}/>
8
+ <NavigationBar title="Vite Taro App" />
9
9
  <View className="flex-1 flex items-center justify-center bg-slate-50 px-6 py-12">
10
10
  <View className="rounded-3xl bg-white p-6 shadow-sm">
11
11
  <Text className="block text-2xl font-semibold text-slate-950">Vite + Taro</Text>
@@ -15,7 +15,7 @@ function IndexPage() {
15
15
  <Button
16
16
  className="mt-6 rounded-xl bg-blue-600 px-4 py-2 text-white"
17
17
  onClick={() => {
18
- Taro.showToast({title: 'Hello Taro'})
18
+ Taro.showToast({ title: 'Hello Taro' })
19
19
  }}
20
20
  >
21
21
  Show toast