@vitarx/release-cli 1.0.3 → 1.0.4
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/release.js +18 -5
- package/package.json +1 -1
package/dist/release.js
CHANGED
|
@@ -272,16 +272,29 @@ export async function main() {
|
|
|
272
272
|
process.exit(0);
|
|
273
273
|
}
|
|
274
274
|
const isDryRun = args.isDryRun;
|
|
275
|
-
// 如果有未提交的更改,则报错退出
|
|
276
|
-
if (!isDryRun && !checkGitStatus()) {
|
|
277
|
-
log.error('请先提交或暂存当前更改再发布。');
|
|
278
|
-
process.exit(1);
|
|
279
|
-
}
|
|
280
275
|
const packageManager = detectPackageManager();
|
|
281
276
|
const isWorkspace = isWorkspaceProject();
|
|
282
277
|
log.info('当前包管理器', packageManager);
|
|
283
278
|
log.info('当前工作目录', process.cwd());
|
|
284
279
|
log.info('当前运行模式', isDryRun ? 'dry-run' : 'publish');
|
|
280
|
+
const isSubmit = checkGitStatus();
|
|
281
|
+
log.info('当前工作目录状态', isSubmit ? '已提交' : '未提交');
|
|
282
|
+
// 如果有未提交的更改,则报错退出
|
|
283
|
+
if (!isDryRun && !isSubmit) {
|
|
284
|
+
log.error('请先提交或暂存当前更改再发布。');
|
|
285
|
+
process.exit(1);
|
|
286
|
+
}
|
|
287
|
+
log.info('检查npm登录状态...↙️');
|
|
288
|
+
try {
|
|
289
|
+
runCommand(`npm whoami --registry https://registry.npmjs.org/`);
|
|
290
|
+
}
|
|
291
|
+
catch (err) {
|
|
292
|
+
if (err?.stderr) {
|
|
293
|
+
log.error(err?.stderr.toString()); // 输出 npm 的错误提示
|
|
294
|
+
}
|
|
295
|
+
log.error('您未登录 npm。请先运行:npm login --registry https://registry.npmjs.org/');
|
|
296
|
+
process.exit(1);
|
|
297
|
+
}
|
|
285
298
|
if (isWorkspace) {
|
|
286
299
|
log.info('检测到 workspace 项目');
|
|
287
300
|
const packages = getWorkspacePackages();
|