@vitarx/release-cli 1.0.0-alpha.0 → 1.0.0-alpha.1

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 CHANGED
@@ -184,7 +184,7 @@ async function publishPackage(pkgDir, packageManager, isDryRun = false, args) {
184
184
  // -------------------- Step 8: 推送代码和标签到远程仓库 --------------------
185
185
  log.info('⬆️ Pushing to remote...');
186
186
  try {
187
- runCommand(`git push${tagName ? '&& git push --tags' : ''}`, isDryRun);
187
+ runCommand(`git push${tagName ? ' && git push --tags' : ''}`, isDryRun);
188
188
  }
189
189
  catch {
190
190
  log.warn('包已发布到pnm,但推送代码和标签到远程仓库意外失败,请仔细核查npm仓库和远程仓库状态。');
package/dist/utils.js CHANGED
@@ -197,8 +197,14 @@ export function getWorkspacePackages() {
197
197
  try {
198
198
  // 读取根目录的package.json文件
199
199
  const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
200
- // 获取workspaces配置,如果没有则为空数组
201
- const workspaces = pkg.workspaces || [];
200
+ // 获取workspaces配置,支持数组格式和对象格式(包含packages数组)
201
+ let workspaces = [];
202
+ if (Array.isArray(pkg.workspaces)) {
203
+ workspaces = pkg.workspaces;
204
+ }
205
+ else if (pkg.workspaces && Array.isArray(pkg.workspaces.packages)) {
206
+ workspaces = pkg.workspaces.packages;
207
+ }
202
208
  // 遍历所有workspace模式
203
209
  for (const workspacePattern of workspaces) {
204
210
  // 获取所有目录
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitarx/release-cli",
3
- "version": "1.0.0-alpha.0",
3
+ "version": "1.0.0-alpha.1",
4
4
  "description": "A CLI tool for automated npm package release with workspace support",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",