@weapp-core/init 1.1.14 → 1.1.15-alpha.1

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 (55) hide show
  1. package/dist/index.cjs +16 -9
  2. package/dist/index.d.cts +7 -5
  3. package/dist/index.d.ts +7 -5
  4. package/dist/index.js +15 -8
  5. package/package.json +1 -1
  6. package/templates/default/README.md +2 -2
  7. package/templates/default/package.json +4 -11
  8. package/templates/default/src/app.scss +0 -3
  9. package/templates/default/src/pages/index/index.json +1 -1
  10. package/templates/default/src/pages/index/index.wxml +0 -7
  11. package/templates/default/vite.config.ts +1 -11
  12. package/templates/tailwindcss/.editorconfig +9 -0
  13. package/templates/tailwindcss/.vscode/settings.json +5 -0
  14. package/templates/tailwindcss/README.md +28 -0
  15. package/templates/tailwindcss/package.json +38 -0
  16. package/templates/tailwindcss/project.config.json +42 -0
  17. package/templates/tailwindcss/project.private.config.json +7 -0
  18. package/templates/tailwindcss/src/app.json +12 -0
  19. package/templates/tailwindcss/src/app.scss +3 -0
  20. package/templates/tailwindcss/src/app.ts +6 -0
  21. package/templates/tailwindcss/src/pages/index/index.json +7 -0
  22. package/templates/tailwindcss/src/pages/index/index.ts +30 -0
  23. package/templates/tailwindcss/src/pages/index/index.wxml +18 -0
  24. package/templates/tailwindcss/src/pages/logs/logs.json +6 -0
  25. package/templates/tailwindcss/src/pages/logs/logs.wxml +0 -0
  26. package/templates/tailwindcss/src/sitemap.json +10 -0
  27. package/templates/tailwindcss/src/theme.json +5 -0
  28. package/templates/tailwindcss/src/utils/util.ts +3 -0
  29. package/templates/tailwindcss/src/vite-env.d.ts +1 -0
  30. package/templates/tailwindcss/tsconfig.json +46 -0
  31. package/templates/tailwindcss/tsconfig.node.json +13 -0
  32. package/templates/tailwindcss/vite.config.ts +37 -0
  33. package/templates/tdesign/src/components/Navbar/Navbar.scss +0 -0
  34. package/templates/tdesign/src/components/Navbar/Navbar.ts +3 -0
  35. package/templates/tdesign/src/components/Navbar/Navbar.wxml +0 -0
  36. package/templates/tdesign/src/pages/index/index.json +1 -1
  37. package/templates/vant/src/components/Navbar/Navbar.json +7 -0
  38. package/templates/vant/src/components/Navbar/Navbar.scss +0 -0
  39. package/templates/vant/src/components/Navbar/Navbar.ts +3 -0
  40. package/templates/vant/src/components/Navbar/Navbar.wxml +0 -0
  41. package/templates/vant/src/pages/index/index.json +1 -1
  42. /package/templates/default/src/components/{navigation-bar/navigation-bar.json → Navbar/Navbar.json} +0 -0
  43. /package/templates/default/src/components/{navigation-bar/navigation-bar.scss → Navbar/Navbar.scss} +0 -0
  44. /package/templates/default/src/components/{navigation-bar/navigation-bar.ts → Navbar/Navbar.ts} +0 -0
  45. /package/templates/default/src/components/{navigation-bar/navigation-bar.wxml → Navbar/Navbar.wxml} +0 -0
  46. /package/templates/{default → tailwindcss}/postcss.config.js +0 -0
  47. /package/templates/{tdesign/src/components/navigation-bar/navigation-bar.json → tailwindcss/src/components/Navbar/Navbar.json} +0 -0
  48. /package/templates/{tdesign/src/components/navigation-bar/navigation-bar.scss → tailwindcss/src/components/Navbar/Navbar.scss} +0 -0
  49. /package/templates/{tdesign/src/components/navigation-bar/navigation-bar.ts → tailwindcss/src/components/Navbar/Navbar.ts} +0 -0
  50. /package/templates/{tdesign/src/components/navigation-bar/navigation-bar.wxml → tailwindcss/src/components/Navbar/Navbar.wxml} +0 -0
  51. /package/templates/{vant/src/components/navigation-bar/navigation-bar.scss → tailwindcss/src/pages/index/index.scss} +0 -0
  52. /package/templates/{vant/src/components/navigation-bar/navigation-bar.wxml → tailwindcss/src/pages/logs/logs.scss} +0 -0
  53. /package/templates/{vant/src/components/navigation-bar/navigation-bar.ts → tailwindcss/src/pages/logs/logs.ts} +0 -0
  54. /package/templates/{default → tailwindcss}/tailwind.config.ts +0 -0
  55. /package/templates/{vant/src/components/navigation-bar/navigation-bar.json → tdesign/src/components/Navbar/Navbar.json} +0 -0
package/dist/index.cjs CHANGED
@@ -41,7 +41,7 @@ __export(index_exports, {
41
41
  });
42
42
  module.exports = __toCommonJS(index_exports);
43
43
 
44
- // ../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.3_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/cjs_shims.js
44
+ // ../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.10.4_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/cjs_shims.js
45
45
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
46
46
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
47
47
 
@@ -308,6 +308,15 @@ function createContext() {
308
308
  };
309
309
  }
310
310
 
311
+ // src/enums.ts
312
+ var TemplateName = /* @__PURE__ */ ((TemplateName2) => {
313
+ TemplateName2["default"] = "default";
314
+ TemplateName2["tailwindcss"] = "tailwindcss";
315
+ TemplateName2["vant"] = "vant";
316
+ TemplateName2["tdesign"] = "tdesign";
317
+ return TemplateName2;
318
+ })(TemplateName || {});
319
+
311
320
  // src/gitignore.ts
312
321
  function getDefaultGitignore() {
313
322
  return `# dependencies
@@ -646,12 +655,6 @@ async function initConfig(options) {
646
655
  }
647
656
  return ctx;
648
657
  }
649
- var TemplateName = /* @__PURE__ */ ((TemplateName2) => {
650
- TemplateName2["default"] = "default";
651
- TemplateName2["vant"] = "vant";
652
- TemplateName2["tdesign"] = "tdesign";
653
- return TemplateName2;
654
- })(TemplateName || {});
655
658
  async function createProject(targetDir = "", templateName = "default" /* default */) {
656
659
  const targetTemplateDir = path.resolve(__dirname, "../templates", templateName);
657
660
  if (await import_fs_extra.default.exists(targetTemplateDir)) {
@@ -659,8 +662,12 @@ async function createProject(targetDir = "", templateName = "default" /* default
659
662
  const pkgJsonPath = path.resolve(targetTemplateDir, "package.json");
660
663
  const pkgJson = await import_fs_extra.default.readJson(pkgJsonPath);
661
664
  if (pkgJson.devDependencies) {
662
- pkgJson.devDependencies["weapp-vite"] = "latest";
663
- pkgJson.devDependencies["weapp-tailwindcss"] = "latest";
665
+ if (pkgJson.devDependencies["weapp-vite"]) {
666
+ pkgJson.devDependencies["weapp-vite"] = "latest";
667
+ }
668
+ if (pkgJson.devDependencies["weapp-tailwindcss"]) {
669
+ pkgJson.devDependencies["weapp-tailwindcss"] = "latest";
670
+ }
664
671
  }
665
672
  await import_fs_extra.default.writeJson(path.resolve(targetDir, "package.json"), pkgJson, { spaces: 2 });
666
673
  import_logger.default.log(`\u2728 \u521B\u5EFA\u6A21\u677F\u6210\u529F!`);
package/dist/index.d.cts CHANGED
@@ -30,6 +30,13 @@ interface ProjectConfig {
30
30
  };
31
31
  }
32
32
 
33
+ declare enum TemplateName {
34
+ default = "default",
35
+ tailwindcss = "tailwindcss",
36
+ vant = "vant",
37
+ tdesign = "tdesign"
38
+ }
39
+
33
40
  declare function createOrUpdateProjectConfig(options: UpdateProjectConfigOptions): Promise<ProjectConfig | undefined>;
34
41
  declare function createOrUpdatePackageJson(options: UpdatePackageJsonOptions): Promise<PackageJson | undefined>;
35
42
  declare function initViteConfigFile(options: SharedUpdateOptions): Promise<string>;
@@ -70,11 +77,6 @@ declare function initConfig(options: {
70
77
  value: string;
71
78
  };
72
79
  }>;
73
- declare enum TemplateName {
74
- default = "default",
75
- vant = "vant",
76
- tdesign = "tdesign"
77
- }
78
80
  declare function createProject(targetDir?: string, templateName?: TemplateName): Promise<void>;
79
81
 
80
82
  export { TemplateName, createOrUpdatePackageJson, createOrUpdateProjectConfig, createProject, initConfig, initTsDtsFile, initTsJsonFiles, initViteConfigFile };
package/dist/index.d.ts CHANGED
@@ -30,6 +30,13 @@ interface ProjectConfig {
30
30
  };
31
31
  }
32
32
 
33
+ declare enum TemplateName {
34
+ default = "default",
35
+ tailwindcss = "tailwindcss",
36
+ vant = "vant",
37
+ tdesign = "tdesign"
38
+ }
39
+
33
40
  declare function createOrUpdateProjectConfig(options: UpdateProjectConfigOptions): Promise<ProjectConfig | undefined>;
34
41
  declare function createOrUpdatePackageJson(options: UpdatePackageJsonOptions): Promise<PackageJson | undefined>;
35
42
  declare function initViteConfigFile(options: SharedUpdateOptions): Promise<string>;
@@ -70,11 +77,6 @@ declare function initConfig(options: {
70
77
  value: string;
71
78
  };
72
79
  }>;
73
- declare enum TemplateName {
74
- default = "default",
75
- vant = "vant",
76
- tdesign = "tdesign"
77
- }
78
80
  declare function createProject(targetDir?: string, templateName?: TemplateName): Promise<void>;
79
81
 
80
82
  export { TemplateName, createOrUpdatePackageJson, createOrUpdateProjectConfig, createProject, initConfig, initTsDtsFile, initTsJsonFiles, initViteConfigFile };
package/dist/index.js CHANGED
@@ -261,6 +261,15 @@ function createContext() {
261
261
  };
262
262
  }
263
263
 
264
+ // src/enums.ts
265
+ var TemplateName = /* @__PURE__ */ ((TemplateName2) => {
266
+ TemplateName2["default"] = "default";
267
+ TemplateName2["tailwindcss"] = "tailwindcss";
268
+ TemplateName2["vant"] = "vant";
269
+ TemplateName2["tdesign"] = "tdesign";
270
+ return TemplateName2;
271
+ })(TemplateName || {});
272
+
264
273
  // src/gitignore.ts
265
274
  function getDefaultGitignore() {
266
275
  return `# dependencies
@@ -599,12 +608,6 @@ async function initConfig(options) {
599
608
  }
600
609
  return ctx;
601
610
  }
602
- var TemplateName = /* @__PURE__ */ ((TemplateName2) => {
603
- TemplateName2["default"] = "default";
604
- TemplateName2["vant"] = "vant";
605
- TemplateName2["tdesign"] = "tdesign";
606
- return TemplateName2;
607
- })(TemplateName || {});
608
611
  async function createProject(targetDir = "", templateName = "default" /* default */) {
609
612
  const targetTemplateDir = path.resolve(__dirname2, "../templates", templateName);
610
613
  if (await fs.exists(targetTemplateDir)) {
@@ -612,8 +615,12 @@ async function createProject(targetDir = "", templateName = "default" /* default
612
615
  const pkgJsonPath = path.resolve(targetTemplateDir, "package.json");
613
616
  const pkgJson = await fs.readJson(pkgJsonPath);
614
617
  if (pkgJson.devDependencies) {
615
- pkgJson.devDependencies["weapp-vite"] = "latest";
616
- pkgJson.devDependencies["weapp-tailwindcss"] = "latest";
618
+ if (pkgJson.devDependencies["weapp-vite"]) {
619
+ pkgJson.devDependencies["weapp-vite"] = "latest";
620
+ }
621
+ if (pkgJson.devDependencies["weapp-tailwindcss"]) {
622
+ pkgJson.devDependencies["weapp-tailwindcss"] = "latest";
623
+ }
617
624
  }
618
625
  await fs.writeJson(path.resolve(targetDir, "package.json"), pkgJson, { spaces: 2 });
619
626
  logger.log(`\u2728 \u521B\u5EFA\u6A21\u677F\u6210\u529F!`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@weapp-core/init",
3
3
  "type": "module",
4
- "version": "1.1.14",
4
+ "version": "1.1.15-alpha.1",
5
5
  "description": "@weapp-core/init",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -1,6 +1,6 @@
1
- # weapp-vite-tailwindcss-template
1
+ # weapp-vite-template
2
2
 
3
- `weapp-vite` 集成 `tailwindcss` 的模板
3
+ `weapp-vite` 模板
4
4
 
5
5
  ## 使用方式
6
6
 
@@ -1,15 +1,15 @@
1
1
  {
2
- "name": "weapp-vite-tailwindcss-template",
2
+ "name": "weapp-vite-template",
3
3
  "type": "module",
4
4
  "version": "1.0.0",
5
5
  "private": true,
6
- "description": "原生微信小程序 weapp-vite + tailwindcss 模板",
6
+ "description": "原生微信小程序 weapp-vite 模板",
7
7
  "author": "ice breaker <1324318532@qq.com>",
8
8
  "license": "MIT",
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "git+https://github.com/weapp-vite/weapp-vite.git",
12
- "directory": "apps/weapp-vite-tailwindcss-template"
12
+ "directory": "apps/weapp-vite-template"
13
13
  },
14
14
  "bugs": {
15
15
  "url": "https://github.com/weapp-vite/weapp-vite/issues"
@@ -20,19 +20,12 @@
20
20
  "dev:open": "weapp-vite dev -o",
21
21
  "build": "weapp-vite build",
22
22
  "open": "weapp-vite open",
23
- "g": "weapp-vite generate",
24
- "postinstall": "weapp-tw patch"
23
+ "g": "weapp-vite generate"
25
24
  },
26
25
  "devDependencies": {
27
- "@egoist/tailwindcss-icons": "^1.8.2",
28
- "@iconify-json/mdi": "^1.2.2",
29
- "autoprefixer": "^10.4.20",
30
26
  "miniprogram-api-typings": "^4.0.2",
31
- "postcss": "^8.4.49",
32
27
  "sass": "^1.83.0",
33
- "tailwindcss": "^3.4.17",
34
28
  "typescript": "^5.7.2",
35
- "weapp-tailwindcss": "^3.7.0",
36
29
  "weapp-vite": "workspace:*"
37
30
  }
38
31
  }
@@ -1,3 +0,0 @@
1
- @use 'tailwindcss/base';
2
- @use 'tailwindcss/components';
3
- @use 'tailwindcss/utilities';
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://vite.icebreaker.top/page.json",
3
3
  "usingComponents": {
4
- "navigation-bar": "/components/navigation-bar/navigation-bar"
4
+ "Navbar": "/components/Navbar/Navbar"
5
5
  },
6
6
  "navigationBarTitleText": "初始模板"
7
7
  }
@@ -1,12 +1,5 @@
1
1
  <view class="min-h-screen {{ mode === 'light'?'bg-gray-100 text-slate-800':'bg-gray-900 text-slate-200' }} transition-colors duration-500">
2
2
  <view class="flex flex-col items-center pt-20 space-y-10">
3
- <view class="flex space-x-8">
4
- <view class="w-24 h-24 bg-[url(https://vite.icebreaker.top/logo.png)] bg-[length:100%_100%] bg-no-repeat"></view>
5
- <view class="w-32 h-24 bg-[url(https://vite.icebreaker.top/tw-logo.png)] bg-[length:100%_100%] bg-no-repeat"></view>
6
- </view>
7
- <view class="bg-gradient-to-r from-green-400 to-sky-400 bg-clip-text text-xl font-extrabold text-transparent underline">
8
- weapp-vite & weapp-tailwindcss
9
- </view>
10
3
  <view class="{{ mode === 'light' ? 'i-mdi-moon-waxing-crescent':'i-mdi-weather-sunny text-white' }} text-8xl" bind:tap="switchMode"></view>
11
4
  <view class="underline" mark:url="https://vite.icebreaker.top" bind:tap="copy">
12
5
  https://vite.icebreaker.top
@@ -1,4 +1,3 @@
1
- import { UnifiedViteWeappTailwindcssPlugin } from 'weapp-tailwindcss/vite'
2
1
  import { defineConfig } from 'weapp-vite/config'
3
2
 
4
3
  export default defineConfig({
@@ -22,16 +21,7 @@ export default defineConfig({
22
21
  // },
23
22
  },
24
23
  },
25
- css: {
26
- preprocessorOptions: {
27
- scss: {
28
- silenceDeprecations: ['legacy-js-api', 'import'],
29
- },
30
- },
31
- },
32
24
  plugins: [
33
- UnifiedViteWeappTailwindcssPlugin({
34
- rem2rpx: true,
35
- }),
25
+ // 在这里注册 vite 插件
36
26
  ],
37
27
  })
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
@@ -0,0 +1,5 @@
1
+ {
2
+ "tailwindCSS.includeLanguages": {
3
+ "wxml": "html"
4
+ }
5
+ }
@@ -0,0 +1,28 @@
1
+ # weapp-vite-tailwindcss-template
2
+
3
+ `weapp-vite` 集成 `tailwindcss` 的模板
4
+
5
+ ## 使用方式
6
+
7
+ ### 开发
8
+
9
+ - `pnpm dev`
10
+
11
+ - `pnpm dev --open` 可以打包并直接启动微信开发者工具
12
+
13
+ ### 构建
14
+
15
+ `pnpm build`
16
+
17
+ ### 打开微信开发者工具
18
+
19
+ `pnpm open`
20
+
21
+ ### 生成组件/页面
22
+
23
+ `pnpm g path/to/your/component`
24
+
25
+ ## 文档地址
26
+
27
+ 0. `weapp-vite`: https://vite.icebreaker.top/
28
+ 1. `weapp-tailwindcss`: https://tw.icebreaker.top/
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "weapp-vite-tailwindcss-template",
3
+ "type": "module",
4
+ "version": "1.0.0",
5
+ "private": true,
6
+ "description": "原生微信小程序 weapp-vite + tailwindcss 模板",
7
+ "author": "ice breaker <1324318532@qq.com>",
8
+ "license": "MIT",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/weapp-vite/weapp-vite.git",
12
+ "directory": "apps/weapp-vite-tailwindcss-template"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/weapp-vite/weapp-vite/issues"
16
+ },
17
+ "keywords": [],
18
+ "scripts": {
19
+ "dev": "weapp-vite dev",
20
+ "dev:open": "weapp-vite dev -o",
21
+ "build": "weapp-vite build",
22
+ "open": "weapp-vite open",
23
+ "g": "weapp-vite generate",
24
+ "postinstall": "weapp-tw patch"
25
+ },
26
+ "devDependencies": {
27
+ "@egoist/tailwindcss-icons": "^1.8.2",
28
+ "@iconify-json/mdi": "^1.2.2",
29
+ "autoprefixer": "^10.4.20",
30
+ "miniprogram-api-typings": "^4.0.2",
31
+ "postcss": "^8.4.49",
32
+ "sass": "^1.83.0",
33
+ "tailwindcss": "^3.4.17",
34
+ "typescript": "^5.7.2",
35
+ "weapp-tailwindcss": "^3.7.0",
36
+ "weapp-vite": "workspace:*"
37
+ }
38
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "description": "项目配置文件",
3
+ "miniprogramRoot": "dist/",
4
+ "compileType": "miniprogram",
5
+ "setting": {
6
+ "babelSetting": {
7
+ "ignore": [],
8
+ "disablePlugins": [],
9
+ "outputPath": ""
10
+ },
11
+ "coverView": false,
12
+ "postcss": false,
13
+ "minified": false,
14
+ "enhance": true,
15
+ "showShadowRootInWxmlPanel": false,
16
+ "packNpmRelationList": [
17
+ {
18
+ "packageJsonPath": "./package.json",
19
+ "miniprogramNpmDistDir": "./dist"
20
+ }
21
+ ],
22
+ "ignoreUploadUnusedFiles": true,
23
+ "compileHotReLoad": false,
24
+ "skylineRenderEnable": true,
25
+ "packNpmManually": true,
26
+ "es6": true
27
+ },
28
+ "simulatorType": "wechat",
29
+ "simulatorPluginLibVersion": {},
30
+ "condition": {},
31
+ "srcMiniprogramRoot": "dist/",
32
+ "editorSetting": {
33
+ "tabIndent": "insertSpaces",
34
+ "tabSize": 2
35
+ },
36
+ "libVersion": "2.32.3",
37
+ "packOptions": {
38
+ "ignore": [],
39
+ "include": []
40
+ },
41
+ "appid": "wx6ffee4673b257014"
42
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
3
+ "projectname": "weapp-vite-tailwindcss-template",
4
+ "setting": {
5
+ "compileHotReLoad": false
6
+ }
7
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "$schema": "https://vite.icebreaker.top/app.json",
3
+ "pages": [
4
+ "pages/index/index",
5
+ "pages/logs/logs"
6
+ ],
7
+ "window": {},
8
+ "style": "v2",
9
+ "componentFramework": "glass-easel",
10
+ "sitemapLocation": "sitemap.json",
11
+ "lazyCodeLoading": "requiredComponents"
12
+ }
@@ -0,0 +1,3 @@
1
+ @use 'tailwindcss/base';
2
+ @use 'tailwindcss/components';
3
+ @use 'tailwindcss/utilities';
@@ -0,0 +1,6 @@
1
+ App({
2
+ globalData: {},
3
+ onLaunch() {
4
+
5
+ },
6
+ })
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "https://vite.icebreaker.top/page.json",
3
+ "usingComponents": {
4
+ "Navbar": "/components/Navbar/Navbar"
5
+ },
6
+ "navigationBarTitleText": "初始模板"
7
+ }
@@ -0,0 +1,30 @@
1
+ import { hello } from '@/utils/util'
2
+
3
+ Page({
4
+ data: {
5
+ mode: 'light',
6
+ },
7
+ switchMode() {
8
+ if (this.data.mode === 'light') {
9
+ this.setData({
10
+ mode: 'dark',
11
+ })
12
+ }
13
+ else {
14
+ this.setData({
15
+ mode: 'light',
16
+ })
17
+ }
18
+ },
19
+ async copy(e: WechatMiniprogram.BaseEvent) {
20
+ if (e.mark?.url) {
21
+ await wx.setClipboardData({
22
+ data: e.mark.url,
23
+ })
24
+ console.log(`复制成功: ${e.mark.url}`)
25
+ }
26
+ },
27
+ onLoad() {
28
+ console.log(hello())
29
+ },
30
+ })
@@ -0,0 +1,18 @@
1
+ <view class="min-h-screen {{ mode === 'light'?'bg-gray-100 text-slate-800':'bg-gray-900 text-slate-200' }} transition-colors duration-500">
2
+ <view class="flex flex-col items-center pt-20 space-y-10">
3
+ <view class="flex space-x-8">
4
+ <view class="w-24 h-24 bg-[url(https://vite.icebreaker.top/logo.png)] bg-[length:100%_100%] bg-no-repeat"></view>
5
+ <view class="w-32 h-24 bg-[url(https://vite.icebreaker.top/tw-logo.png)] bg-[length:100%_100%] bg-no-repeat"></view>
6
+ </view>
7
+ <view class="bg-gradient-to-r from-green-400 to-sky-400 bg-clip-text text-xl font-extrabold text-transparent underline">
8
+ weapp-vite & weapp-tailwindcss
9
+ </view>
10
+ <view class="{{ mode === 'light' ? 'i-mdi-moon-waxing-crescent':'i-mdi-weather-sunny text-white' }} text-8xl" bind:tap="switchMode"></view>
11
+ <view class="underline" mark:url="https://vite.icebreaker.top" bind:tap="copy">
12
+ https://vite.icebreaker.top
13
+ </view>
14
+ <view class="underline" mark:url="https://tw.icebreaker.top" bind:tap="copy">
15
+ https://tw.icebreaker.top
16
+ </view>
17
+ </view>
18
+ </view>
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://vite.icebreaker.top/page.json",
3
+ "usingComponents": {
4
+ "navigation-bar": "/components/navigation-bar/navigation-bar"
5
+ }
6
+ }
File without changes
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "https://vite.icebreaker.top/sitemap.json",
3
+ "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
4
+ "rules": [
5
+ {
6
+ "action": "allow",
7
+ "page": "*"
8
+ }
9
+ ]
10
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://vite.icebreaker.top/theme.json",
3
+ "light": {},
4
+ "dark": {}
5
+ }
@@ -0,0 +1,3 @@
1
+ export function hello() {
2
+ return 'world'
3
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="weapp-vite/client" />
@@ -0,0 +1,46 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "jsx": "preserve",
5
+ "lib": [
6
+ "ES2020",
7
+ "DOM",
8
+ "DOM.Iterable"
9
+ ],
10
+ "useDefineForClassFields": true,
11
+ "baseUrl": ".",
12
+ "module": "ESNext",
13
+ "moduleResolution": "bundler",
14
+ "paths": {
15
+ "@/*": [
16
+ "./src/*"
17
+ ]
18
+ },
19
+ "resolveJsonModule": true,
20
+ "types": [
21
+ "miniprogram-api-typings"
22
+ ],
23
+ "allowImportingTsExtensions": true,
24
+ "allowJs": true,
25
+ "strict": true,
26
+ "noFallthroughCasesInSwitch": true,
27
+ "noUnusedLocals": true,
28
+ "noUnusedParameters": true,
29
+ "noEmit": true,
30
+ "isolatedModules": true,
31
+ "skipLibCheck": true
32
+ },
33
+ "references": [
34
+ {
35
+ "path": "./tsconfig.node.json"
36
+ }
37
+ ],
38
+ "include": [
39
+ "src/**/*.ts",
40
+ "src/**/*.js"
41
+ ],
42
+ "exclude": [
43
+ "node_modules",
44
+ "dist"
45
+ ]
46
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "strict": true,
7
+ "allowSyntheticDefaultImports": true,
8
+ "skipLibCheck": true
9
+ },
10
+ "include": [
11
+ "vite.config.ts"
12
+ ]
13
+ }
@@ -0,0 +1,37 @@
1
+ import { UnifiedViteWeappTailwindcssPlugin } from 'weapp-tailwindcss/vite'
2
+ import { defineConfig } from 'weapp-vite/config'
3
+
4
+ export default defineConfig({
5
+ weapp: {
6
+ srcRoot: 'src',
7
+ // pnpm g 生成的格式
8
+ // https://vite.icebreaker.top/guide/generate.html
9
+ generate: {
10
+ extensions: {
11
+ js: 'ts',
12
+ wxss: 'scss',
13
+ },
14
+ dirs: {
15
+ component: 'src/components',
16
+ page: 'src/pages',
17
+ },
18
+ // 假如你想让默认生成的组件命名为 HelloWorld/index 而不是 HelloWorld/HelloWorld 可以下列选项
19
+ // filenames: {
20
+ // component: 'index',
21
+ // page: 'index',
22
+ // },
23
+ },
24
+ },
25
+ css: {
26
+ preprocessorOptions: {
27
+ scss: {
28
+ silenceDeprecations: ['legacy-js-api', 'import'],
29
+ },
30
+ },
31
+ },
32
+ plugins: [
33
+ UnifiedViteWeappTailwindcssPlugin({
34
+ rem2rpx: true,
35
+ }),
36
+ ],
37
+ })
@@ -0,0 +1,3 @@
1
+ Component({
2
+
3
+ })
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://vite.icebreaker.top/page.json",
3
3
  "usingComponents": {
4
- "navigation-bar": "/components/navigation-bar/navigation-bar"
4
+ "Navbar": "/components/Navbar/Navbar"
5
5
  },
6
6
  "navigationBarTitleText": "初始模板"
7
7
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "https://vite.icebreaker.top/component.json",
3
+ "component": true,
4
+ // 组件需要设置成 "apply-shared" 才能使用 app.wxss 里的全局样式
5
+ "styleIsolation": "apply-shared",
6
+ "usingComponents": {}
7
+ }
@@ -0,0 +1,3 @@
1
+ Component({
2
+
3
+ })
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://vite.icebreaker.top/page.json",
3
3
  "usingComponents": {
4
- "navigation-bar": "/components/navigation-bar/navigation-bar"
4
+ "Navbar": "/components/Navbar/Navbar"
5
5
  },
6
6
  "navigationBarTitleText": "初始模板"
7
7
  }