happy-imou-cloud 2.0.22 → 2.0.23
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/happy-cloud.mjs +1 -1
- package/dist/{BaseReasoningProcessor-CJVv1aNR.cjs → BaseReasoningProcessor-BzbDRBqp.cjs} +3 -3
- package/dist/{BaseReasoningProcessor-mIqqngd3.mjs → BaseReasoningProcessor-DH3BCCTf.mjs} +3 -3
- package/dist/{ProviderSelectionHandler-BjLyIfSR.mjs → ProviderSelectionHandler-CbkbtIRC.mjs} +2 -2
- package/dist/{ProviderSelectionHandler-e4zL4Y5_.cjs → ProviderSelectionHandler-meVvz9NZ.cjs} +2 -2
- package/dist/{api-DP-RQUao.cjs → api-C4bF6GEA.cjs} +24 -2
- package/dist/{api-DrijKeDb.mjs → api-DX7Vg4Hz.mjs} +24 -2
- package/dist/{command-BZphfJrt.cjs → command-CF6Wi_v2.cjs} +3 -3
- package/dist/{command--vV6BSsL.mjs → command-DicPZ-Up.mjs} +3 -3
- package/dist/{index-CqCEZDFi.cjs → index-BybqdOf2.cjs} +63 -15
- package/dist/{index-BIki80pQ.mjs → index-CEJmASSW.mjs} +60 -12
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.cts +95 -92
- package/dist/lib.d.mts +95 -92
- package/dist/lib.mjs +1 -1
- package/dist/{persistence-yVTbf_Ng.cjs → persistence-CdqBfAwo.cjs} +1 -1
- package/dist/{persistence-C3NBdZdz.mjs → persistence-xypxp7ei.mjs} +1 -1
- package/dist/{registerKillSessionHandler-QmBN446A.cjs → registerKillSessionHandler-BK3fZIch.cjs} +14 -11
- package/dist/{registerKillSessionHandler-CHEj7UjN.mjs → registerKillSessionHandler-BNN-_qNu.mjs} +14 -11
- package/dist/{runClaude-D0DD_Ya5.mjs → runClaude-B-ex_tr3.mjs} +8 -6
- package/dist/{runClaude-BuI6OOEv.cjs → runClaude-CT3jCZjH.cjs} +8 -6
- package/dist/{runCodex-BzZ0jODI.mjs → runCodex-DhbvUtJC.mjs} +9 -7
- package/dist/{runCodex-1jTTmCvq.cjs → runCodex-DodH9jhh.cjs} +9 -7
- package/dist/{runGemini-Bx2SYAyG.mjs → runGemini-BsFR5Pd3.mjs} +8 -6
- package/dist/{runGemini-1gJRE8oT.cjs → runGemini-CeHCZ1l4.cjs} +8 -6
- package/package.json +1 -1
- package/scripts/build.mjs +66 -66
- package/scripts/devtools/README.md +9 -9
- package/scripts/e2e/fake-codex-acp-agent.mjs +139 -139
- package/scripts/e2e/local-server-session-roundtrip.mjs +1063 -1063
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { l as logger, g as backoff, h as delay, j as AsyncLock, c as configuration, s as startOfflineReconnection, f as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-
|
|
2
|
+
import { l as logger, g as backoff, h as delay, j as AsyncLock, c as configuration, s as startOfflineReconnection, f as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-DX7Vg4Hz.mjs';
|
|
3
3
|
import 'cross-spawn';
|
|
4
4
|
import '@agentclientprotocol/sdk';
|
|
5
|
-
import { j as getProjectPath, F as Future, k as claudeLocal, E as ExitCodeError, l as trimIdent, m as createClaudeBackend, f as formatDisplayMessage, t as truncateDisplayMessage, n as claudeCheckSession, e as projectPath, o as mapToClaudeMode, P as PushableAsyncIterable, q as query, A as AbortError, b as stopCaffeinate, p as publishSessionRegistration, u as getEnvironmentInfo, w as startCaffeinate } from './index-
|
|
5
|
+
import { j as getProjectPath, F as Future, k as claudeLocal, E as ExitCodeError, l as trimIdent, m as createClaudeBackend, f as formatDisplayMessage, t as truncateDisplayMessage, n as claudeCheckSession, e as projectPath, o as mapToClaudeMode, P as PushableAsyncIterable, q as query, A as AbortError, b as stopCaffeinate, p as publishSessionRegistration, u as getEnvironmentInfo, w as startCaffeinate } from './index-CEJmASSW.mjs';
|
|
6
6
|
import 'ps-list';
|
|
7
7
|
import 'fs';
|
|
8
8
|
import 'path';
|
|
@@ -13,7 +13,7 @@ import { dirname, basename, join, resolve } from 'node:path';
|
|
|
13
13
|
import { homedir } from 'node:os';
|
|
14
14
|
import { execSync } from 'node:child_process';
|
|
15
15
|
import 'node:readline';
|
|
16
|
-
import './persistence-
|
|
16
|
+
import './persistence-xypxp7ei.mjs';
|
|
17
17
|
import { readFile } from 'node:fs/promises';
|
|
18
18
|
import { stat, watch, access } from 'fs/promises';
|
|
19
19
|
import 'crypto';
|
|
@@ -24,9 +24,9 @@ import 'tweetnacl';
|
|
|
24
24
|
import 'open';
|
|
25
25
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
26
26
|
import { useStdout, useInput, Box, Text, render } from 'ink';
|
|
27
|
-
import { c as createKeepAliveController, P as ProviderSelectionHandler, b as buildHappyOrgTurnPrompt, f as finalizeHappyOrgTurn, r as runModeLoop, a as resolveHappyOrgQueuedTurn } from './ProviderSelectionHandler-
|
|
27
|
+
import { c as createKeepAliveController, P as ProviderSelectionHandler, b as buildHappyOrgTurnPrompt, f as finalizeHappyOrgTurn, r as runModeLoop, a as resolveHappyOrgQueuedTurn } from './ProviderSelectionHandler-CbkbtIRC.mjs';
|
|
28
28
|
import { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
|
|
29
|
-
import { B as BasePermissionHandler, d as MessageBuffer, C as ConversationHistory$1, w as waitForResponseCompleteWithAbort, l as launchRuntimeHandleWithFactoryResult, j as forwardAgentMessageToProviderSession, s as syncControlledByUserState, e as ensureManagedProviderMachine, M as MissingMachineIdError, c as createSessionMetadata, b as MessageQueue2, h as hashObject, r as registerKillSessionHandler, f as closeProviderSession } from './registerKillSessionHandler-
|
|
29
|
+
import { B as BasePermissionHandler, d as MessageBuffer, C as ConversationHistory$1, w as waitForResponseCompleteWithAbort, l as launchRuntimeHandleWithFactoryResult, j as forwardAgentMessageToProviderSession, s as syncControlledByUserState, e as ensureManagedProviderMachine, M as MissingMachineIdError, c as createSessionMetadata, b as MessageQueue2, h as hashObject, r as registerKillSessionHandler, f as closeProviderSession } from './registerKillSessionHandler-BNN-_qNu.mjs';
|
|
30
30
|
import 'socket.io-client';
|
|
31
31
|
import 'expo-server-sdk';
|
|
32
32
|
import { isDeepStrictEqual } from 'node:util';
|
|
@@ -3363,7 +3363,9 @@ async function runClaude(credentials, options = {}) {
|
|
|
3363
3363
|
currentSession?.cleanup();
|
|
3364
3364
|
logger.debug("Waiting for socket to flush...");
|
|
3365
3365
|
logger.debug("Closing session...");
|
|
3366
|
-
await closeProviderSession(session
|
|
3366
|
+
await closeProviderSession(session, {
|
|
3367
|
+
archiveOnClose: true
|
|
3368
|
+
});
|
|
3367
3369
|
stopCaffeinate();
|
|
3368
3370
|
logger.debug("Stopped sleep prevention");
|
|
3369
3371
|
hookServer.stop();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var node_crypto = require('node:crypto');
|
|
4
|
-
var api = require('./api-
|
|
4
|
+
var api = require('./api-C4bF6GEA.cjs');
|
|
5
5
|
require('cross-spawn');
|
|
6
6
|
require('@agentclientprotocol/sdk');
|
|
7
|
-
var index = require('./index-
|
|
7
|
+
var index = require('./index-BybqdOf2.cjs');
|
|
8
8
|
require('ps-list');
|
|
9
9
|
require('fs');
|
|
10
10
|
require('path');
|
|
@@ -15,7 +15,7 @@ var path = require('node:path');
|
|
|
15
15
|
var os = require('node:os');
|
|
16
16
|
var node_child_process = require('node:child_process');
|
|
17
17
|
require('node:readline');
|
|
18
|
-
require('./persistence-
|
|
18
|
+
require('./persistence-CdqBfAwo.cjs');
|
|
19
19
|
var promises = require('node:fs/promises');
|
|
20
20
|
var fs = require('fs/promises');
|
|
21
21
|
require('crypto');
|
|
@@ -26,9 +26,9 @@ require('tweetnacl');
|
|
|
26
26
|
require('open');
|
|
27
27
|
var React = require('react');
|
|
28
28
|
var ink = require('ink');
|
|
29
|
-
var ProviderSelectionHandler = require('./ProviderSelectionHandler-
|
|
29
|
+
var ProviderSelectionHandler = require('./ProviderSelectionHandler-meVvz9NZ.cjs');
|
|
30
30
|
var types = require('./types-DVk3crez.cjs');
|
|
31
|
-
var registerKillSessionHandler = require('./registerKillSessionHandler-
|
|
31
|
+
var registerKillSessionHandler = require('./registerKillSessionHandler-BK3fZIch.cjs');
|
|
32
32
|
require('socket.io-client');
|
|
33
33
|
require('expo-server-sdk');
|
|
34
34
|
var node_util = require('node:util');
|
|
@@ -3365,7 +3365,9 @@ async function runClaude(credentials, options = {}) {
|
|
|
3365
3365
|
currentSession?.cleanup();
|
|
3366
3366
|
api.logger.debug("Waiting for socket to flush...");
|
|
3367
3367
|
api.logger.debug("Closing session...");
|
|
3368
|
-
await registerKillSessionHandler.closeProviderSession(session
|
|
3368
|
+
await registerKillSessionHandler.closeProviderSession(session, {
|
|
3369
|
+
archiveOnClose: true
|
|
3370
|
+
});
|
|
3369
3371
|
index.stopCaffeinate();
|
|
3370
3372
|
api.logger.debug("Stopped sleep prevention");
|
|
3371
3373
|
hookServer.stop();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { l as logger, f as connectionState, A as ApiClient } from './api-
|
|
3
|
-
import { B as BasePermissionHandler, h as hashObject, d as MessageBuffer, C as ConversationHistory$1, w as waitForResponseCompleteWithAbort, r as registerKillSessionHandler, l as launchRuntimeHandleWithFactoryResult, i as inferToolResultError, j as forwardAgentMessageToProviderSession, f as closeProviderSession, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, s as syncControlledByUserState } from './registerKillSessionHandler-
|
|
4
|
-
import { f as formatDisplayMessage, v as validateCodexAcpSpawn, d as createCodexBackend, t as truncateDisplayMessage, b as stopCaffeinate } from './index-
|
|
2
|
+
import { l as logger, f as connectionState, A as ApiClient } from './api-DX7Vg4Hz.mjs';
|
|
3
|
+
import { B as BasePermissionHandler, h as hashObject, d as MessageBuffer, C as ConversationHistory$1, w as waitForResponseCompleteWithAbort, r as registerKillSessionHandler, l as launchRuntimeHandleWithFactoryResult, i as inferToolResultError, j as forwardAgentMessageToProviderSession, f as closeProviderSession, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, s as syncControlledByUserState } from './registerKillSessionHandler-BNN-_qNu.mjs';
|
|
4
|
+
import { f as formatDisplayMessage, v as validateCodexAcpSpawn, d as createCodexBackend, t as truncateDisplayMessage, b as stopCaffeinate } from './index-CEJmASSW.mjs';
|
|
5
5
|
import 'cross-spawn';
|
|
6
6
|
import '@agentclientprotocol/sdk';
|
|
7
7
|
import 'ps-list';
|
|
@@ -14,7 +14,7 @@ import 'node:path';
|
|
|
14
14
|
import 'node:os';
|
|
15
15
|
import 'node:child_process';
|
|
16
16
|
import 'node:readline';
|
|
17
|
-
import './persistence-
|
|
17
|
+
import './persistence-xypxp7ei.mjs';
|
|
18
18
|
import 'node:fs/promises';
|
|
19
19
|
import 'fs/promises';
|
|
20
20
|
import 'crypto';
|
|
@@ -25,8 +25,8 @@ import 'tweetnacl';
|
|
|
25
25
|
import 'open';
|
|
26
26
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
27
27
|
import { useStdout, useInput, Box, Text, render } from 'ink';
|
|
28
|
-
import { c as createKeepAliveController, P as ProviderSelectionHandler, b as buildHappyOrgTurnPrompt, f as finalizeHappyOrgTurn, r as runModeLoop, a as resolveHappyOrgQueuedTurn } from './ProviderSelectionHandler-
|
|
29
|
-
import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-
|
|
28
|
+
import { c as createKeepAliveController, P as ProviderSelectionHandler, b as buildHappyOrgTurnPrompt, f as finalizeHappyOrgTurn, r as runModeLoop, a as resolveHappyOrgQueuedTurn } from './ProviderSelectionHandler-CbkbtIRC.mjs';
|
|
29
|
+
import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-DH3BCCTf.mjs';
|
|
30
30
|
import 'zod';
|
|
31
31
|
import 'socket.io-client';
|
|
32
32
|
import 'expo-server-sdk';
|
|
@@ -1297,7 +1297,9 @@ async function runCodex(opts) {
|
|
|
1297
1297
|
loopError = error;
|
|
1298
1298
|
} finally {
|
|
1299
1299
|
try {
|
|
1300
|
-
await closeProviderSession(sessionClient
|
|
1300
|
+
await closeProviderSession(sessionClient, {
|
|
1301
|
+
archiveOnClose: true
|
|
1302
|
+
});
|
|
1301
1303
|
} catch (error) {
|
|
1302
1304
|
closeError = error;
|
|
1303
1305
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var node_crypto = require('node:crypto');
|
|
4
|
-
var api = require('./api-
|
|
5
|
-
var registerKillSessionHandler = require('./registerKillSessionHandler-
|
|
6
|
-
var index = require('./index-
|
|
4
|
+
var api = require('./api-C4bF6GEA.cjs');
|
|
5
|
+
var registerKillSessionHandler = require('./registerKillSessionHandler-BK3fZIch.cjs');
|
|
6
|
+
var index = require('./index-BybqdOf2.cjs');
|
|
7
7
|
require('cross-spawn');
|
|
8
8
|
require('@agentclientprotocol/sdk');
|
|
9
9
|
require('ps-list');
|
|
@@ -16,7 +16,7 @@ require('node:path');
|
|
|
16
16
|
require('node:os');
|
|
17
17
|
require('node:child_process');
|
|
18
18
|
require('node:readline');
|
|
19
|
-
require('./persistence-
|
|
19
|
+
require('./persistence-CdqBfAwo.cjs');
|
|
20
20
|
require('node:fs/promises');
|
|
21
21
|
require('fs/promises');
|
|
22
22
|
require('crypto');
|
|
@@ -27,8 +27,8 @@ require('tweetnacl');
|
|
|
27
27
|
require('open');
|
|
28
28
|
var React = require('react');
|
|
29
29
|
var ink = require('ink');
|
|
30
|
-
var ProviderSelectionHandler = require('./ProviderSelectionHandler-
|
|
31
|
-
var BaseReasoningProcessor = require('./BaseReasoningProcessor-
|
|
30
|
+
var ProviderSelectionHandler = require('./ProviderSelectionHandler-meVvz9NZ.cjs');
|
|
31
|
+
var BaseReasoningProcessor = require('./BaseReasoningProcessor-BzbDRBqp.cjs');
|
|
32
32
|
require('zod');
|
|
33
33
|
require('socket.io-client');
|
|
34
34
|
require('expo-server-sdk');
|
|
@@ -1299,7 +1299,9 @@ async function runCodex(opts) {
|
|
|
1299
1299
|
loopError = error;
|
|
1300
1300
|
} finally {
|
|
1301
1301
|
try {
|
|
1302
|
-
await registerKillSessionHandler.closeProviderSession(sessionClient
|
|
1302
|
+
await registerKillSessionHandler.closeProviderSession(sessionClient, {
|
|
1303
|
+
archiveOnClose: true
|
|
1304
|
+
});
|
|
1303
1305
|
} catch (error) {
|
|
1304
1306
|
closeError = error;
|
|
1305
1307
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useStdout, useInput, Box, Text, render } from 'ink';
|
|
2
2
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
3
3
|
import { randomUUID } from 'node:crypto';
|
|
4
|
-
import { l as logger, f as connectionState, A as ApiClient } from './api-
|
|
5
|
-
import { B as BasePermissionHandler, C as ConversationHistory$1, e as ensureManagedProviderMachine, M as MissingMachineIdError, s as syncControlledByUserState, b as MessageQueue2, h as hashObject, d as MessageBuffer, r as registerKillSessionHandler, w as waitForResponseCompleteWithAbort, f as closeProviderSession, l as launchRuntimeHandleWithFactoryResult, i as inferToolResultError, j as forwardAgentMessageToProviderSession } from './registerKillSessionHandler-
|
|
6
|
-
import { g as getInitialGeminiModel, r as readGeminiLocalConfig, G as GEMINI_MODEL_ENV, s as saveGeminiModelToConfig, a as createGeminiBackend, b as stopCaffeinate } from './index-
|
|
7
|
-
import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-
|
|
4
|
+
import { l as logger, f as connectionState, A as ApiClient } from './api-DX7Vg4Hz.mjs';
|
|
5
|
+
import { B as BasePermissionHandler, C as ConversationHistory$1, e as ensureManagedProviderMachine, M as MissingMachineIdError, s as syncControlledByUserState, b as MessageQueue2, h as hashObject, d as MessageBuffer, r as registerKillSessionHandler, w as waitForResponseCompleteWithAbort, f as closeProviderSession, l as launchRuntimeHandleWithFactoryResult, i as inferToolResultError, j as forwardAgentMessageToProviderSession } from './registerKillSessionHandler-BNN-_qNu.mjs';
|
|
6
|
+
import { g as getInitialGeminiModel, r as readGeminiLocalConfig, G as GEMINI_MODEL_ENV, s as saveGeminiModelToConfig, a as createGeminiBackend, b as stopCaffeinate } from './index-CEJmASSW.mjs';
|
|
7
|
+
import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-DH3BCCTf.mjs';
|
|
8
8
|
import 'cross-spawn';
|
|
9
9
|
import '@agentclientprotocol/sdk';
|
|
10
10
|
import 'ps-list';
|
|
@@ -15,7 +15,7 @@ import 'node:child_process';
|
|
|
15
15
|
import 'node:readline';
|
|
16
16
|
import 'tweetnacl';
|
|
17
17
|
import 'axios';
|
|
18
|
-
import './persistence-
|
|
18
|
+
import './persistence-xypxp7ei.mjs';
|
|
19
19
|
import 'open';
|
|
20
20
|
import 'chalk';
|
|
21
21
|
import 'fs';
|
|
@@ -1151,7 +1151,9 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
|
|
|
1151
1151
|
reconnectionHandle.cancel();
|
|
1152
1152
|
}
|
|
1153
1153
|
try {
|
|
1154
|
-
await closeProviderSession(session
|
|
1154
|
+
await closeProviderSession(session, {
|
|
1155
|
+
archiveOnClose: true
|
|
1156
|
+
});
|
|
1155
1157
|
} catch (e) {
|
|
1156
1158
|
logger.debug("[gemini]: Error while closing session", e);
|
|
1157
1159
|
}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
var ink = require('ink');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var node_crypto = require('node:crypto');
|
|
6
|
-
var api = require('./api-
|
|
7
|
-
var registerKillSessionHandler = require('./registerKillSessionHandler-
|
|
8
|
-
var index = require('./index-
|
|
9
|
-
var BaseReasoningProcessor = require('./BaseReasoningProcessor-
|
|
6
|
+
var api = require('./api-C4bF6GEA.cjs');
|
|
7
|
+
var registerKillSessionHandler = require('./registerKillSessionHandler-BK3fZIch.cjs');
|
|
8
|
+
var index = require('./index-BybqdOf2.cjs');
|
|
9
|
+
var BaseReasoningProcessor = require('./BaseReasoningProcessor-BzbDRBqp.cjs');
|
|
10
10
|
require('cross-spawn');
|
|
11
11
|
require('@agentclientprotocol/sdk');
|
|
12
12
|
require('ps-list');
|
|
@@ -17,7 +17,7 @@ require('node:child_process');
|
|
|
17
17
|
require('node:readline');
|
|
18
18
|
require('tweetnacl');
|
|
19
19
|
require('axios');
|
|
20
|
-
require('./persistence-
|
|
20
|
+
require('./persistence-CdqBfAwo.cjs');
|
|
21
21
|
require('open');
|
|
22
22
|
require('chalk');
|
|
23
23
|
require('fs');
|
|
@@ -1153,7 +1153,9 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
|
|
|
1153
1153
|
reconnectionHandle.cancel();
|
|
1154
1154
|
}
|
|
1155
1155
|
try {
|
|
1156
|
-
await registerKillSessionHandler.closeProviderSession(session
|
|
1156
|
+
await registerKillSessionHandler.closeProviderSession(session, {
|
|
1157
|
+
archiveOnClose: true
|
|
1158
|
+
});
|
|
1157
1159
|
} catch (e) {
|
|
1158
1160
|
api.logger.debug("[gemini]: Error while closing session", e);
|
|
1159
1161
|
}
|
package/package.json
CHANGED
package/scripts/build.mjs
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { spawnSync } from 'node:child_process';
|
|
4
|
-
import { existsSync, readFileSync, rmSync } from 'node:fs';
|
|
5
|
-
import { dirname, resolve } from 'node:path';
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
7
|
-
|
|
8
|
-
const here = dirname(fileURLToPath(import.meta.url));
|
|
9
|
-
const packageRoot = resolve(here, '..');
|
|
10
|
-
const workspaceRoot = resolve(packageRoot, '..', '..');
|
|
11
|
-
const packageJson = JSON.parse(readFileSync(resolve(packageRoot, 'package.json'), 'utf8'));
|
|
12
|
-
|
|
13
|
-
function resolveTool(binName, packageSpecs) {
|
|
14
|
-
const suffix = process.platform === 'win32' ? '.cmd' : '';
|
|
15
|
-
const packageLocalBin = resolve(packageRoot, 'node_modules', '.bin', `${binName}${suffix}`);
|
|
16
|
-
const workspaceLocalBin = resolve(workspaceRoot, 'node_modules', '.bin', `${binName}${suffix}`);
|
|
17
|
-
|
|
18
|
-
if (existsSync(packageLocalBin)) {
|
|
19
|
-
return {
|
|
20
|
-
command: packageLocalBin,
|
|
21
|
-
prefixArgs: [],
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (existsSync(workspaceLocalBin)) {
|
|
26
|
-
return {
|
|
27
|
-
command: workspaceLocalBin,
|
|
28
|
-
prefixArgs: [],
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
command: 'npx',
|
|
34
|
-
prefixArgs: ['-y', ...packageSpecs.flatMap((packageSpec) => ['-p', packageSpec]), binName],
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function runStep(name, command, args) {
|
|
39
|
-
console.log(`\n[build] ${name}`);
|
|
40
|
-
console.log(`> ${command} ${args.join(' ')}`);
|
|
41
|
-
|
|
42
|
-
const result = spawnSync(command, args, {
|
|
43
|
-
cwd: packageRoot,
|
|
44
|
-
stdio: 'inherit',
|
|
45
|
-
shell: process.platform === 'win32',
|
|
46
|
-
env: process.env,
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
if (result.status !== 0) {
|
|
50
|
-
throw new Error(`[build] Step failed: ${name}`);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function runTool(name, tool, args) {
|
|
55
|
-
runStep(name, tool.command, [...tool.prefixArgs, ...args]);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const tsc = resolveTool('tsc', [`typescript@${packageJson.devDependencies.typescript}`]);
|
|
59
|
-
const pkgroll = resolveTool('pkgroll', [
|
|
60
|
-
`pkgroll@${packageJson.devDependencies.pkgroll}`,
|
|
61
|
-
`typescript@${packageJson.devDependencies.typescript}`,
|
|
62
|
-
]);
|
|
63
|
-
|
|
64
|
-
rmSync(resolve(packageRoot, 'dist'), { recursive: true, force: true });
|
|
65
|
-
runTool('typecheck', tsc, ['--noEmit']);
|
|
66
|
-
runTool('bundle', pkgroll, []);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawnSync } from 'node:child_process';
|
|
4
|
+
import { existsSync, readFileSync, rmSync } from 'node:fs';
|
|
5
|
+
import { dirname, resolve } from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
|
|
8
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
const packageRoot = resolve(here, '..');
|
|
10
|
+
const workspaceRoot = resolve(packageRoot, '..', '..');
|
|
11
|
+
const packageJson = JSON.parse(readFileSync(resolve(packageRoot, 'package.json'), 'utf8'));
|
|
12
|
+
|
|
13
|
+
function resolveTool(binName, packageSpecs) {
|
|
14
|
+
const suffix = process.platform === 'win32' ? '.cmd' : '';
|
|
15
|
+
const packageLocalBin = resolve(packageRoot, 'node_modules', '.bin', `${binName}${suffix}`);
|
|
16
|
+
const workspaceLocalBin = resolve(workspaceRoot, 'node_modules', '.bin', `${binName}${suffix}`);
|
|
17
|
+
|
|
18
|
+
if (existsSync(packageLocalBin)) {
|
|
19
|
+
return {
|
|
20
|
+
command: packageLocalBin,
|
|
21
|
+
prefixArgs: [],
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (existsSync(workspaceLocalBin)) {
|
|
26
|
+
return {
|
|
27
|
+
command: workspaceLocalBin,
|
|
28
|
+
prefixArgs: [],
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
command: 'npx',
|
|
34
|
+
prefixArgs: ['-y', ...packageSpecs.flatMap((packageSpec) => ['-p', packageSpec]), binName],
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function runStep(name, command, args) {
|
|
39
|
+
console.log(`\n[build] ${name}`);
|
|
40
|
+
console.log(`> ${command} ${args.join(' ')}`);
|
|
41
|
+
|
|
42
|
+
const result = spawnSync(command, args, {
|
|
43
|
+
cwd: packageRoot,
|
|
44
|
+
stdio: 'inherit',
|
|
45
|
+
shell: process.platform === 'win32',
|
|
46
|
+
env: process.env,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
if (result.status !== 0) {
|
|
50
|
+
throw new Error(`[build] Step failed: ${name}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function runTool(name, tool, args) {
|
|
55
|
+
runStep(name, tool.command, [...tool.prefixArgs, ...args]);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const tsc = resolveTool('tsc', [`typescript@${packageJson.devDependencies.typescript}`]);
|
|
59
|
+
const pkgroll = resolveTool('pkgroll', [
|
|
60
|
+
`pkgroll@${packageJson.devDependencies.pkgroll}`,
|
|
61
|
+
`typescript@${packageJson.devDependencies.typescript}`,
|
|
62
|
+
]);
|
|
63
|
+
|
|
64
|
+
rmSync(resolve(packageRoot, 'dist'), { recursive: true, force: true });
|
|
65
|
+
runTool('typecheck', tsc, ['--noEmit']);
|
|
66
|
+
runTool('bundle', pkgroll, []);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# CLI Devtools
|
|
2
|
-
|
|
3
|
-
这组脚本用于 CLI 本地开发辅助。
|
|
4
|
-
|
|
5
|
-
当前包含:
|
|
6
|
-
|
|
7
|
-
- mock credentials 生成器
|
|
8
|
-
|
|
9
|
-
新增 CLI 专属开发脚本应优先放在这里。
|
|
1
|
+
# CLI Devtools
|
|
2
|
+
|
|
3
|
+
这组脚本用于 CLI 本地开发辅助。
|
|
4
|
+
|
|
5
|
+
当前包含:
|
|
6
|
+
|
|
7
|
+
- mock credentials 生成器
|
|
8
|
+
|
|
9
|
+
新增 CLI 专属开发脚本应优先放在这里。
|