@coze-arch/cli 0.0.15 → 0.0.16
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__/templates.json +37 -0
- package/lib/cli.js +37 -9
- package/package.json +1 -1
|
@@ -126,6 +126,43 @@
|
|
|
126
126
|
"additionalProperties": false
|
|
127
127
|
}
|
|
128
128
|
},
|
|
129
|
+
{
|
|
130
|
+
"name": "test-only",
|
|
131
|
+
"description": "Test template showcasing all template hooks and features",
|
|
132
|
+
"location": "./test-only",
|
|
133
|
+
"paramsSchema": {
|
|
134
|
+
"type": "object",
|
|
135
|
+
"properties": {
|
|
136
|
+
"appName": {
|
|
137
|
+
"type": "string",
|
|
138
|
+
"minLength": 1,
|
|
139
|
+
"pattern": "^[a-z0-9-]+$",
|
|
140
|
+
"description": "Application name (lowercase, alphanumeric and hyphens only)"
|
|
141
|
+
},
|
|
142
|
+
"port": {
|
|
143
|
+
"type": "number",
|
|
144
|
+
"default": 5000,
|
|
145
|
+
"minimum": 1024,
|
|
146
|
+
"maximum": 65535,
|
|
147
|
+
"description": "Development server port"
|
|
148
|
+
},
|
|
149
|
+
"includeTests": {
|
|
150
|
+
"type": "boolean",
|
|
151
|
+
"default": true,
|
|
152
|
+
"nullable": true,
|
|
153
|
+
"description": "Include test files"
|
|
154
|
+
},
|
|
155
|
+
"addCopyright": {
|
|
156
|
+
"type": "boolean",
|
|
157
|
+
"default": false,
|
|
158
|
+
"nullable": true,
|
|
159
|
+
"description": "Add copyright header to source files"
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
"required": [],
|
|
163
|
+
"additionalProperties": false
|
|
164
|
+
}
|
|
165
|
+
},
|
|
129
166
|
{
|
|
130
167
|
"name": "vite",
|
|
131
168
|
"description": "Vite(简单项目):`coze init ${COZE_WORKSPACE_PATH} --template vite`\n- 适用:轻量级 SPA、纯前端交互、仪表盘等轻量级项目。",
|
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";
|
|
2111
2111
|
var description = "coze coding devtools cli";
|
|
2112
2112
|
var license = "MIT";
|
|
2113
2113
|
var author = "fanwenjie.fe@bytedance.com";
|
|
@@ -7997,8 +7997,18 @@ const registerCommand$2 = program => {
|
|
|
7997
7997
|
});
|
|
7998
7998
|
};
|
|
7999
7999
|
|
|
8000
|
+
const d = debug('coze-init-cli:check-bins');
|
|
8001
|
+
|
|
8002
|
+
|
|
8003
|
+
|
|
8004
|
+
|
|
8005
|
+
|
|
8006
|
+
|
|
8007
|
+
|
|
8000
8008
|
const checkBins = async (cwd, fix) => {
|
|
8001
|
-
|
|
8009
|
+
d('starting check, cwd=%s fix=%s', cwd, fix);
|
|
8010
|
+
|
|
8011
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- fallback {} ensures non-null
|
|
8002
8012
|
const pkgJson = safeJsonParse
|
|
8003
8013
|
|
|
8004
8014
|
|
|
@@ -8009,7 +8019,10 @@ const checkBins = async (cwd, fix) => {
|
|
|
8009
8019
|
...pkgJson.devDependencies,
|
|
8010
8020
|
});
|
|
8011
8021
|
|
|
8022
|
+
d('found %d total dependencies to scan', allDeps.length);
|
|
8023
|
+
|
|
8012
8024
|
const binDir = path.join(cwd, 'node_modules', '.bin');
|
|
8025
|
+
d('bin directory: %s', binDir);
|
|
8013
8026
|
const missing = [];
|
|
8014
8027
|
|
|
8015
8028
|
await Promise.all(
|
|
@@ -8020,13 +8033,16 @@ const checkBins = async (cwd, fix) => {
|
|
|
8020
8033
|
path.join(cwd, 'node_modules', depName, 'package.json'),
|
|
8021
8034
|
'utf8',
|
|
8022
8035
|
);
|
|
8023
|
-
} catch (
|
|
8036
|
+
} catch (err) {
|
|
8037
|
+
d('dep %s not found in node_modules: %s', depName, err);
|
|
8038
|
+
missing.push({ dep: depName, bin: '', reason: 'missing-package' });
|
|
8024
8039
|
return;
|
|
8025
8040
|
}
|
|
8026
8041
|
const depPkg = safeJsonParse(
|
|
8027
8042
|
rawContent,
|
|
8028
8043
|
);
|
|
8029
8044
|
if (!depPkg) {
|
|
8045
|
+
d('skipping %s: failed to parse package.json', depName);
|
|
8030
8046
|
return;
|
|
8031
8047
|
}
|
|
8032
8048
|
|
|
@@ -8036,22 +8052,28 @@ const checkBins = async (cwd, fix) => {
|
|
|
8036
8052
|
|
|
8037
8053
|
const bins =
|
|
8038
8054
|
typeof depPkg.bin === 'string'
|
|
8039
|
-
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
8055
|
+
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- split always has ≥1 element
|
|
8040
8056
|
{ [depName.split('/').pop()]: depPkg.bin }
|
|
8041
8057
|
: depPkg.bin;
|
|
8042
8058
|
|
|
8059
|
+
d('%s declares bins: %o', depName, Object.keys(bins));
|
|
8060
|
+
|
|
8043
8061
|
await Promise.all(
|
|
8044
8062
|
Object.keys(bins).map(async binName => {
|
|
8045
8063
|
try {
|
|
8046
8064
|
await fs$1.access(path.join(binDir, binName));
|
|
8047
|
-
|
|
8048
|
-
|
|
8065
|
+
d('bin present: %s', binName);
|
|
8066
|
+
} catch (err) {
|
|
8067
|
+
d('bin missing: %s (from %s): %s', binName, depName, err);
|
|
8068
|
+
missing.push({ dep: depName, bin: binName, reason: 'missing-bin' });
|
|
8049
8069
|
}
|
|
8050
8070
|
}),
|
|
8051
8071
|
);
|
|
8052
8072
|
}),
|
|
8053
8073
|
);
|
|
8054
8074
|
|
|
8075
|
+
d('scan complete, missing=%d', missing.length);
|
|
8076
|
+
|
|
8055
8077
|
if (missing.length === 0) {
|
|
8056
8078
|
logger.success(
|
|
8057
8079
|
'check-bins: all bin entries present, skipping force install.',
|
|
@@ -8059,9 +8081,13 @@ const checkBins = async (cwd, fix) => {
|
|
|
8059
8081
|
return;
|
|
8060
8082
|
}
|
|
8061
8083
|
|
|
8062
|
-
logger.warn('check-bins: missing
|
|
8063
|
-
for (const { dep, bin } of missing) {
|
|
8064
|
-
|
|
8084
|
+
logger.warn('check-bins: missing or broken dependencies detected:');
|
|
8085
|
+
for (const { dep, bin, reason } of missing) {
|
|
8086
|
+
if (reason === 'missing-package') {
|
|
8087
|
+
logger.warn(` ${dep} -> (package not found in node_modules)`);
|
|
8088
|
+
} else {
|
|
8089
|
+
logger.warn(` ${dep} -> .bin/${bin}`);
|
|
8090
|
+
}
|
|
8065
8091
|
}
|
|
8066
8092
|
|
|
8067
8093
|
if (!fix) {
|
|
@@ -8072,7 +8098,9 @@ const checkBins = async (cwd, fix) => {
|
|
|
8072
8098
|
}
|
|
8073
8099
|
|
|
8074
8100
|
logger.info('check-bins: running pnpm i --force to fix...');
|
|
8101
|
+
d('executing: pnpm i --force');
|
|
8075
8102
|
child_process.execSync('pnpm i --force', { stdio: 'inherit', cwd });
|
|
8103
|
+
d('pnpm i --force completed');
|
|
8076
8104
|
};
|
|
8077
8105
|
|
|
8078
8106
|
const registerCommand$1 = program => {
|