@weapp-core/init 1.1.5 → 1.1.7
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 +24 -13
- package/dist/index.js +23 -12
- package/package.json +2 -2
- package/templates/default/.editorconfig +9 -0
- package/templates/default/README.md +28 -0
- package/templates/default/package.json +2 -2
- package/templates/default/src/vite-env.d.ts +1 -0
- package/templates/default/vite-env.d.ts +0 -1
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.
|
|
43
|
+
// ../../node_modules/.pnpm/tsup@8.3.5_@swc+core@1.7.42_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
|
|
|
@@ -386,7 +386,8 @@ function getDefaultTsconfigJson() {
|
|
|
386
386
|
],
|
|
387
387
|
include: [
|
|
388
388
|
"**/*.ts",
|
|
389
|
-
"**/*.js"
|
|
389
|
+
"**/*.js",
|
|
390
|
+
"vite-env.d.ts"
|
|
390
391
|
],
|
|
391
392
|
exclude: [
|
|
392
393
|
"node_modules",
|
|
@@ -394,7 +395,7 @@ function getDefaultTsconfigJson() {
|
|
|
394
395
|
]
|
|
395
396
|
};
|
|
396
397
|
}
|
|
397
|
-
function getDefaultTsconfigNodeJson(include) {
|
|
398
|
+
function getDefaultTsconfigNodeJson(include = []) {
|
|
398
399
|
return {
|
|
399
400
|
compilerOptions: {
|
|
400
401
|
composite: true,
|
|
@@ -408,6 +409,24 @@ function getDefaultTsconfigNodeJson(include) {
|
|
|
408
409
|
};
|
|
409
410
|
}
|
|
410
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
|
+
|
|
411
430
|
// src/index.ts
|
|
412
431
|
var __dirname = path.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
413
432
|
var ctx = createContext();
|
|
@@ -551,14 +570,7 @@ async function initViteConfigFile(options) {
|
|
|
551
570
|
const type = (0, import_shared.get)(ctx.packageJson.value, "type");
|
|
552
571
|
const targetFilename = ctx.viteConfig.name = type === "module" ? "vite.config.ts" : "vite.config.mts";
|
|
553
572
|
const viteConfigFilePath = ctx.viteConfig.path = path.resolve(root, targetFilename);
|
|
554
|
-
const viteConfigFileCode = ctx.viteConfig.value =
|
|
555
|
-
|
|
556
|
-
export default defineConfig({
|
|
557
|
-
weapp: {
|
|
558
|
-
// weapp-vite options
|
|
559
|
-
},
|
|
560
|
-
})
|
|
561
|
-
`;
|
|
573
|
+
const viteConfigFileCode = ctx.viteConfig.value = getDefaultViteConfig();
|
|
562
574
|
if (write) {
|
|
563
575
|
await import_fs_extra.default.outputFile(viteConfigFilePath, viteConfigFileCode, "utf8");
|
|
564
576
|
import_logger.default.log(`\u2728 \u8BBE\u7F6E ${targetFilename} \u914D\u7F6E\u6587\u4EF6\u6210\u529F!`);
|
|
@@ -569,8 +581,7 @@ async function initTsDtsFile(options) {
|
|
|
569
581
|
const { root, write = true } = options;
|
|
570
582
|
const targetFilename = "vite-env.d.ts";
|
|
571
583
|
const viteDtsFilePath = path.resolve(root, targetFilename);
|
|
572
|
-
const code =
|
|
573
|
-
`;
|
|
584
|
+
const code = getDefaultTsDts();
|
|
574
585
|
if (write) {
|
|
575
586
|
await import_fs_extra.default.outputFile(viteDtsFilePath, code, "utf8");
|
|
576
587
|
import_logger.default.log(`\u2728 \u8BBE\u7F6E ${targetFilename} \u914D\u7F6E\u6587\u4EF6\u6210\u529F!`);
|
package/dist/index.js
CHANGED
|
@@ -340,7 +340,8 @@ function getDefaultTsconfigJson() {
|
|
|
340
340
|
],
|
|
341
341
|
include: [
|
|
342
342
|
"**/*.ts",
|
|
343
|
-
"**/*.js"
|
|
343
|
+
"**/*.js",
|
|
344
|
+
"vite-env.d.ts"
|
|
344
345
|
],
|
|
345
346
|
exclude: [
|
|
346
347
|
"node_modules",
|
|
@@ -348,7 +349,7 @@ function getDefaultTsconfigJson() {
|
|
|
348
349
|
]
|
|
349
350
|
};
|
|
350
351
|
}
|
|
351
|
-
function getDefaultTsconfigNodeJson(include) {
|
|
352
|
+
function getDefaultTsconfigNodeJson(include = []) {
|
|
352
353
|
return {
|
|
353
354
|
compilerOptions: {
|
|
354
355
|
composite: true,
|
|
@@ -362,6 +363,24 @@ function getDefaultTsconfigNodeJson(include) {
|
|
|
362
363
|
};
|
|
363
364
|
}
|
|
364
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
|
+
|
|
365
384
|
// src/index.ts
|
|
366
385
|
var __dirname2 = path.dirname(fileURLToPath(import.meta.url));
|
|
367
386
|
var ctx = createContext();
|
|
@@ -505,14 +524,7 @@ async function initViteConfigFile(options) {
|
|
|
505
524
|
const type = get(ctx.packageJson.value, "type");
|
|
506
525
|
const targetFilename = ctx.viteConfig.name = type === "module" ? "vite.config.ts" : "vite.config.mts";
|
|
507
526
|
const viteConfigFilePath = ctx.viteConfig.path = path.resolve(root, targetFilename);
|
|
508
|
-
const viteConfigFileCode = ctx.viteConfig.value =
|
|
509
|
-
|
|
510
|
-
export default defineConfig({
|
|
511
|
-
weapp: {
|
|
512
|
-
// weapp-vite options
|
|
513
|
-
},
|
|
514
|
-
})
|
|
515
|
-
`;
|
|
527
|
+
const viteConfigFileCode = ctx.viteConfig.value = getDefaultViteConfig();
|
|
516
528
|
if (write) {
|
|
517
529
|
await fs.outputFile(viteConfigFilePath, viteConfigFileCode, "utf8");
|
|
518
530
|
logger.log(`\u2728 \u8BBE\u7F6E ${targetFilename} \u914D\u7F6E\u6587\u4EF6\u6210\u529F!`);
|
|
@@ -523,8 +535,7 @@ async function initTsDtsFile(options) {
|
|
|
523
535
|
const { root, write = true } = options;
|
|
524
536
|
const targetFilename = "vite-env.d.ts";
|
|
525
537
|
const viteDtsFilePath = path.resolve(root, targetFilename);
|
|
526
|
-
const code =
|
|
527
|
-
`;
|
|
538
|
+
const code = getDefaultTsDts();
|
|
528
539
|
if (write) {
|
|
529
540
|
await fs.outputFile(viteDtsFilePath, code, "utf8");
|
|
530
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.
|
|
4
|
+
"version": "1.1.7",
|
|
5
5
|
"description": "@weapp-core/init",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
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,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.
|
|
31
|
+
"sass": "^1.80.6",
|
|
32
32
|
"tailwindcss": "^3.4.14",
|
|
33
33
|
"typescript": "latest",
|
|
34
|
-
"weapp-tailwindcss": "^3.6.
|
|
34
|
+
"weapp-tailwindcss": "^3.6.2",
|
|
35
35
|
"weapp-vite": "workspace:*"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="weapp-vite/client" />
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|