create-uni-app-tailwindcss 0.1.0

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.
Files changed (36) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +23 -0
  3. package/dist/cli.js +150 -0
  4. package/dist/templates/default/.eslintrc-auto-import.json +115 -0
  5. package/dist/templates/default/README.md +140 -0
  6. package/dist/templates/default/_npmrc +8 -0
  7. package/dist/templates/default/eslint.config.mjs +27 -0
  8. package/dist/templates/default/index.html +24 -0
  9. package/dist/templates/default/package.json +105 -0
  10. package/dist/templates/default/scripts/app-css-smoke.mjs +69 -0
  11. package/dist/templates/default/scripts/hmr-smoke.mjs +252 -0
  12. package/dist/templates/default/src/App.vue +11 -0
  13. package/dist/templates/default/src/auto-imports.d.ts +109 -0
  14. package/dist/templates/default/src/components/WeappTailwindcss.vue +51 -0
  15. package/dist/templates/default/src/components/sections/CapabilityShowcase.vue +59 -0
  16. package/dist/templates/default/src/components/sections/ExperienceLab.vue +321 -0
  17. package/dist/templates/default/src/components/sections/GradientFeature.vue +128 -0
  18. package/dist/templates/default/src/components/sections/HeroShowcase.vue +14 -0
  19. package/dist/templates/default/src/components/sections/IconGallery.vue +58 -0
  20. package/dist/templates/default/src/components/sections/MacroShowcase.vue +156 -0
  21. package/dist/templates/default/src/env.d.ts +8 -0
  22. package/dist/templates/default/src/main.ts +13 -0
  23. package/dist/templates/default/src/manifest.json +56 -0
  24. package/dist/templates/default/src/pages/index/index.vue +49 -0
  25. package/dist/templates/default/src/pages.json +16 -0
  26. package/dist/templates/default/src/static/.gitkeep +0 -0
  27. package/dist/templates/default/src/static/images/weapp-tailwindcss.png +0 -0
  28. package/dist/templates/default/src/stores/counter.ts +11 -0
  29. package/dist/templates/default/src/tailwind.css +62 -0
  30. package/dist/templates/default/src/theme.json +10 -0
  31. package/dist/templates/default/src/uni.scss +0 -0
  32. package/dist/templates/default/stylelint.config.mjs +3 -0
  33. package/dist/templates/default/tsconfig.json +33 -0
  34. package/dist/templates/default/vite.config.ts +37 -0
  35. package/dist/templates/registry.json +25 -0
  36. package/package.json +53 -0
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "uni-app-vue3-vite",
3
+ "appid": "",
4
+ "description": "",
5
+ "versionName": "1.0.0",
6
+ "versionCode": "100",
7
+ "transformPx": false,
8
+ /* 5+App特有相关 */
9
+ "app-plus": {
10
+ "usingComponents": true,
11
+ "nvueStyleCompiler": "uni-app",
12
+ "compilerVersion": 3,
13
+ "splashscreen": {
14
+ "alwaysShowBeforeRender": true,
15
+ "waiting": true,
16
+ "autoclose": true,
17
+ "delay": 0
18
+ },
19
+ /* 模块配置 */
20
+ "modules": {},
21
+ /* 应用发布信息 */
22
+ "distribute": {
23
+ /* android打包配置 */
24
+ "android": {},
25
+ /* ios打包配置 */
26
+ "ios": {},
27
+ /* SDK配置 */
28
+ "sdkConfigs": {}
29
+ }
30
+ },
31
+ /* 快应用特有相关 */
32
+ "quickapp": {},
33
+ /* 小程序特有相关 */
34
+ "mp-weixin": {
35
+ "appid": "wxb3d842a4a7e3440d",
36
+ "setting": {
37
+ "urlCheck": false
38
+ },
39
+ "usingComponents": true,
40
+ "lazyCodeLoading": "requiredComponents",
41
+ "darkmode": true
42
+ },
43
+ "mp-alipay": {
44
+ "usingComponents": true
45
+ },
46
+ "mp-baidu": {
47
+ "usingComponents": true
48
+ },
49
+ "mp-toutiao": {
50
+ "usingComponents": true
51
+ },
52
+ "uniStatistics": {
53
+ "enable": false
54
+ },
55
+ "vueVersion": "3"
56
+ }
@@ -0,0 +1,49 @@
1
+ <script setup lang="ts">
2
+ import CapabilityShowcase from '@/components/sections/CapabilityShowcase.vue'
3
+ import ExperienceLab from '@/components/sections/ExperienceLab.vue'
4
+ import GradientFeature from '@/components/sections/GradientFeature.vue'
5
+ import HeroShowcase from '@/components/sections/HeroShowcase.vue'
6
+ import IconGallery from '@/components/sections/IconGallery.vue'
7
+ import MacroShowcase from '@/components/sections/MacroShowcase.vue'
8
+
9
+ onLoad(() => {
10
+ console.log('欢迎使用 wx / not-wx 变量示例模板')
11
+ })
12
+ </script>
13
+
14
+ <template>
15
+ <view
16
+ class="
17
+ flex min-h-screen w-full justify-center
18
+ safe-area-bottom bg-[radial-gradient(circle_at_18%_20%,#e0f2fe,#fdf4ff_70%)]
19
+ px-0 pt-6 text-slate-800
20
+ "
21
+ >
22
+ <view
23
+ class="
24
+ flex w-full flex-col space-y-5 px-4
25
+ sm:px-5
26
+ md:w-[94vw] md:max-w-[960px]
27
+ "
28
+ >
29
+ <view>
30
+ <HeroShowcase />
31
+ </view>
32
+ <view>
33
+ <CapabilityShowcase />
34
+ </view>
35
+ <view>
36
+ <ExperienceLab />
37
+ </view>
38
+ <view>
39
+ <IconGallery />
40
+ </view>
41
+ <view>
42
+ <GradientFeature />
43
+ </view>
44
+ <view>
45
+ <MacroShowcase />
46
+ </view>
47
+ </view>
48
+ </view>
49
+ </template>
@@ -0,0 +1,16 @@
1
+ {
2
+ "pages": [ // pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
3
+ {
4
+ "path": "pages/index/index",
5
+ "style": {
6
+ "navigationBarTitleText": "weapp-tailwindcss"
7
+ }
8
+ }
9
+ ],
10
+ "globalStyle": {
11
+ "navigationBarTextStyle": "black",
12
+ "navigationBarTitleText": "weapp-tailwindcss",
13
+ "navigationBarBackgroundColor": "#F8F8F8",
14
+ "backgroundColor": "#F8F8F8"
15
+ }
16
+ }
File without changes
@@ -0,0 +1,11 @@
1
+ import { defineStore } from 'pinia'
2
+ import { ref } from 'vue'
3
+
4
+ export const useCounterStore = defineStore('counter', () => {
5
+ const count = ref(0)
6
+ function increment() {
7
+ count.value++
8
+ }
9
+
10
+ return { count, increment }
11
+ })
@@ -0,0 +1,62 @@
1
+ @import 'tailwindcss' source(none);
2
+
3
+ @plugin '@iconify/tailwind4' {
4
+ prefix: 'i';
5
+ }
6
+
7
+ @custom-variant wx {
8
+ /* #ifdef MP-WEIXIN */
9
+
10
+ @slot;
11
+
12
+ /* #endif */
13
+ }
14
+
15
+ @custom-variant not-wx {
16
+ /* #ifndef MP-WEIXIN */
17
+
18
+ @slot;
19
+
20
+ /* #endif */
21
+ }
22
+
23
+ @source "../index.html";
24
+ @source "./**/*.{html,js,ts,jsx,tsx,vue}";
25
+ @source inline("i-[mdi--github-circle] i-[mdi--star] before:content-['现在,让我们开始神奇的_tailwindcss_开发之旅吧!'] before:content-['现在,让我们继续神奇的_tailwindcss_HMR_回归之旅吧!']");
26
+
27
+ @layer base {
28
+ /* #ifdef APP-PLUS */
29
+
30
+ uni-view {
31
+ display: block;
32
+ }
33
+
34
+ /* #endif */
35
+
36
+ /* #ifdef H5 */
37
+
38
+ svg {
39
+ display: initial;
40
+ }
41
+
42
+ /* #endif */
43
+ }
44
+
45
+ @layer components {
46
+ .safe-area-bottom {
47
+ padding-bottom: calc(1.5rem + constant(safe-area-inset-bottom));
48
+ padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
49
+ }
50
+
51
+ .raw-btn {
52
+ @apply after:border-none m-0 inline-flex items-center justify-center gap-2 rounded text-sm font-semibold transition-all;
53
+
54
+ line-height: 1.5;
55
+ }
56
+
57
+ .btn {
58
+ @apply after:border-none m-0 inline-flex items-center justify-center gap-2 rounded bg-linear-to-r from-[#9e58e9] to-blue-500 px-2 py-1 text-sm font-semibold text-white transition-all;
59
+
60
+ line-height: 1.5;
61
+ }
62
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "light": {
3
+ "navBgColor": "#f6f6f6",
4
+ "navTxtStyle": "black"
5
+ },
6
+ "dark": {
7
+ "navBgColor": "#191919",
8
+ "navTxtStyle": "white"
9
+ }
10
+ }
File without changes
@@ -0,0 +1,3 @@
1
+ import { icebreaker } from '@icebreakers/stylelint-config'
2
+
3
+ export default icebreaker()
@@ -0,0 +1,33 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "esnext",
4
+ "jsx": "preserve",
5
+ "lib": [
6
+ "esnext",
7
+ "dom"
8
+ ],
9
+ "useDefineForClassFields": true,
10
+ "module": "esnext",
11
+ "moduleResolution": "bundler",
12
+ "paths": {
13
+ "@/*": [
14
+ "./src/*"
15
+ ]
16
+ },
17
+ "resolveJsonModule": true,
18
+ "types": [
19
+ "@dcloudio/types"
20
+ ],
21
+ "allowJs": true,
22
+ "strict": true,
23
+ "sourceMap": true,
24
+ "esModuleInterop": true,
25
+ "skipLibCheck": true
26
+ },
27
+ "include": [
28
+ "src/**/*.ts",
29
+ "src/**/*.d.ts",
30
+ "src/**/*.tsx",
31
+ "src/**/*.vue"
32
+ ]
33
+ }
@@ -0,0 +1,37 @@
1
+ import uni from '@dcloudio/vite-plugin-uni'
2
+ import { defineConfig } from 'vite'
3
+ import { WeappTailwindcss } from 'weapp-tailwindcss/vite'
4
+
5
+ // https://vitejs.dev/config/
6
+ export default defineConfig(async () => {
7
+ // 新版本的 unplugin-auto-import 改成了只有 esm 格式的产物,而 uni-app 目前必须 cjs 格式
8
+ // 所以需要改成动态 import 的写法来进行引入
9
+ // 详见 https://github.com/sonofmagic/uni-app-tailwindcss-template/issues/29
10
+ const { default: AutoImport } = await import('unplugin-auto-import/vite')
11
+ return {
12
+ // uvtw 一定要放在 uni 后面
13
+ plugins: [
14
+ uni(),
15
+ WeappTailwindcss({
16
+ cssEntries: ['./src/tailwind.css'],
17
+ rem2rpx: true,
18
+ }),
19
+ AutoImport({
20
+ imports: ['vue', 'uni-app', 'pinia'],
21
+ dts: './src/auto-imports.d.ts',
22
+ eslintrc: {
23
+ enabled: true,
24
+ },
25
+ }),
26
+ ],
27
+ // 内联 postcss 注册 tailwindcss
28
+ css: {
29
+ // https://vitejs.dev/config/shared-options.html#css-preprocessoroptions
30
+ preprocessorOptions: {
31
+ scss: {
32
+ silenceDeprecations: ['legacy-js-api'],
33
+ },
34
+ },
35
+ },
36
+ }
37
+ })
@@ -0,0 +1,25 @@
1
+ {
2
+ "defaultTemplate": "default",
3
+ "templates": [
4
+ {
5
+ "id": "default",
6
+ "name": "Default",
7
+ "description": "uni-app + Vite + Vue 3 + Tailwind CSS",
8
+ "targets": [
9
+ "h5",
10
+ "app",
11
+ "mp-weixin",
12
+ "mp-alipay",
13
+ "mp-toutiao"
14
+ ],
15
+ "hmrTargets": [
16
+ "mp-weixin"
17
+ ],
18
+ "smokeText": [
19
+ "能力速览",
20
+ "一份模板,串联更多设计场景"
21
+ ]
22
+ }
23
+ ],
24
+ "version": 1
25
+ }
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "create-uni-app-tailwindcss",
3
+ "version": "0.1.0",
4
+ "description": "Create a uni-app project with Vite, Vue 3, Tailwind CSS, and weapp-tailwindcss.",
5
+ "private": false,
6
+ "type": "module",
7
+ "author": "ice breaker <hi@sonofmagic.top>",
8
+ "license": "MIT",
9
+ "homepage": "https://github.com/sonofmagic/uni-app-tailwindcss-template#readme",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/sonofmagic/uni-app-tailwindcss-template.git",
13
+ "directory": "packages/create-uni-app-tailwindcss"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/sonofmagic/uni-app-tailwindcss-template/issues"
17
+ },
18
+ "keywords": [
19
+ "uni-app",
20
+ "vite",
21
+ "vue3",
22
+ "tailwindcss",
23
+ "weapp-tailwindcss",
24
+ "create-app"
25
+ ],
26
+ "engines": {
27
+ "node": ">=22"
28
+ },
29
+ "bin": {
30
+ "create-uni-app-tailwindcss": "./dist/cli.js"
31
+ },
32
+ "files": [
33
+ "dist"
34
+ ],
35
+ "publishConfig": {
36
+ "access": "public",
37
+ "registry": "https://registry.npmjs.org",
38
+ "provenance": true
39
+ },
40
+ "dependencies": {
41
+ "prompts": "^2.4.2"
42
+ },
43
+ "devDependencies": {
44
+ "@playwright/test": "^1.55.0",
45
+ "tsup": "^8.5.0",
46
+ "typescript": "^6.0.3"
47
+ },
48
+ "scripts": {
49
+ "build": "node scripts/build-package.mjs",
50
+ "start": "pnpm run build && node dist/cli.js",
51
+ "test:e2e": "playwright test"
52
+ }
53
+ }