create-swdg-frontend 0.2.0 → 0.2.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.
- package/README.md +4 -4
- package/lib/constants.js +1 -1
- package/package.json +1 -1
- package/template/README.md +3 -3
- package/template/docs/MAINTAINER.md +10 -12
- package/template/docs/ONBOARDING.md +3 -3
- package/template/docs/TESTING.md +1 -1
package/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# create-swdg-frontend
|
|
2
2
|
|
|
3
|
-
从 SWDG 模板生成新项目。
|
|
4
|
-
|
|
5
|
-
## 使用
|
|
3
|
+
从 SWDG 模板生成新项目。npm 包名 **`create-swdg-frontend`**,对应命令:
|
|
6
4
|
|
|
7
5
|
```bash
|
|
8
|
-
pnpm create swdg my-app
|
|
6
|
+
pnpm create swdg-frontend my-app
|
|
9
7
|
# 或
|
|
10
8
|
pnpm dlx create-swdg-frontend my-app
|
|
11
9
|
```
|
|
12
10
|
|
|
11
|
+
> `pnpm create swdg` 会去找包 `create-swdg`(与本包无关),请使用上面的 `swdg-frontend`。
|
|
12
|
+
|
|
13
13
|
### 常用参数
|
|
14
14
|
|
|
15
15
|
| 参数 | 说明 |
|
package/lib/constants.js
CHANGED
|
@@ -6,7 +6,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
6
6
|
export const PACKAGE_ROOT = path.resolve(__dirname, '..');
|
|
7
7
|
export const TEMPLATE_DIR = path.join(PACKAGE_ROOT, 'template');
|
|
8
8
|
export const STUBS_DIR = path.join(PACKAGE_ROOT, 'stubs');
|
|
9
|
-
export const SCAFFOLD_VERSION = '0.2.
|
|
9
|
+
export const SCAFFOLD_VERSION = '0.2.1';
|
|
10
10
|
|
|
11
11
|
/** 可选特性:重型依赖默认关闭,创建时 opt-in */
|
|
12
12
|
export const FEATURES = {
|
package/package.json
CHANGED
package/template/README.md
CHANGED
|
@@ -33,7 +33,7 @@ pnpm dev # http://localhost:3000 ,改 .env 后需重启
|
|
|
33
33
|
## 创建新项目(脚手架)
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
|
-
pnpm create swdg my-app
|
|
36
|
+
pnpm create swdg-frontend my-app
|
|
37
37
|
# 或
|
|
38
38
|
npx create-swdg-frontend my-app
|
|
39
39
|
```
|
|
@@ -42,10 +42,10 @@ npx create-swdg-frontend my-app
|
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
44
|
# 非 GIS 项目(推荐多数后台类应用)
|
|
45
|
-
pnpm create swdg my-app --no-gis --install
|
|
45
|
+
pnpm create swdg-frontend my-app --no-gis --install
|
|
46
46
|
|
|
47
47
|
# GIS 项目
|
|
48
|
-
pnpm create swdg my-app --gis --install
|
|
48
|
+
pnpm create swdg-frontend my-app --gis --install
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
## 目录结构
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
```
|
|
8
8
|
frontend-framework/ # 模板源仓库(本仓库)
|
|
9
|
-
├── create-swdg/ # npm 包 create-swdg-frontend
|
|
9
|
+
├── create-swdg/ # npm 包 create-swdg-frontend(pnpm create swdg-frontend)
|
|
10
10
|
│ ├── bin/index.js # CLI 入口
|
|
11
11
|
│ ├── lib/ # 提示、特性剥离、manifest
|
|
12
12
|
│ ├── stubs/ # 无 GIS 时的配置替身
|
|
@@ -23,22 +23,20 @@ frontend-framework/ # 模板源仓库(本仓库)
|
|
|
23
23
|
1. 登录 [npmjs.com](https://www.npmjs.com/),确认账号已验证邮箱
|
|
24
24
|
2. 确认包名 **`create-swdg-frontend`**、**`swdg`** 在你账号下(首次需未被占用)
|
|
25
25
|
3. npm → Access Tokens → **Generate New Token**
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
- **必须** 选 **Granular Access Token**(Packages: Read and write)并勾选 **Bypass 2FA**,
|
|
27
|
+
或 **Classic Token → Automation**(专为 CI 设计,不需要 OTP)
|
|
28
|
+
- ⚠️ 不要用 Classic **Publish** token,CI 会报 `EOTP`
|
|
29
|
+
4. GitHub → **Settings → Secrets → Actions** → 更新 **`NPM_TOKEN`**
|
|
29
30
|
|
|
30
31
|
**每次发版**
|
|
31
32
|
|
|
32
33
|
```bash
|
|
33
|
-
# 1.
|
|
34
|
-
pnpm test:ci
|
|
35
|
-
|
|
36
|
-
# 2. 提交并推到 GitHub(如有未 push 的改动)
|
|
34
|
+
# 1. 提交并推到 GitHub(main 上 CI 会跑 test:ci)
|
|
37
35
|
git push github main
|
|
38
36
|
|
|
39
|
-
#
|
|
40
|
-
git tag v0.2.
|
|
41
|
-
git push github v0.2.
|
|
37
|
+
# 2. 打 tag 并推送(版本号与 tag 一致,格式 vX.Y.Z;Release workflow 会再跑 test:ci 后 publish)
|
|
38
|
+
git tag v0.2.1
|
|
39
|
+
git push github v0.2.1
|
|
42
40
|
```
|
|
43
41
|
|
|
44
42
|
4. 打开 **Actions → Release to npm**,等待 workflow 完成
|
|
@@ -50,7 +48,7 @@ CI 会:从 tag 解析版本 → `test:ci` → 发布 `create-swdg-frontend`
|
|
|
50
48
|
|
|
51
49
|
```bash
|
|
52
50
|
pnpm test:ci
|
|
53
|
-
pnpm release 0.2.
|
|
51
|
+
pnpm release 0.2.1
|
|
54
52
|
```
|
|
55
53
|
|
|
56
54
|
详见 [TESTING.md](./TESTING.md)。
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
| 方式 | 适合谁 | 第一步 |
|
|
10
10
|
| ------------------ | -------------------------------- | ------------------------------------------------------------ |
|
|
11
11
|
| **直接使用本仓库** | 团队统一模板、在 monorepo 上迭代 | `git clone` → `pnpm install` |
|
|
12
|
-
| **脚手架新建项目** | 每个业务一条独立仓库 | `pnpm create swdg my-app`(见根目录 [README](../README.md)) |
|
|
12
|
+
| **脚手架新建项目** | 每个业务一条独立仓库 | `pnpm create swdg-frontend my-app`(见根目录 [README](../README.md)) |
|
|
13
13
|
|
|
14
14
|
两种方式的项目结构、命令、路由约定 **一致**;脚手架可通过 `--gis` / `--no-gis` 裁剪 Cesium 相关文件。
|
|
15
15
|
|
|
@@ -259,7 +259,7 @@ pnpm preview
|
|
|
259
259
|
## 十三、脚手架创建新项目(摘要)
|
|
260
260
|
|
|
261
261
|
```bash
|
|
262
|
-
pnpm create swdg my-app
|
|
262
|
+
pnpm create swdg-frontend my-app
|
|
263
263
|
cd my-app
|
|
264
264
|
pnpm dev
|
|
265
265
|
```
|
|
@@ -267,7 +267,7 @@ pnpm dev
|
|
|
267
267
|
- 交互默认 **不启用 GIS**;三维项目请选 Y 或加 `--gis`
|
|
268
268
|
- 生成目录含 `docs/ONBOARDING.md`(与本文同步)和 `.swdg/manifest.json`(记录创建选项)
|
|
269
269
|
|
|
270
|
-
更多参数:`
|
|
270
|
+
更多参数:`pnpm create swdg-frontend --help` 或根 [README](../README.md)。
|
|
271
271
|
|
|
272
272
|
---
|
|
273
273
|
|