@whyshu/argent 0.1.3 → 0.1.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/bin/argent.mjs +13 -4
- package/lib/index.mjs +2 -2
- package/package.json +1 -1
package/bin/argent.mjs
CHANGED
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
* 公共参数:--dsh-home <dir> --profile <name> --repo <dir> --json --dry-run
|
|
11
11
|
*/
|
|
12
12
|
import { spawn } from 'node:child_process';
|
|
13
|
-
import { mkdirSync, writeFileSync, rmSync, existsSync } from 'node:fs';
|
|
14
|
-
import { join } from 'node:path';
|
|
13
|
+
import { mkdirSync, writeFileSync, rmSync, existsSync, copyFileSync, chmodSync } from 'node:fs';
|
|
14
|
+
import { join, dirname } from 'node:path';
|
|
15
15
|
import { homedir } from 'node:os';
|
|
16
16
|
import {
|
|
17
|
-
DSH_EXACT_VERSION, PROFILE_NAME, PROD_BUNDLES, buildLaunchdPlist, buildProfile, dshHomeOf,
|
|
17
|
+
DSH_EXACT_VERSION, PROFILE_NAME, PROD_BUNDLES, buildLaunchdPlist, buildProfile, dshHomeOf, runnerScriptPath,
|
|
18
18
|
depsInstalled, health, installDeps, loginWithPhone, pairRunner, probeDshVersion, readAuthToken, repoRoot, runnerConfigPath, sendLoginCode, versionMatches,
|
|
19
19
|
} from '../lib/index.mjs';
|
|
20
20
|
|
|
@@ -161,7 +161,16 @@ function setupCommand() {
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
function serviceCommand(sub) {
|
|
164
|
-
const
|
|
164
|
+
const bundled = runnerScriptPath({ repo: opts.repo });
|
|
165
|
+
// 固定 runner 路径:复制进 DSH_HOME,避免 launchd 指向 npx 临时缓存(缓存清理后失效)
|
|
166
|
+
const stableRunner = join(opts.dshHome, 'argent', 'runner', 'argent-runner.mjs');
|
|
167
|
+
const runnerPath = bundled ? stableRunner : '';
|
|
168
|
+
const plist = buildLaunchdPlist({ dshHome: opts.dshHome, repo: opts.repo, runnerPath });
|
|
169
|
+
if (sub === 'install' && bundled && !has('--print-only')) {
|
|
170
|
+
mkdirSync(dirname(stableRunner), { recursive: true });
|
|
171
|
+
copyFileSync(bundled, stableRunner);
|
|
172
|
+
chmodSync(stableRunner, 0o755);
|
|
173
|
+
}
|
|
165
174
|
const outDir = val('--plist-dir', '');
|
|
166
175
|
const targetDir = outDir || join(homedir(), 'Library', 'LaunchAgents');
|
|
167
176
|
const target = join(targetDir, plist.file);
|
package/lib/index.mjs
CHANGED
|
@@ -190,8 +190,8 @@ export function runnerScriptPath({ repo = repoRoot() } = {}) {
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
/** P4 runner 的 launchd plist(macOS);Linux 可换 systemd unit(TODO 发布前补) */
|
|
193
|
-
export function buildLaunchdPlist({ dshHome = dshHomeOf(), repo = repoRoot(), nodeBin = process.execPath } = {}) {
|
|
194
|
-
const script = runnerScriptPath({ repo });
|
|
193
|
+
export function buildLaunchdPlist({ dshHome = dshHomeOf(), repo = repoRoot(), nodeBin = process.execPath, runnerPath = '' } = {}) {
|
|
194
|
+
const script = runnerPath || runnerScriptPath({ repo });
|
|
195
195
|
const logDir = join(dshHome, 'argent', 'runner', 'logs');
|
|
196
196
|
return {
|
|
197
197
|
file: `${RUNNER_LABEL}.plist`,
|