@weapp-core/init 1.1.6 → 1.1.8

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/dist/index.cjs CHANGED
@@ -40,7 +40,7 @@ __export(src_exports, {
40
40
  });
41
41
  module.exports = __toCommonJS(src_exports);
42
42
 
43
- // ../../node_modules/.pnpm/tsup@8.3.0_@swc+core@1.7.36_jiti@2.3.1_postcss@8.4.47_tsx@4.19.1_typescript@5.6.3_yaml@2.6.0/node_modules/tsup/assets/cjs_shims.js
43
+ // ../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.9.1_jiti@2.3.1_postcss@8.4.47_tsx@4.19.2_typescript@5.6.3_yaml@2.6.0/node_modules/tsup/assets/cjs_shims.js
44
44
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
45
45
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
46
46
 
@@ -395,7 +395,7 @@ function getDefaultTsconfigJson() {
395
395
  ]
396
396
  };
397
397
  }
398
- function getDefaultTsconfigNodeJson(include) {
398
+ function getDefaultTsconfigNodeJson(include = []) {
399
399
  return {
400
400
  compilerOptions: {
401
401
  composite: true,
@@ -409,6 +409,24 @@ function getDefaultTsconfigNodeJson(include) {
409
409
  };
410
410
  }
411
411
 
412
+ // src/tsDts.ts
413
+ function getDefaultTsDts() {
414
+ return `/// <reference types="weapp-vite/client" />
415
+ `;
416
+ }
417
+
418
+ // src/viteConfig.ts
419
+ function getDefaultViteConfig() {
420
+ return `import { defineConfig } from 'weapp-vite/config'
421
+
422
+ export default defineConfig({
423
+ weapp: {
424
+ // weapp-vite options
425
+ },
426
+ })
427
+ `;
428
+ }
429
+
412
430
  // src/index.ts
413
431
  var __dirname = path.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
414
432
  var ctx = createContext();
@@ -552,14 +570,7 @@ async function initViteConfigFile(options) {
552
570
  const type = (0, import_shared.get)(ctx.packageJson.value, "type");
553
571
  const targetFilename = ctx.viteConfig.name = type === "module" ? "vite.config.ts" : "vite.config.mts";
554
572
  const viteConfigFilePath = ctx.viteConfig.path = path.resolve(root, targetFilename);
555
- const viteConfigFileCode = ctx.viteConfig.value = `import { defineConfig } from 'weapp-vite/config'
556
-
557
- export default defineConfig({
558
- weapp: {
559
- // weapp-vite options
560
- },
561
- })
562
- `;
573
+ const viteConfigFileCode = ctx.viteConfig.value = getDefaultViteConfig();
563
574
  if (write) {
564
575
  await import_fs_extra.default.outputFile(viteConfigFilePath, viteConfigFileCode, "utf8");
565
576
  import_logger.default.log(`\u2728 \u8BBE\u7F6E ${targetFilename} \u914D\u7F6E\u6587\u4EF6\u6210\u529F!`);
@@ -570,8 +581,7 @@ async function initTsDtsFile(options) {
570
581
  const { root, write = true } = options;
571
582
  const targetFilename = "vite-env.d.ts";
572
583
  const viteDtsFilePath = path.resolve(root, targetFilename);
573
- const code = `/// <reference types="weapp-vite/client" />
574
- `;
584
+ const code = getDefaultTsDts();
575
585
  if (write) {
576
586
  await import_fs_extra.default.outputFile(viteDtsFilePath, code, "utf8");
577
587
  import_logger.default.log(`\u2728 \u8BBE\u7F6E ${targetFilename} \u914D\u7F6E\u6587\u4EF6\u6210\u529F!`);
package/dist/index.js CHANGED
@@ -349,7 +349,7 @@ function getDefaultTsconfigJson() {
349
349
  ]
350
350
  };
351
351
  }
352
- function getDefaultTsconfigNodeJson(include) {
352
+ function getDefaultTsconfigNodeJson(include = []) {
353
353
  return {
354
354
  compilerOptions: {
355
355
  composite: true,
@@ -363,6 +363,24 @@ function getDefaultTsconfigNodeJson(include) {
363
363
  };
364
364
  }
365
365
 
366
+ // src/tsDts.ts
367
+ function getDefaultTsDts() {
368
+ return `/// <reference types="weapp-vite/client" />
369
+ `;
370
+ }
371
+
372
+ // src/viteConfig.ts
373
+ function getDefaultViteConfig() {
374
+ return `import { defineConfig } from 'weapp-vite/config'
375
+
376
+ export default defineConfig({
377
+ weapp: {
378
+ // weapp-vite options
379
+ },
380
+ })
381
+ `;
382
+ }
383
+
366
384
  // src/index.ts
367
385
  var __dirname2 = path.dirname(fileURLToPath(import.meta.url));
368
386
  var ctx = createContext();
@@ -506,14 +524,7 @@ async function initViteConfigFile(options) {
506
524
  const type = get(ctx.packageJson.value, "type");
507
525
  const targetFilename = ctx.viteConfig.name = type === "module" ? "vite.config.ts" : "vite.config.mts";
508
526
  const viteConfigFilePath = ctx.viteConfig.path = path.resolve(root, targetFilename);
509
- const viteConfigFileCode = ctx.viteConfig.value = `import { defineConfig } from 'weapp-vite/config'
510
-
511
- export default defineConfig({
512
- weapp: {
513
- // weapp-vite options
514
- },
515
- })
516
- `;
527
+ const viteConfigFileCode = ctx.viteConfig.value = getDefaultViteConfig();
517
528
  if (write) {
518
529
  await fs.outputFile(viteConfigFilePath, viteConfigFileCode, "utf8");
519
530
  logger.log(`\u2728 \u8BBE\u7F6E ${targetFilename} \u914D\u7F6E\u6587\u4EF6\u6210\u529F!`);
@@ -524,8 +535,7 @@ async function initTsDtsFile(options) {
524
535
  const { root, write = true } = options;
525
536
  const targetFilename = "vite-env.d.ts";
526
537
  const viteDtsFilePath = path.resolve(root, targetFilename);
527
- const code = `/// <reference types="weapp-vite/client" />
528
- `;
538
+ const code = getDefaultTsDts();
529
539
  if (write) {
530
540
  await fs.outputFile(viteDtsFilePath, code, "utf8");
531
541
  logger.log(`\u2728 \u8BBE\u7F6E ${targetFilename} \u914D\u7F6E\u6587\u4EF6\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.6",
4
+ "version": "1.1.8",
5
5
  "description": "@weapp-core/init",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -32,13 +32,13 @@
32
32
  "dependencies": {
33
33
  "fs-extra": "^11.2.0",
34
34
  "@weapp-core/logger": "^1.0.1",
35
- "@weapp-core/shared": "^1.0.3"
35
+ "@weapp-core/shared": "^1.0.4"
36
36
  },
37
37
  "scripts": {
38
38
  "dev": "tsup --watch --sourcemap",
39
39
  "build": "tsup",
40
40
  "test": "vitest run",
41
- "test:dev": "vitest",
41
+ "test:dev": "vitest --coverage",
42
42
  "release": "pnpm publish",
43
43
  "lint": "eslint .",
44
44
  "lint:fix": "eslint . --fix",
@@ -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,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/
@@ -28,10 +28,10 @@
28
28
  "autoprefixer": "^10.4.20",
29
29
  "miniprogram-api-typings": "latest",
30
30
  "postcss": "^8.4.47",
31
- "sass": "^1.80.2",
31
+ "sass": "^1.80.6",
32
32
  "tailwindcss": "^3.4.14",
33
33
  "typescript": "latest",
34
- "weapp-tailwindcss": "^3.6.0",
34
+ "weapp-tailwindcss": "^3.6.2",
35
35
  "weapp-vite": "workspace:*"
36
36
  }
37
37
  }
@@ -16,6 +16,14 @@ Page({
16
16
  })
17
17
  }
18
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
+ },
19
27
  onLoad() {
20
28
  console.log(hello())
21
29
  },
@@ -1,4 +1,4 @@
1
- <view class="min-h-screen {{ mode === 'light'?'bg-gray-100':'bg-gray-900' }} transition-colors duration-500">
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
3
  <view class="flex space-x-8">
4
4
  <view class="w-24 h-24 bg-[url(https://vite.icebreaker.top/logo.png)] bg-[length:100%_100%] bg-no-repeat"></view>
@@ -8,5 +8,11 @@
8
8
  weapp-vite & weapp-tailwindcss
9
9
  </view>
10
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>
11
17
  </view>
12
- </view>
18
+ </view>