@coze-arch/cli 0.0.15 → 0.0.16-alpha.ffa44d
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/lib/__templates__/expo/.coze +1 -0
- package/lib/__templates__/expo/.cozeproj/scripts/validate.sh +8 -0
- package/lib/__templates__/expo/package.json +2 -1
- package/lib/__templates__/nextjs/.coze +1 -0
- package/lib/__templates__/nextjs/package.json +3 -1
- package/lib/__templates__/nextjs/scripts/validate.sh +10 -0
- package/lib/__templates__/nuxt-vue/.coze +1 -0
- package/lib/__templates__/nuxt-vue/eslint.config.mjs +25 -0
- package/lib/__templates__/nuxt-vue/package.json +9 -2
- package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +790 -10
- package/lib/__templates__/nuxt-vue/scripts/validate.sh +10 -0
- package/lib/__templates__/taro/.coze +1 -0
- package/lib/__templates__/taro/.cozeproj/scripts/validate.sh +8 -0
- package/lib/__templates__/taro/package.json +1 -1
- package/lib/__templates__/vite/.coze +1 -0
- package/lib/__templates__/vite/package.json +3 -1
- package/lib/__templates__/vite/scripts/validate.sh +10 -0
- package/lib/cli.js +49 -10
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ build = ["bash", ".cozeproj/scripts/dev_build.sh"]
|
|
|
7
7
|
run = ["bash", ".cozeproj/scripts/dev_run.sh"]
|
|
8
8
|
deps = ["git"] # -> apt install git
|
|
9
9
|
pack = ["bash", ".cozeproj/scripts/pack.sh"]
|
|
10
|
+
validate = ["bash", ".cozeproj/scripts/validate.sh"]
|
|
10
11
|
|
|
11
12
|
[deploy]
|
|
12
13
|
build = ["bash", ".cozeproj/scripts/deploy_build.sh"]
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"postinstall": "weapp-tw patch",
|
|
20
20
|
"kill:all": "pkill -9 -f 'concurrently' 2>/dev/null || true; pkill -9 -f 'nest start' 2>/dev/null || true; pkill -9 -f 'taro build' 2>/dev/null || true; pkill -9 -f 'node.*dev' 2>/dev/null || true; echo 'All dev processes cleaned'",
|
|
21
21
|
"lint": "eslint \"src/**/*.{js,jsx,ts,tsx,css}\"",
|
|
22
|
-
"lint:build": "eslint \"src/**/*.{js,jsx,ts,tsx,css}\" --max-warnings=0",
|
|
22
|
+
"lint:build": "eslint \"src/**/*.{js,jsx,ts,tsx,css}\" --max-warnings=0 --quiet",
|
|
23
23
|
"lint:fix": "eslint \"src/**/*.{js,jsx,ts,tsx,css}\" --fix",
|
|
24
24
|
"new": "taro new",
|
|
25
25
|
"preview:tt": "taro build --type tt --preview",
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
"dev": "bash ./scripts/dev.sh",
|
|
8
8
|
"preinstall": "npx only-allow pnpm",
|
|
9
9
|
"lint": "eslint",
|
|
10
|
+
"lint:build": "eslint . --quiet",
|
|
10
11
|
"start": "bash ./scripts/start.sh",
|
|
11
|
-
"ts-check": "tsc -p tsconfig.json"
|
|
12
|
+
"ts-check": "tsc -p tsconfig.json",
|
|
13
|
+
"validate": "pnpm run --parallel '/^(ts-check|lint:build)$/'"
|
|
12
14
|
},
|
|
13
15
|
"dependencies": {
|
|
14
16
|
"@supabase/supabase-js": "2.95.3",
|
package/lib/cli.js
CHANGED
|
@@ -2107,7 +2107,7 @@ const EventBuilder = {
|
|
|
2107
2107
|
};
|
|
2108
2108
|
|
|
2109
2109
|
var name = "@coze-arch/cli";
|
|
2110
|
-
var version = "0.0.
|
|
2110
|
+
var version = "0.0.16-alpha.ffa44d";
|
|
2111
2111
|
var description = "coze coding devtools cli";
|
|
2112
2112
|
var license = "MIT";
|
|
2113
2113
|
var author = "fanwenjie.fe@bytedance.com";
|
|
@@ -5985,7 +5985,6 @@ const getCommandConfig = (
|
|
|
5985
5985
|
) => {
|
|
5986
5986
|
let commandConfig;
|
|
5987
5987
|
|
|
5988
|
-
// 根据命令名称映射到配置路径
|
|
5989
5988
|
switch (commandName) {
|
|
5990
5989
|
case 'dev':
|
|
5991
5990
|
commandConfig = _optionalChain$4([config, 'access', _ => _.dev, 'optionalAccess', _2 => _2.run]);
|
|
@@ -5996,6 +5995,9 @@ const getCommandConfig = (
|
|
|
5996
5995
|
case 'start':
|
|
5997
5996
|
commandConfig = _optionalChain$4([config, 'access', _5 => _5.deploy, 'optionalAccess', _6 => _6.run]);
|
|
5998
5997
|
break;
|
|
5998
|
+
case 'validate':
|
|
5999
|
+
commandConfig = _optionalChain$4([config, 'access', _7 => _7.dev, 'optionalAccess', _8 => _8.validate]);
|
|
6000
|
+
break;
|
|
5999
6001
|
default:
|
|
6000
6002
|
throw new Error(`Unknown command: ${commandName}`);
|
|
6001
6003
|
}
|
|
@@ -7100,6 +7102,15 @@ const registerCommand$3 = program => {
|
|
|
7100
7102
|
.action(async options => {
|
|
7101
7103
|
await executeRun('start', options);
|
|
7102
7104
|
});
|
|
7105
|
+
|
|
7106
|
+
// validate 命令
|
|
7107
|
+
program
|
|
7108
|
+
.command('validate')
|
|
7109
|
+
.description('Validate project (lint + type check)')
|
|
7110
|
+
.option('--log-file <path>', 'Log file path')
|
|
7111
|
+
.action(async options => {
|
|
7112
|
+
await executeRun('validate', options);
|
|
7113
|
+
});
|
|
7103
7114
|
};
|
|
7104
7115
|
|
|
7105
7116
|
// ABOUTME: Nuxt route scanner
|
|
@@ -7997,8 +8008,18 @@ const registerCommand$2 = program => {
|
|
|
7997
8008
|
});
|
|
7998
8009
|
};
|
|
7999
8010
|
|
|
8011
|
+
const d = debug('coze-init-cli:check-bins');
|
|
8012
|
+
|
|
8013
|
+
|
|
8014
|
+
|
|
8015
|
+
|
|
8016
|
+
|
|
8017
|
+
|
|
8018
|
+
|
|
8000
8019
|
const checkBins = async (cwd, fix) => {
|
|
8001
|
-
|
|
8020
|
+
d('starting check, cwd=%s fix=%s', cwd, fix);
|
|
8021
|
+
|
|
8022
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- fallback {} ensures non-null
|
|
8002
8023
|
const pkgJson = safeJsonParse
|
|
8003
8024
|
|
|
8004
8025
|
|
|
@@ -8009,7 +8030,10 @@ const checkBins = async (cwd, fix) => {
|
|
|
8009
8030
|
...pkgJson.devDependencies,
|
|
8010
8031
|
});
|
|
8011
8032
|
|
|
8033
|
+
d('found %d total dependencies to scan', allDeps.length);
|
|
8034
|
+
|
|
8012
8035
|
const binDir = path.join(cwd, 'node_modules', '.bin');
|
|
8036
|
+
d('bin directory: %s', binDir);
|
|
8013
8037
|
const missing = [];
|
|
8014
8038
|
|
|
8015
8039
|
await Promise.all(
|
|
@@ -8020,13 +8044,16 @@ const checkBins = async (cwd, fix) => {
|
|
|
8020
8044
|
path.join(cwd, 'node_modules', depName, 'package.json'),
|
|
8021
8045
|
'utf8',
|
|
8022
8046
|
);
|
|
8023
|
-
} catch (
|
|
8047
|
+
} catch (err) {
|
|
8048
|
+
d('dep %s not found in node_modules: %s', depName, err);
|
|
8049
|
+
missing.push({ dep: depName, bin: '', reason: 'missing-package' });
|
|
8024
8050
|
return;
|
|
8025
8051
|
}
|
|
8026
8052
|
const depPkg = safeJsonParse(
|
|
8027
8053
|
rawContent,
|
|
8028
8054
|
);
|
|
8029
8055
|
if (!depPkg) {
|
|
8056
|
+
d('skipping %s: failed to parse package.json', depName);
|
|
8030
8057
|
return;
|
|
8031
8058
|
}
|
|
8032
8059
|
|
|
@@ -8036,22 +8063,28 @@ const checkBins = async (cwd, fix) => {
|
|
|
8036
8063
|
|
|
8037
8064
|
const bins =
|
|
8038
8065
|
typeof depPkg.bin === 'string'
|
|
8039
|
-
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
8066
|
+
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- split always has ≥1 element
|
|
8040
8067
|
{ [depName.split('/').pop()]: depPkg.bin }
|
|
8041
8068
|
: depPkg.bin;
|
|
8042
8069
|
|
|
8070
|
+
d('%s declares bins: %o', depName, Object.keys(bins));
|
|
8071
|
+
|
|
8043
8072
|
await Promise.all(
|
|
8044
8073
|
Object.keys(bins).map(async binName => {
|
|
8045
8074
|
try {
|
|
8046
8075
|
await fs$1.access(path.join(binDir, binName));
|
|
8047
|
-
|
|
8048
|
-
|
|
8076
|
+
d('bin present: %s', binName);
|
|
8077
|
+
} catch (err) {
|
|
8078
|
+
d('bin missing: %s (from %s): %s', binName, depName, err);
|
|
8079
|
+
missing.push({ dep: depName, bin: binName, reason: 'missing-bin' });
|
|
8049
8080
|
}
|
|
8050
8081
|
}),
|
|
8051
8082
|
);
|
|
8052
8083
|
}),
|
|
8053
8084
|
);
|
|
8054
8085
|
|
|
8086
|
+
d('scan complete, missing=%d', missing.length);
|
|
8087
|
+
|
|
8055
8088
|
if (missing.length === 0) {
|
|
8056
8089
|
logger.success(
|
|
8057
8090
|
'check-bins: all bin entries present, skipping force install.',
|
|
@@ -8059,9 +8092,13 @@ const checkBins = async (cwd, fix) => {
|
|
|
8059
8092
|
return;
|
|
8060
8093
|
}
|
|
8061
8094
|
|
|
8062
|
-
logger.warn('check-bins: missing
|
|
8063
|
-
for (const { dep, bin } of missing) {
|
|
8064
|
-
|
|
8095
|
+
logger.warn('check-bins: missing or broken dependencies detected:');
|
|
8096
|
+
for (const { dep, bin, reason } of missing) {
|
|
8097
|
+
if (reason === 'missing-package') {
|
|
8098
|
+
logger.warn(` ${dep} -> (package not found in node_modules)`);
|
|
8099
|
+
} else {
|
|
8100
|
+
logger.warn(` ${dep} -> .bin/${bin}`);
|
|
8101
|
+
}
|
|
8065
8102
|
}
|
|
8066
8103
|
|
|
8067
8104
|
if (!fix) {
|
|
@@ -8072,7 +8109,9 @@ const checkBins = async (cwd, fix) => {
|
|
|
8072
8109
|
}
|
|
8073
8110
|
|
|
8074
8111
|
logger.info('check-bins: running pnpm i --force to fix...');
|
|
8112
|
+
d('executing: pnpm i --force');
|
|
8075
8113
|
child_process.execSync('pnpm i --force', { stdio: 'inherit', cwd });
|
|
8114
|
+
d('pnpm i --force completed');
|
|
8076
8115
|
};
|
|
8077
8116
|
|
|
8078
8117
|
const registerCommand$1 = program => {
|