@lark-apaas/fullstack-cli 1.1.2 → 1.1.3
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/commands/sync.d.ts
CHANGED
package/dist/commands/sync.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import {
|
|
4
|
+
import { genSyncConfig } from '../config/sync.js';
|
|
5
5
|
/**
|
|
6
6
|
* 同步模板文件到用户项目
|
|
7
7
|
*/
|
|
8
|
-
export async function run() {
|
|
8
|
+
export async function run(options) {
|
|
9
9
|
// 检测是否在用户项目中(通过 INIT_CWD 判断)
|
|
10
10
|
const userProjectRoot = process.env.INIT_CWD || process.cwd();
|
|
11
11
|
// 获取插件根目录
|
|
@@ -26,7 +26,9 @@ export async function run() {
|
|
|
26
26
|
try {
|
|
27
27
|
console.log('[fullstack-cli] Starting sync...');
|
|
28
28
|
// 使用配置
|
|
29
|
-
const config =
|
|
29
|
+
const config = genSyncConfig({
|
|
30
|
+
disableGenOpenapi: options.disableGenOpenapi ?? false,
|
|
31
|
+
});
|
|
30
32
|
if (!config || !config.sync) {
|
|
31
33
|
console.warn('[fullstack-cli] No sync configuration found');
|
|
32
34
|
process.exit(0);
|
package/dist/config/sync.d.ts
CHANGED
package/dist/config/sync.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* fullstack-cli 派生配置
|
|
3
3
|
* 定义哪些文件/目录需要同步到用户项目
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
const syncConfig = {
|
|
6
6
|
// 派生规则
|
|
7
7
|
sync: [
|
|
8
8
|
// 1. 派生 scripts 目录(总是覆盖)
|
|
@@ -31,3 +31,14 @@ export const syncConfig = {
|
|
|
31
31
|
// '**/*.sh': 0o755,
|
|
32
32
|
},
|
|
33
33
|
};
|
|
34
|
+
export function genSyncConfig(perms = {}) {
|
|
35
|
+
if (!perms.disableGenOpenapi) {
|
|
36
|
+
syncConfig.sync.push({
|
|
37
|
+
from: 'templates/helper/gen-openapi.ts',
|
|
38
|
+
to: 'scripts/gen-openapi.ts',
|
|
39
|
+
type: 'file',
|
|
40
|
+
overwrite: true,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return syncConfig;
|
|
44
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -38,10 +38,11 @@ cli
|
|
|
38
38
|
// sync 命令
|
|
39
39
|
cli
|
|
40
40
|
.command('sync', 'Sync template files (scripts, configs) to user project')
|
|
41
|
+
.option('--disable-gen-openapi', 'Disable generating openapi.ts')
|
|
41
42
|
.example('fullstack-cli sync')
|
|
42
|
-
.action(async () => {
|
|
43
|
+
.action(async (options) => {
|
|
43
44
|
try {
|
|
44
|
-
await runSync();
|
|
45
|
+
await runSync(options);
|
|
45
46
|
}
|
|
46
47
|
catch (error) {
|
|
47
48
|
console.error(`Failed to execute command:`, error.message);
|
package/package.json
CHANGED
|
File without changes
|