@lark-apaas/fullstack-cli 1.1.73-alpha.20261202064920 → 1.1.73-beta.0
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 +0 -10
- package/dist/index.js +138 -556
- package/package.json +3 -6
- package/templates/scripts/lint.js +37 -13
- package/README.en-US.md +0 -418
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/fullstack-cli",
|
|
3
|
-
"version": "1.1.73-
|
|
3
|
+
"version": "1.1.73-beta.0",
|
|
4
4
|
"description": "CLI tool for fullstack template management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -9,9 +9,7 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
11
|
"templates",
|
|
12
|
-
"bin"
|
|
13
|
-
"README.md",
|
|
14
|
-
"README.en-US.md"
|
|
12
|
+
"bin"
|
|
15
13
|
],
|
|
16
14
|
"scripts": {
|
|
17
15
|
"build": "tsup",
|
|
@@ -33,8 +31,7 @@
|
|
|
33
31
|
"access": "public"
|
|
34
32
|
},
|
|
35
33
|
"dependencies": {
|
|
36
|
-
"@lark-apaas/http-client": "0.1.
|
|
37
|
-
"@lark-apaas/miaoda-common-settings": "1.0.1-alpha.20261202064935",
|
|
34
|
+
"@lark-apaas/http-client": "^0.1.9",
|
|
38
35
|
"@lydell/node-pty": "1.1.0",
|
|
39
36
|
"@vercel/nft": "^0.30.3",
|
|
40
37
|
"commander": "^13.0.0",
|
|
@@ -10,15 +10,28 @@ function getBinName(name) {
|
|
|
10
10
|
return process.platform === 'win32' ? `${name}.cmd` : name;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
function getLinter() {
|
|
14
|
+
const pkg = JSON.parse(
|
|
15
|
+
fs.readFileSync(path.join(cwd, 'package.json'), 'utf8')
|
|
16
|
+
);
|
|
17
|
+
// 优先沿用已有 eslint 入口,避免对照脚本意外切换检查器。
|
|
18
|
+
const script =
|
|
19
|
+
pkg.scripts?.oxlint && !pkg.scripts?.eslint ? 'oxlint' : 'eslint';
|
|
20
|
+
const engine = /\boxlint\b/.test(pkg.scripts?.[script] || '')
|
|
21
|
+
? 'oxlint'
|
|
22
|
+
: script;
|
|
23
|
+
return { script, engine };
|
|
24
|
+
}
|
|
25
|
+
|
|
13
26
|
function runCommand(command, args) {
|
|
14
|
-
return new Promise(
|
|
27
|
+
return new Promise(resolve => {
|
|
15
28
|
const child = spawn(command, args, {
|
|
16
29
|
cwd,
|
|
17
30
|
stdio: 'inherit',
|
|
18
31
|
shell: false,
|
|
19
32
|
});
|
|
20
33
|
|
|
21
|
-
child.on('close',
|
|
34
|
+
child.on('close', code => resolve(code || 0));
|
|
22
35
|
child.on('error', () => resolve(1));
|
|
23
36
|
});
|
|
24
37
|
}
|
|
@@ -64,7 +77,7 @@ function parseFilesArg(argv) {
|
|
|
64
77
|
return argv.slice(filesIndex + 1).filter(Boolean);
|
|
65
78
|
}
|
|
66
79
|
|
|
67
|
-
function
|
|
80
|
+
function isLintTarget(filePath) {
|
|
68
81
|
return /\.(c|m)?(j|t)sx?$/.test(filePath);
|
|
69
82
|
}
|
|
70
83
|
|
|
@@ -104,19 +117,24 @@ function canRunStylelint() {
|
|
|
104
117
|
|
|
105
118
|
if (!pkg.scripts || !pkg.scripts.stylelint) return false;
|
|
106
119
|
|
|
107
|
-
return STYLELINT_CONFIG_FILES.some(file =>
|
|
120
|
+
return STYLELINT_CONFIG_FILES.some(file =>
|
|
121
|
+
fs.existsSync(path.join(cwd, file))
|
|
122
|
+
);
|
|
108
123
|
}
|
|
109
124
|
|
|
110
125
|
async function runDefaultLint() {
|
|
126
|
+
const { script: lintScript } = getLinter();
|
|
111
127
|
const taskSpecs = [
|
|
112
|
-
[getBinName('npm'), ['run',
|
|
128
|
+
[getBinName('npm'), ['run', lintScript]],
|
|
113
129
|
[getBinName('npm'), ['run', 'type:check']],
|
|
114
130
|
];
|
|
115
131
|
|
|
116
132
|
if (canRunStylelint()) {
|
|
117
133
|
taskSpecs.push([getBinName('npm'), ['run', 'stylelint']]);
|
|
118
134
|
} else {
|
|
119
|
-
console.warn(
|
|
135
|
+
console.warn(
|
|
136
|
+
'[lint] Skip stylelint: missing scripts.stylelint or stylelint config'
|
|
137
|
+
);
|
|
120
138
|
}
|
|
121
139
|
|
|
122
140
|
process.exit(await runTasksSerially(taskSpecs));
|
|
@@ -124,7 +142,7 @@ async function runDefaultLint() {
|
|
|
124
142
|
|
|
125
143
|
async function runSelectiveLint(inputFiles) {
|
|
126
144
|
const normalizedFiles = Array.from(
|
|
127
|
-
new Set(inputFiles.map(normalizeProjectFile).filter(Boolean))
|
|
145
|
+
new Set(inputFiles.map(normalizeProjectFile).filter(Boolean))
|
|
128
146
|
);
|
|
129
147
|
|
|
130
148
|
if (normalizedFiles.length === 0) {
|
|
@@ -132,7 +150,7 @@ async function runSelectiveLint(inputFiles) {
|
|
|
132
150
|
process.exit(0);
|
|
133
151
|
}
|
|
134
152
|
|
|
135
|
-
const
|
|
153
|
+
const lintFiles = normalizedFiles.filter(isLintTarget);
|
|
136
154
|
const stylelintFiles = normalizedFiles.filter(isStylelintTarget);
|
|
137
155
|
const typeCheckFiles = normalizedFiles.filter(isTypeCheckTarget);
|
|
138
156
|
|
|
@@ -152,14 +170,20 @@ async function runSelectiveLint(inputFiles) {
|
|
|
152
170
|
|
|
153
171
|
const taskSpecs = [];
|
|
154
172
|
|
|
155
|
-
if (
|
|
156
|
-
|
|
173
|
+
if (lintFiles.length > 0) {
|
|
174
|
+
const { engine: lintEngine } = getLinter();
|
|
175
|
+
taskSpecs.push([getBinName('npx'), [lintEngine, '--quiet', ...lintFiles]]);
|
|
157
176
|
}
|
|
158
177
|
|
|
159
178
|
if (stylelintFiles.length > 0 && !canRunStylelint()) {
|
|
160
|
-
console.warn(
|
|
179
|
+
console.warn(
|
|
180
|
+
'[lint] Skip stylelint: missing scripts.stylelint or stylelint config'
|
|
181
|
+
);
|
|
161
182
|
} else if (stylelintFiles.length > 0) {
|
|
162
|
-
taskSpecs.push([
|
|
183
|
+
taskSpecs.push([
|
|
184
|
+
getBinName('npx'),
|
|
185
|
+
['stylelint', '--quiet', ...stylelintFiles],
|
|
186
|
+
]);
|
|
163
187
|
}
|
|
164
188
|
|
|
165
189
|
if (clientTypeFiles.length > 0) {
|
|
@@ -193,7 +217,7 @@ async function main() {
|
|
|
193
217
|
await runSelectiveLint(files);
|
|
194
218
|
}
|
|
195
219
|
|
|
196
|
-
main().catch(
|
|
220
|
+
main().catch(error => {
|
|
197
221
|
const message = error instanceof Error ? error.message : String(error);
|
|
198
222
|
console.error(`[lint] Failed to run lint: ${message}`);
|
|
199
223
|
process.exit(1);
|
package/README.en-US.md
DELETED
|
@@ -1,418 +0,0 @@
|
|
|
1
|
-
# @lark-apaas/fullstack-cli
|
|
2
|
-
|
|
3
|
-
[中文](./README.md) | English
|
|
4
|
-
|
|
5
|
-
> Fullstack development toolkit - file syncing, database schema generation, OpenAPI generation, capability management, build tools
|
|
6
|
-
|
|
7
|
-
## Features
|
|
8
|
-
|
|
9
|
-
1. **Automatic syncing** - manages project scripts and config files automatically
|
|
10
|
-
2. **Database schema generation** - generates a Drizzle ORM schema from an existing database
|
|
11
|
-
3. **OpenAPI generation** - generates API docs and a client SDK automatically
|
|
12
|
-
4. **Action plugin management** - installs, updates and removes action plugins
|
|
13
|
-
5. **Capability config management** - lists, hydrates and migrates capability configs
|
|
14
|
-
6. **Build tools** - build-related operations such as getting STI artifact upload credentials
|
|
15
|
-
|
|
16
|
-
## Installation
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
npm install --save-dev @lark-apaas/fullstack-cli
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Usage
|
|
23
|
-
|
|
24
|
-
### 1. Automatic syncing
|
|
25
|
-
|
|
26
|
-
Every time `npm install` runs, files are synced into the project automatically:
|
|
27
|
-
|
|
28
|
-
**What gets synced:**
|
|
29
|
-
- `scripts/` - shell script directory (always overwritten)
|
|
30
|
-
- `.gitignore` - fullstack-cli ignore rules are appended
|
|
31
|
-
|
|
32
|
-
⚠️ **The `scripts/` directory is managed by the CLI. Do not edit it by hand!**
|
|
33
|
-
|
|
34
|
-
### 2. Generate the database schema
|
|
35
|
-
|
|
36
|
-
Generate a Drizzle ORM schema from an existing database:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
npm run gen:db-schema
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
**Environment variables:**
|
|
43
|
-
```bash
|
|
44
|
-
# Required
|
|
45
|
-
SUDA_DATABASE_URL=postgresql://user:pass@host:port/dbname?schema=public
|
|
46
|
-
|
|
47
|
-
# Optional
|
|
48
|
-
DB_SCHEMA_OUTPUT=server/database/schema.ts # Output path
|
|
49
|
-
DRIZZLE_SCHEMA_FILTER=public,custom # Schema filter
|
|
50
|
-
DRIZZLE_TABLES_FILTER=users,orders # Table filter
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
**Workflow:**
|
|
54
|
-
1. Reads the database connection from `SUDA_DATABASE_URL`
|
|
55
|
-
2. Uses the CLI's built-in `drizzle.config.ts` (nothing for you to maintain)
|
|
56
|
-
3. Runs `drizzle-kit introspect`
|
|
57
|
-
4. Post-processes the schema (via devtool-kits)
|
|
58
|
-
5. Writes the result to `server/database/schema.ts`
|
|
59
|
-
|
|
60
|
-
### 3. Generate OpenAPI docs
|
|
61
|
-
|
|
62
|
-
Generate OpenAPI docs and a client SDK automatically:
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
npm run gen:openapi
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
**Environment variables:**
|
|
69
|
-
```bash
|
|
70
|
-
# Optional
|
|
71
|
-
APP_MODULE_PATH=server/app.module # AppModule path (without extension)
|
|
72
|
-
CLIENT_BASE_PATH=/ # Client base path
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
**Workflow:**
|
|
76
|
-
1. Dynamically imports the project's `AppModule`
|
|
77
|
-
2. Mounts DevToolsModule
|
|
78
|
-
3. Generates the OpenAPI docs and client SDK
|
|
79
|
-
|
|
80
|
-
### 4. Action plugin management
|
|
81
|
-
|
|
82
|
-
Install, update, remove and list Action plugins:
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
# Install a plugin (latest version by default)
|
|
86
|
-
fullstack-cli action-plugin install @office/feishu-create-group
|
|
87
|
-
|
|
88
|
-
# Install a specific version
|
|
89
|
-
fullstack-cli action-plugin install @office/feishu-create-group@1.0.0
|
|
90
|
-
|
|
91
|
-
# Update a plugin to the latest version
|
|
92
|
-
fullstack-cli action-plugin update @office/feishu-create-group
|
|
93
|
-
|
|
94
|
-
# Remove a plugin
|
|
95
|
-
fullstack-cli action-plugin remove @office/feishu-create-group
|
|
96
|
-
|
|
97
|
-
# List installed plugins
|
|
98
|
-
fullstack-cli action-plugin list
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
**Command aliases:**
|
|
102
|
-
| Full command | Alias |
|
|
103
|
-
|----------|------|
|
|
104
|
-
| `action-plugin install` | `action-plugin i` |
|
|
105
|
-
| `action-plugin update` | `action-plugin up` |
|
|
106
|
-
| `action-plugin remove` | `action-plugin rm` |
|
|
107
|
-
| `action-plugin list` | `action-plugin ls` |
|
|
108
|
-
|
|
109
|
-
**Plugin storage:**
|
|
110
|
-
- Plugin files: `node_modules/<plugin-name>/` (the standard npm package location)
|
|
111
|
-
- Config file: `.capabilityrc.json` (records metadata of installed action plugins)
|
|
112
|
-
|
|
113
|
-
### 5. Capability config management
|
|
114
|
-
|
|
115
|
-
View and manage the capability configs in a project:
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
# List all capabilities (hydrated, with actions)
|
|
119
|
-
fullstack-cli capability list
|
|
120
|
-
|
|
121
|
-
# List all capabilities (raw config, not hydrated)
|
|
122
|
-
fullstack-cli capability list --summary
|
|
123
|
-
|
|
124
|
-
# Get the config of a specific capability
|
|
125
|
-
fullstack-cli capability list --id create_feishu_group_for_task
|
|
126
|
-
|
|
127
|
-
# Get the raw config of a specific capability
|
|
128
|
-
fullstack-cli capability list --id create_feishu_group_for_task --summary
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
**Capability hydration:**
|
|
132
|
-
- By default, hydrated capability configs are returned, including actions read from the plugin manifest
|
|
133
|
-
- Dynamic schemas are supported: schemas marked `{ dynamic: true }` in the manifest are generated at runtime
|
|
134
|
-
- Schema priority: `capability.paramsSchema > dynamic schema > static schema`
|
|
135
|
-
- If hydration fails, the raw config is returned with an `_hydrateError` field (no exception is thrown)
|
|
136
|
-
- `--summary` returns the raw config (the content stored in `server/capabilities/*.json`)
|
|
137
|
-
|
|
138
|
-
### 6. Capability migration
|
|
139
|
-
|
|
140
|
-
Migrate legacy capability configs (`capabilities.json`) to the new format (one JSON file per capability):
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
# Run the migration
|
|
144
|
-
fullstack-cli capability migration
|
|
145
|
-
|
|
146
|
-
# Preview mode (no files are changed)
|
|
147
|
-
fullstack-cli capability migration --dry-run
|
|
148
|
-
|
|
149
|
-
# Skip plugin installation
|
|
150
|
-
fullstack-cli capability migration --skip-install
|
|
151
|
-
|
|
152
|
-
# Skip code migration
|
|
153
|
-
fullstack-cli capability migration --skip-code
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
**Migration steps:**
|
|
157
|
-
|
|
158
|
-
1. **JSON file migration**
|
|
159
|
-
- Reads `server/capabilities.json` (legacy format: an array)
|
|
160
|
-
- Converts it into separate files `server/capabilities/<id>.json` (new format)
|
|
161
|
-
- Backs up the original file as `capabilities.json.backup`
|
|
162
|
-
|
|
163
|
-
2. **Plugin installation**
|
|
164
|
-
- Looks up the plugin through the `sourceActionID → pluginID` mapping table
|
|
165
|
-
- Calls `fullstack-cli action-plugin install` to install any missing plugins
|
|
166
|
-
|
|
167
|
-
3. **Code migration**
|
|
168
|
-
- Scans TypeScript files under `server/`
|
|
169
|
-
- Removes direct capability imports `import xxx from '@/capabilities/xxx'`
|
|
170
|
-
- Adds `CapabilityService` dependency injection
|
|
171
|
-
- Replaces call sites with `capabilityService.load('xxx').call('run', params)`
|
|
172
|
-
|
|
173
|
-
**Legacy format vs new format:**
|
|
174
|
-
|
|
175
|
-
```typescript
|
|
176
|
-
// Legacy format (capabilities.json)
|
|
177
|
-
{
|
|
178
|
-
"id": "create_group",
|
|
179
|
-
"sourceActionID": "feishu_group_create", // Legacy field
|
|
180
|
-
"name": "创建群组",
|
|
181
|
-
"desc": "创建飞书群组", // Legacy field
|
|
182
|
-
"actionInput": { ... }, // Legacy field
|
|
183
|
-
"inputSchema": { ... }
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// New format (server/capabilities/create_group.json)
|
|
187
|
-
{
|
|
188
|
-
"id": "create_group",
|
|
189
|
-
"pluginID": "@official/feishu-group", // New field
|
|
190
|
-
"pluginVersion": "1.0.0", // New field
|
|
191
|
-
"name": "创建群组",
|
|
192
|
-
"description": "创建飞书群组", // Renamed
|
|
193
|
-
"formValue": { ... }, // Renamed
|
|
194
|
-
"paramsSchema": { ... }
|
|
195
|
-
}
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
**Mapping file format:**
|
|
199
|
-
|
|
200
|
-
```json
|
|
201
|
-
{
|
|
202
|
-
"feishu_group_create": "@official/feishu-group",
|
|
203
|
-
"feishu_send_message": "@official/feishu-message"
|
|
204
|
-
}
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
### 7. Build tools
|
|
208
|
-
|
|
209
|
-
Get the STI artifact upload credentials needed by the build process:
|
|
210
|
-
|
|
211
|
-
```bash
|
|
212
|
-
# Pipeline release - commit-id is required
|
|
213
|
-
fullstack-cli build get-token --app-id app_xxx --scene pipeline --commit-id abc123
|
|
214
|
-
|
|
215
|
-
# Static asset deployment
|
|
216
|
-
fullstack-cli build get-token --app-id app_xxx --scene static
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
**Options:**
|
|
220
|
-
|
|
221
|
-
| Option | Required | Description |
|
|
222
|
-
|------|------|------|
|
|
223
|
-
| `--app-id <id>` | Yes | App ID |
|
|
224
|
-
| `--scene <scene>` | Yes | Build scene (`pipeline`, `static`) |
|
|
225
|
-
| `--commit-id <id>` | Required when scene=pipeline | Git commit ID |
|
|
226
|
-
|
|
227
|
-
**Output:** the full JSON returned by the API goes to stdout, while logs and errors go to stderr, so scripts can parse the result easily:
|
|
228
|
-
|
|
229
|
-
```bash
|
|
230
|
-
token_response=$(fullstack-cli build get-token --app-id "$APP_ID" --scene pipeline --commit-id "$COMMIT_ID")
|
|
231
|
-
credential=$(echo "$token_response" | jq -r '.data.accessKeyID')
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
**Environment variables:**
|
|
235
|
-
- `FORCE_AUTHN_INNERAPI_DOMAIN` — API domain
|
|
236
|
-
- `FORCE_AUTHN_ACCESS_KEY` — Access Key
|
|
237
|
-
- `FORCE_AUTHN_ACCESS_SECRET` — Secret Key
|
|
238
|
-
- `FORCE_FRAMEWORK_CLI_CANARY_ENV` — Canary environment (optional)
|
|
239
|
-
|
|
240
|
-
### 8. CLI commands
|
|
241
|
-
|
|
242
|
-
```bash
|
|
243
|
-
# Show help
|
|
244
|
-
fullstack-cli --help
|
|
245
|
-
|
|
246
|
-
# Generate the database schema
|
|
247
|
-
fullstack-cli gen-db-schema
|
|
248
|
-
|
|
249
|
-
# Generate OpenAPI
|
|
250
|
-
fullstack-cli gen-openapi
|
|
251
|
-
|
|
252
|
-
# Action plugin management
|
|
253
|
-
fullstack-cli action-plugin --help
|
|
254
|
-
fullstack-cli action-plugin install <plugin>
|
|
255
|
-
fullstack-cli action-plugin list
|
|
256
|
-
|
|
257
|
-
# Capability config management
|
|
258
|
-
fullstack-cli capability --help
|
|
259
|
-
fullstack-cli capability list
|
|
260
|
-
fullstack-cli capability migration --dry-run
|
|
261
|
-
|
|
262
|
-
# Build tools
|
|
263
|
-
fullstack-cli build --help
|
|
264
|
-
fullstack-cli build get-token --app-id <id> --scene <scene> [--commit-id <id>]
|
|
265
|
-
|
|
266
|
-
# Show the version
|
|
267
|
-
fullstack-cli --version
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
### 9. Global options
|
|
271
|
-
|
|
272
|
-
#### Canary environment
|
|
273
|
-
|
|
274
|
-
Use the `--canary` option to target a canary environment; it adds an `x-tt-env` header to HTTP requests:
|
|
275
|
-
|
|
276
|
-
```bash
|
|
277
|
-
# Pass it as a command-line option
|
|
278
|
-
fullstack-cli --canary boe_canary action-plugin install @office/feishu-create-group
|
|
279
|
-
|
|
280
|
-
# It can also go after the command
|
|
281
|
-
fullstack-cli action-plugin install @office/feishu-create-group --canary boe_canary
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
It can also be set with an environment variable:
|
|
285
|
-
|
|
286
|
-
```bash
|
|
287
|
-
FORCE_FRAMEWORK_CLI_CANARY_ENV=boe_canary fullstack-cli action-plugin install @office/feishu-create-group
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
## package.json Configuration
|
|
291
|
-
|
|
292
|
-
Add the following to your project's `package.json`:
|
|
293
|
-
|
|
294
|
-
```json
|
|
295
|
-
{
|
|
296
|
-
"scripts": {
|
|
297
|
-
"gen:db-schema": "fullstack-cli gen-db-schema",
|
|
298
|
-
"gen:openapi": "NODE_ENV=development DEPRECATED_SKIP_INIT_DB_CONNECTION=true fullstack-cli gen-openapi"
|
|
299
|
-
},
|
|
300
|
-
"devDependencies": {
|
|
301
|
-
"@lark-apaas/fullstack-cli": "^0.1.0",
|
|
302
|
-
"drizzle-kit": "^0.20.0" // If you use the database features
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
## Technical Details
|
|
308
|
-
|
|
309
|
-
### Sync configuration
|
|
310
|
-
|
|
311
|
-
Sync rules are defined in `src/postinstall.config.ts`:
|
|
312
|
-
|
|
313
|
-
```typescript
|
|
314
|
-
export default {
|
|
315
|
-
sync: [
|
|
316
|
-
{
|
|
317
|
-
from: 'templates/scripts',
|
|
318
|
-
to: 'scripts',
|
|
319
|
-
type: 'directory',
|
|
320
|
-
overwrite: true,
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
from: 'templates/.gitignore.append',
|
|
324
|
-
to: '.gitignore',
|
|
325
|
-
type: 'append',
|
|
326
|
-
},
|
|
327
|
-
],
|
|
328
|
-
permissions: {
|
|
329
|
-
'**/*.sh': 0o755,
|
|
330
|
-
},
|
|
331
|
-
};
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
### Drizzle configuration
|
|
335
|
-
|
|
336
|
-
The CLI ships a built-in `templates/drizzle.config.ts` that is configured dynamically through environment variables:
|
|
337
|
-
- You do **not** need to maintain `drizzle.config.ts`
|
|
338
|
-
- All settings are passed through environment variables
|
|
339
|
-
- Absolute paths point to your project
|
|
340
|
-
|
|
341
|
-
### OpenAPI generation
|
|
342
|
-
|
|
343
|
-
- Dynamically imports your `AppModule`
|
|
344
|
-
- Uses DevToolsModule from `@lark-apaas/fullstack-nestjs-core`
|
|
345
|
-
- Generates the client SDK automatically
|
|
346
|
-
|
|
347
|
-
## Dependencies
|
|
348
|
-
|
|
349
|
-
```
|
|
350
|
-
fullstack-cli
|
|
351
|
-
↓ depends on
|
|
352
|
-
@lark-apaas/devtool-kits (core logic)
|
|
353
|
-
|
|
354
|
-
Project peerDependencies:
|
|
355
|
-
- @nestjs/core (for gen-openapi)
|
|
356
|
-
- @lark-apaas/fullstack-nestjs-core (for gen-openapi)
|
|
357
|
-
- drizzle-kit (for gen-db-schema, optional)
|
|
358
|
-
```
|
|
359
|
-
|
|
360
|
-
## Upgrade Notes
|
|
361
|
-
|
|
362
|
-
### Migrating from older versions
|
|
363
|
-
|
|
364
|
-
**Files you can delete:**
|
|
365
|
-
- ❌ `scripts/gen-db-schema.ts` - now built into the CLI
|
|
366
|
-
- ❌ `scripts/gen-openapi.ts` - now built into the CLI
|
|
367
|
-
- ❌ `drizzle.config.ts` - now managed by the CLI
|
|
368
|
-
|
|
369
|
-
**Update package.json:**
|
|
370
|
-
```diff
|
|
371
|
-
{
|
|
372
|
-
"scripts": {
|
|
373
|
-
- "gen:db-schema": "ts-node scripts/gen-db-schema.ts",
|
|
374
|
-
+ "gen:db-schema": "fullstack-cli gen-db-schema",
|
|
375
|
-
- "gen:openapi": "nest start --entryFile ../scripts/gen-openapi",
|
|
376
|
-
+ "gen:openapi": "fullstack-cli gen-openapi"
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
```
|
|
380
|
-
|
|
381
|
-
### Capability migration
|
|
382
|
-
|
|
383
|
-
If your project uses the legacy capability system (a `capabilities.json` file), upgrade automatically with the migration command:
|
|
384
|
-
|
|
385
|
-
```bash
|
|
386
|
-
# 1. Preview the migration first
|
|
387
|
-
fullstack-cli capability migration --dry-run
|
|
388
|
-
|
|
389
|
-
# 2. Run the migration once it looks right
|
|
390
|
-
fullstack-cli capability migration
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
The migration automatically handles:
|
|
394
|
-
- Converting the JSON config file format
|
|
395
|
-
- Installing plugins
|
|
396
|
-
- Updating how code calls capabilities (from direct imports to CapabilityService injection)
|
|
397
|
-
|
|
398
|
-
## Brand, Settings and i18n
|
|
399
|
-
|
|
400
|
-
- **Settings read**: the selected settings’ `locale` through `createI18nForDev(messages)` from `@lark-apaas/miaoda-common-settings`, re-read on every output; the domestic configuration defaults to zh-CN. No domain settings are read:
|
|
401
|
-
- npm registry for `upgrade global-deps`: `--registry` → `MIAODA_NPM_REGISTRY` (injected by the deployment in overseas and other environments) → the built-in default registry;
|
|
402
|
-
- TOS `--endpoint` / `--region` for `build upload-static` are passed in by the caller (the build script) per deployment region.
|
|
403
|
-
- **Message language**: the CLI's callers are the Agent and platform pipelines, so its messages use the configured `locale` through `tDev`. This covers the `component` command help, logs and errors of the `build` and `component` commands, comments and Swagger descriptions generated into user code by `gen-db-schema --enable-nest-module-generate`, platform API errors and telemetry logs. Under the Feishu brand they are identical to those before the change. Output of the other commands was already English and does not change with the brand.
|
|
404
|
-
- **Verification**: `src/__test__/overseas-feishu-baseline.test.ts` (CN behavior unchanged), `src/__test__/overseas-lark.test.ts` (all English in JP).
|
|
405
|
-
|
|
406
|
-
## License
|
|
407
|
-
|
|
408
|
-
MIT
|
|
409
|
-
|
|
410
|
-
## MCP UI Checks and Syncing Existing Configs
|
|
411
|
-
|
|
412
|
-
When creating an MCP UI, the Agent generates both `tsconfig.json` and `eslint.config.cjs` in `server/mcp/ui`, and proactively runs standalone checks after changing the UI or its shared dependencies. Templates and the CLI do not generate UI configs, and UI checks are not wired into the main project's lint/type:check.
|
|
413
|
-
|
|
414
|
-
The main project keeps its existing client/server checks. From the project root, the Agent runs `npx --no-install tsc --noEmit --project server/mcp/ui/tsconfig.json`, then `npx --no-install eslint --config server/mcp/ui/eslint.config.cjs "server/mcp/ui/**/*.{ts,tsx,js,jsx}" --max-warnings 0`; it must check the exit codes and fix any errors. No helper script or new npm command is needed.
|
|
415
|
-
|
|
416
|
-
The CLI does not inject MCP UI check commands; the main project keeps its existing client/server checks, and the Agent runs standard tsc/eslint for the UI with its standalone configs.
|
|
417
|
-
|
|
418
|
-
Syncing existing projects does not rewrite ESLint sources; the global UI exclusion comes from the platform ESLint preset. For TS it only appends the directory to an existing explicit `exclude` array, keeping comments and existing entries; custom configs that rely on inheritance without an explicit `exclude` are left unchanged with a prompt to adjust them manually. Custom check commands are kept. lint.js and build.sh are still maintained by the platform script templates and don't depend on script entries in the preset package.
|