@weapp-core/schematics 6.0.0 → 6.0.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 +45 -0
- package/dist/index.cjs +7232 -0
- package/dist/index.d.cts +457 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +26 -26
- package/package.json +4 -3
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# @weapp-core/schematics
|
|
2
|
+
|
|
3
|
+
## 简介
|
|
4
|
+
|
|
5
|
+
`@weapp-core/schematics` 提供小程序文件的生成能力与 JSON Schema 定义,供 weapp-vite 与相关工具进行模板生成、类型提示与校验。
|
|
6
|
+
|
|
7
|
+
## 特性
|
|
8
|
+
|
|
9
|
+
- 生成 JS / WXML / WXSS / JSON 模板
|
|
10
|
+
- 支持不同类型(app/page/component)
|
|
11
|
+
- 导出 JSON Schema 定义供编辑器插件使用
|
|
12
|
+
|
|
13
|
+
## 安装
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @weapp-core/schematics
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 使用
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import {
|
|
23
|
+
generateJs,
|
|
24
|
+
generateJson,
|
|
25
|
+
generateWxml,
|
|
26
|
+
generateWxss,
|
|
27
|
+
JSON_SCHEMA_DEFINITIONS,
|
|
28
|
+
} from '@weapp-core/schematics'
|
|
29
|
+
|
|
30
|
+
const jsCode = generateJs('page')
|
|
31
|
+
const wxmlCode = generateWxml('pages/index/index')
|
|
32
|
+
const wxssCode = generateWxss()
|
|
33
|
+
const jsonCode = generateJson('component', 'json')
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## 配置
|
|
37
|
+
|
|
38
|
+
`generateJson(type, ext)` 说明:
|
|
39
|
+
|
|
40
|
+
- `type`: `app` / `page` / `component`
|
|
41
|
+
- `ext`: `json` / `js` / `ts`
|
|
42
|
+
|
|
43
|
+
## 相关链接
|
|
44
|
+
|
|
45
|
+
- 仓库:https://github.com/weapp-vite/weapp-vite
|