alemonjs 2.1.90 → 2.1.92

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/bin/publish.js CHANGED
@@ -2,7 +2,8 @@
2
2
  import fs from 'fs';
3
3
  import { join } from 'path';
4
4
  import os from 'os';
5
- import { execSync, spawnSync } from 'child_process';
5
+ import { execSync } from 'child_process';
6
+ import spawn from 'cross-spawn';
6
7
 
7
8
  const RELEASE_TYPES = new Set(['patch', 'minor', 'major', 'prepatch', 'preminor', 'premajor', 'prerelease']);
8
9
  const PRERELEASE_IDS = new Set(['alpha', 'beta', 'rc', 'next']);
@@ -24,7 +25,7 @@ function readPackageJson() {
24
25
  }
25
26
 
26
27
  function runCommand(command, args, options = {}) {
27
- const result = spawnSync(command, args, {
28
+ const result = spawn.sync(command, args, {
28
29
  cwd: process.cwd(),
29
30
  stdio: 'inherit',
30
31
  shell: false,
@@ -49,7 +50,7 @@ function getCommandOutput(command) {
49
50
  }
50
51
 
51
52
  function hasCommand(command) {
52
- const result = spawnSync(command, ['--version'], {
53
+ const result = spawn.sync(command, ['--version'], {
53
54
  cwd: process.cwd(),
54
55
  stdio: 'ignore'
55
56
  });
@@ -293,7 +294,7 @@ function getLatestReleaseVersion() {
293
294
  }
294
295
 
295
296
  function remoteBranchExists(branch) {
296
- const result = spawnSync('git', ['ls-remote', '--exit-code', '--heads', 'origin', branch], {
297
+ const result = spawn.sync('git', ['ls-remote', '--exit-code', '--heads', 'origin', branch], {
297
298
  cwd: process.cwd(),
298
299
  stdio: 'ignore'
299
300
  });
@@ -302,7 +303,7 @@ function remoteBranchExists(branch) {
302
303
  }
303
304
 
304
305
  function localBranchExists(branch) {
305
- const result = spawnSync('git', ['show-ref', '--verify', '--quiet', `refs/heads/${branch}`], {
306
+ const result = spawn.sync('git', ['show-ref', '--verify', '--quiet', `refs/heads/${branch}`], {
306
307
  cwd: process.cwd(),
307
308
  stdio: 'ignore'
308
309
  });
@@ -330,7 +331,7 @@ function cleanupWorktree(worktreeDir) {
330
331
  return;
331
332
  }
332
333
 
333
- spawnSync('git', ['worktree', 'remove', '--force', worktreeDir], {
334
+ spawn.sync('git', ['worktree', 'remove', '--force', worktreeDir], {
334
335
  cwd: process.cwd(),
335
336
  stdio: 'ignore'
336
337
  });
@@ -428,7 +429,7 @@ export async function publish(release, options = {}) {
428
429
  copyDirContents(publishDir, worktreeDir);
429
430
 
430
431
  runCommand('git', ['-C', worktreeDir, 'add', '-A']);
431
- const hasChanges = spawnSync('git', ['-C', worktreeDir, 'diff', '--cached', '--quiet']).status !== 0;
432
+ const hasChanges = spawn.sync('git', ['-C', worktreeDir, 'diff', '--cached', '--quiet']).status !== 0;
432
433
  if (!hasChanges) {
433
434
  console.log('release 分支无文件变化,跳过提交');
434
435
  } else {
@@ -437,8 +438,8 @@ export async function publish(release, options = {}) {
437
438
  console.log(`已推送到分支: ${releaseBranch}`);
438
439
  }
439
440
 
440
- runCommand('git', ['tag', '-f', gitTagName]);
441
- runCommand('git', ['push', 'origin', gitTagName, '--force']);
441
+ runCommand('git', ['-C', worktreeDir, 'tag', '-f', gitTagName]);
442
+ runCommand('git', ['-C', worktreeDir, 'push', 'origin', gitTagName, '--force']);
442
443
  console.log(`发布完成: ${packageName}@${targetVersion}`);
443
444
  } catch (error) {
444
445
  if (targetVersion !== localVersion) {
@@ -233,7 +233,9 @@ const handleMessage = (manager, message) => {
233
233
  lastAppReadyAt: now,
234
234
  bootTimings: {
235
235
  ...moduleState.bootTimings,
236
- transportReadyToAppReadyMs: moduleState.lastTransportReadyAt ? now - moduleState.lastTransportReadyAt : moduleState.bootTimings.transportReadyToAppReadyMs
236
+ transportReadyToAppReadyMs: moduleState.lastTransportReadyAt
237
+ ? now - moduleState.lastTransportReadyAt
238
+ : moduleState.bootTimings.transportReadyToAppReadyMs
237
239
  }
238
240
  };
239
241
  return;
@@ -270,7 +270,9 @@ const handleMessage = (manager, message) => {
270
270
  lastAppReadyAt: now,
271
271
  bootTimings: {
272
272
  ...platformState.bootTimings,
273
- transportReadyToAppReadyMs: platformState.lastTransportReadyAt ? now - platformState.lastTransportReadyAt : platformState.bootTimings.transportReadyToAppReadyMs
273
+ transportReadyToAppReadyMs: platformState.lastTransportReadyAt
274
+ ? now - platformState.lastTransportReadyAt
275
+ : platformState.bootTimings.transportReadyToAppReadyMs
274
276
  }
275
277
  };
276
278
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alemonjs",
3
- "version": "2.1.90",
3
+ "version": "2.1.92",
4
4
  "description": "bot script",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",
@@ -52,6 +52,7 @@
52
52
  "chalk": "^5.6.2",
53
53
  "commander": "^13.1.0",
54
54
  "cron": "^4.4.0",
55
+ "cross-spawn": "^7.0.6",
55
56
  "file-type": "21.0.0",
56
57
  "flatted": "^3.3.3",
57
58
  "koa": "^3.0.1",