@share-crm/sharedev-cli 0.0.4-rc.52 → 0.0.4-rc.54
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/sharedev.js +300 -242
- package/package.json +1 -1
package/dist/sharedev.js
CHANGED
|
@@ -8550,169 +8550,6 @@ module.exports = {
|
|
|
8550
8550
|
};
|
|
8551
8551
|
|
|
8552
8552
|
|
|
8553
|
-
/***/ },
|
|
8554
|
-
|
|
8555
|
-
/***/ 53528
|
|
8556
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
8557
|
-
|
|
8558
|
-
//#!/usr/bin/env node
|
|
8559
|
-
|
|
8560
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8561
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8562
|
-
};
|
|
8563
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
8564
|
-
// 默认抑制所有 Node 警告;debug 构建产物或显式 --debug 时放开,方便排查依赖弃用/运行告警
|
|
8565
|
-
const isDebugBuild = true && false;
|
|
8566
|
-
if (!process.argv.includes('--debug') && !isDebugBuild) {
|
|
8567
|
-
process.removeAllListeners('warning');
|
|
8568
|
-
process.on('warning', () => { });
|
|
8569
|
-
}
|
|
8570
|
-
const commander_1 = __webpack_require__(63219);
|
|
8571
|
-
const index_ts_1 = __webpack_require__(22841);
|
|
8572
|
-
const context_ts_1 = __webpack_require__(29531);
|
|
8573
|
-
const logger_ts_1 = __webpack_require__(87562);
|
|
8574
|
-
const request_ts_1 = __webpack_require__(83733);
|
|
8575
|
-
const pkgMeta_ts_1 = __webpack_require__(48559);
|
|
8576
|
-
const normalize_ts_1 = __importDefault(__webpack_require__(80399));
|
|
8577
|
-
const debug_ts_1 = __webpack_require__(90667);
|
|
8578
|
-
const npm_update_ts_1 = __webpack_require__(12239);
|
|
8579
|
-
const index_ts_2 = __webpack_require__(45606);
|
|
8580
|
-
const isDebugEnabled_ts_1 = __webpack_require__(27570);
|
|
8581
|
-
function readBootstrapOptions() {
|
|
8582
|
-
const args = process.argv.slice(2);
|
|
8583
|
-
return {
|
|
8584
|
-
debug: args.includes('--debug')
|
|
8585
|
-
};
|
|
8586
|
-
}
|
|
8587
|
-
function createHelpRuntimeContext() {
|
|
8588
|
-
const cwd = process.cwd();
|
|
8589
|
-
return {
|
|
8590
|
-
cwd,
|
|
8591
|
-
verbose: false,
|
|
8592
|
-
settings: {
|
|
8593
|
-
certificate: '',
|
|
8594
|
-
domain: 'https://help.invalid',
|
|
8595
|
-
developerName: '',
|
|
8596
|
-
developerMobile: '',
|
|
8597
|
-
specVersion: '',
|
|
8598
|
-
settingsPath: '',
|
|
8599
|
-
settingsDir: cwd
|
|
8600
|
-
},
|
|
8601
|
-
workspaceRoot: cwd
|
|
8602
|
-
};
|
|
8603
|
-
}
|
|
8604
|
-
function isHelpRequest(argv) {
|
|
8605
|
-
return argv.slice(2).some((arg) => arg === '--help' || arg === '-h');
|
|
8606
|
-
}
|
|
8607
|
-
function isVersionRequest(argv) {
|
|
8608
|
-
return argv.slice(2).some((arg) => arg === '--version' || arg === '-v');
|
|
8609
|
-
}
|
|
8610
|
-
function resolveCommandPath(argv) {
|
|
8611
|
-
const args = argv.slice(2);
|
|
8612
|
-
const path = [];
|
|
8613
|
-
const valueOptions = new Set(['--ea', '--domain', '--certificate', '--platform']);
|
|
8614
|
-
for (let i = 0; i < args.length; i += 1) {
|
|
8615
|
-
const token = args[i];
|
|
8616
|
-
if (!token.startsWith('-')) {
|
|
8617
|
-
path.push(token);
|
|
8618
|
-
if (path.length === 2) {
|
|
8619
|
-
break;
|
|
8620
|
-
}
|
|
8621
|
-
continue;
|
|
8622
|
-
}
|
|
8623
|
-
if (token.startsWith('--')) {
|
|
8624
|
-
const [name] = token.split('=');
|
|
8625
|
-
if (valueOptions.has(name) && !token.includes('=')) {
|
|
8626
|
-
i += 1;
|
|
8627
|
-
}
|
|
8628
|
-
continue;
|
|
8629
|
-
}
|
|
8630
|
-
if (token === '-y' || token === '-h') {
|
|
8631
|
-
continue;
|
|
8632
|
-
}
|
|
8633
|
-
}
|
|
8634
|
-
return path;
|
|
8635
|
-
}
|
|
8636
|
-
function shouldSkipSettings(argv) {
|
|
8637
|
-
if (isHelpRequest(argv)) {
|
|
8638
|
-
return true;
|
|
8639
|
-
}
|
|
8640
|
-
if (isVersionRequest(argv)) {
|
|
8641
|
-
return true;
|
|
8642
|
-
}
|
|
8643
|
-
const commandPath = resolveCommandPath(argv);
|
|
8644
|
-
return commandPath[0] === 'init' || commandPath[0] === 'config' || commandPath[0] === 'completion' || commandPath[0] === 'spec';
|
|
8645
|
-
}
|
|
8646
|
-
async function checkForNpmUpdate(packageName, currentVersion) {
|
|
8647
|
-
try {
|
|
8648
|
-
const latestVersion = await (0, npm_update_ts_1.fetchLatestNpmVersion)(packageName);
|
|
8649
|
-
if (!latestVersion || (0, isDebugEnabled_ts_1.isRuntimeDebugEnabled)()) {
|
|
8650
|
-
return;
|
|
8651
|
-
}
|
|
8652
|
-
if (normalize_ts_1.default.compareSemver(latestVersion, currentVersion) > 0) {
|
|
8653
|
-
logger_ts_1.loggerService.warn(`A newer version is available: ${currentVersion} -> ${latestVersion}. Run: npm i -g ${packageName}`);
|
|
8654
|
-
}
|
|
8655
|
-
}
|
|
8656
|
-
catch {
|
|
8657
|
-
// Ignore version-check errors to avoid impacting command execution.
|
|
8658
|
-
}
|
|
8659
|
-
}
|
|
8660
|
-
async function checkForSpecUpdate(localSpecVersion) {
|
|
8661
|
-
// 本地未安装 spec 模板时无需提示更新
|
|
8662
|
-
if (!localSpecVersion) {
|
|
8663
|
-
return;
|
|
8664
|
-
}
|
|
8665
|
-
try {
|
|
8666
|
-
const controller = new AbortController();
|
|
8667
|
-
const timeout = setTimeout(() => controller.abort(), 1500);
|
|
8668
|
-
const result = await (0, index_ts_2.specCheckService)(localSpecVersion, controller.signal);
|
|
8669
|
-
clearTimeout(timeout);
|
|
8670
|
-
if (result.hasUpdate && result.manifest) {
|
|
8671
|
-
logger_ts_1.loggerService.warn(`A newer spec template is available: ${localSpecVersion} -> ${result.manifest.version}. Run: sharedev spec update`);
|
|
8672
|
-
}
|
|
8673
|
-
}
|
|
8674
|
-
catch {
|
|
8675
|
-
// Ignore spec version-check errors to avoid impacting command execution.
|
|
8676
|
-
}
|
|
8677
|
-
}
|
|
8678
|
-
async function bootstrap() {
|
|
8679
|
-
const bootstrapOptions = readBootstrapOptions();
|
|
8680
|
-
const pkgMeta = await (0, pkgMeta_ts_1.readCliPackageMeta)();
|
|
8681
|
-
const version = pkgMeta.version;
|
|
8682
|
-
const program = new commander_1.Command();
|
|
8683
|
-
program
|
|
8684
|
-
.name('sharedev')
|
|
8685
|
-
.description('sharedev command line tool')
|
|
8686
|
-
.version(version, '-v, --version', 'output the current version')
|
|
8687
|
-
.option('--debug', 'enable trace debug output for current command')
|
|
8688
|
-
.showHelpAfterError(true);
|
|
8689
|
-
(0, debug_ts_1.setRuntimeDebugEnabled)(Boolean(bootstrapOptions.debug));
|
|
8690
|
-
logger_ts_1.loggerService.debug('You are in debug mode; ignore any cli version gap versus the release build.');
|
|
8691
|
-
if (shouldSkipSettings(process.argv)) {
|
|
8692
|
-
(0, index_ts_1.registerNamespaces)(program, createHelpRuntimeContext());
|
|
8693
|
-
await checkForNpmUpdate(pkgMeta.name, version);
|
|
8694
|
-
await program.parseAsync(process.argv, { from: 'node' });
|
|
8695
|
-
logger_ts_1.loggerService.printTraceIdsIfNeeded('');
|
|
8696
|
-
return;
|
|
8697
|
-
}
|
|
8698
|
-
const runtimeContext = await (0, context_ts_1.createCliRuntimeContext)(bootstrapOptions);
|
|
8699
|
-
request_ts_1.requestService.configure(runtimeContext.settings);
|
|
8700
|
-
// npm 与 spec 版本检查并发执行(均带 1.5s 超时,错误吞掉,不影响命令执行)
|
|
8701
|
-
await Promise.all([
|
|
8702
|
-
checkForNpmUpdate(pkgMeta.name, version),
|
|
8703
|
-
checkForSpecUpdate(runtimeContext.settings.specVersion)
|
|
8704
|
-
]);
|
|
8705
|
-
(0, index_ts_1.registerNamespaces)(program, runtimeContext);
|
|
8706
|
-
await program.parseAsync(process.argv, { from: 'node' });
|
|
8707
|
-
logger_ts_1.loggerService.printTraceIdsIfNeeded('');
|
|
8708
|
-
}
|
|
8709
|
-
bootstrap().catch((error) => {
|
|
8710
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
8711
|
-
logger_ts_1.loggerService.error(message);
|
|
8712
|
-
process.exitCode = 1;
|
|
8713
|
-
});
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
8553
|
/***/ },
|
|
8717
8554
|
|
|
8718
8555
|
/***/ 9759
|
|
@@ -9045,7 +8882,7 @@ Examples:
|
|
|
9045
8882
|
};
|
|
9046
8883
|
await (0, apl_command_ts_1.aplCreateCommand)(context, resolvedOptions);
|
|
9047
8884
|
}));
|
|
9048
|
-
// ===== 操作中心动作:code-dev
|
|
8885
|
+
// ===== 操作中心动作:code-dev apl(启用或停用函数 set-active / 查询函数执行日志 list-execution-logs / 查询函数执行日志详情 get-execution-log) =====
|
|
9049
8886
|
apl.command('set-active <apiName>')
|
|
9050
8887
|
.description('[operation-center] 启用或停用函数 / Enable or disable a remote APL function by api name')
|
|
9051
8888
|
.requiredOption('--is_active <boolean>', 'Target active state: true or false')
|
|
@@ -15743,64 +15580,6 @@ LoggerService.DOWNLOAD_BAR_WIDTH = 20;
|
|
|
15743
15580
|
exports.loggerService = new LoggerService();
|
|
15744
15581
|
|
|
15745
15582
|
|
|
15746
|
-
/***/ },
|
|
15747
|
-
|
|
15748
|
-
/***/ 12239
|
|
15749
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
15750
|
-
|
|
15751
|
-
var __webpack_unused_export__;
|
|
15752
|
-
|
|
15753
|
-
__webpack_unused_export__ = ({ value: true });
|
|
15754
|
-
exports.fetchLatestNpmVersion = void 0;
|
|
15755
|
-
const node_https_1 = __webpack_require__(44708);
|
|
15756
|
-
const fetchLatestNpmVersion = (packageName, timeoutMs = 1500) => new Promise((resolve) => {
|
|
15757
|
-
let settled = false;
|
|
15758
|
-
const finish = (version) => {
|
|
15759
|
-
if (settled) {
|
|
15760
|
-
return;
|
|
15761
|
-
}
|
|
15762
|
-
settled = true;
|
|
15763
|
-
resolve(version);
|
|
15764
|
-
};
|
|
15765
|
-
const request = (0, node_https_1.get)(`https://registry.npmjs.org/${encodeURIComponent(packageName)}/latest`, {
|
|
15766
|
-
agent: false,
|
|
15767
|
-
headers: {
|
|
15768
|
-
accept: 'application/json',
|
|
15769
|
-
connection: 'close',
|
|
15770
|
-
},
|
|
15771
|
-
}, (response) => {
|
|
15772
|
-
if (response.statusCode === undefined || response.statusCode < 200 || response.statusCode >= 300) {
|
|
15773
|
-
response.resume();
|
|
15774
|
-
finish();
|
|
15775
|
-
return;
|
|
15776
|
-
}
|
|
15777
|
-
response.setEncoding('utf8');
|
|
15778
|
-
let body = '';
|
|
15779
|
-
response.on('data', (chunk) => {
|
|
15780
|
-
body += chunk;
|
|
15781
|
-
});
|
|
15782
|
-
response.once('aborted', () => finish());
|
|
15783
|
-
response.once('error', () => finish());
|
|
15784
|
-
response.once('end', () => {
|
|
15785
|
-
try {
|
|
15786
|
-
const data = JSON.parse(body);
|
|
15787
|
-
const version = typeof data.version === 'string' ? data.version.trim() : '';
|
|
15788
|
-
finish(version || undefined);
|
|
15789
|
-
}
|
|
15790
|
-
catch {
|
|
15791
|
-
finish();
|
|
15792
|
-
}
|
|
15793
|
-
});
|
|
15794
|
-
});
|
|
15795
|
-
request.setTimeout(timeoutMs, () => {
|
|
15796
|
-
request.destroy();
|
|
15797
|
-
finish();
|
|
15798
|
-
});
|
|
15799
|
-
request.once('error', () => finish());
|
|
15800
|
-
});
|
|
15801
|
-
exports.fetchLatestNpmVersion = fetchLatestNpmVersion;
|
|
15802
|
-
|
|
15803
|
-
|
|
15804
15583
|
/***/ },
|
|
15805
15584
|
|
|
15806
15585
|
/***/ 2067
|
|
@@ -16491,10 +16270,11 @@ const SHARE_CLI_COMMAND_PATH_MAP = {
|
|
|
16491
16270
|
aplFind: ['code-dev', 'apl', 'get-by-apiname-and-binding-object-apiname'],
|
|
16492
16271
|
aplBatchQuery: ['code-dev', 'apl', 'query-by-apinames'],
|
|
16493
16272
|
aplList: ['code-dev', 'apl', 'list'],
|
|
16494
|
-
// ===== function
|
|
16495
|
-
|
|
16496
|
-
|
|
16497
|
-
|
|
16273
|
+
// ===== function 类 action(函数启用/停用 + 执行日志)=====
|
|
16274
|
+
// 2026-10-23 双环境(112 / fxiaoke)实测:函数类 action 统一挂在 `code-dev apl` 下,`code-dev function` 命名空间均未注册
|
|
16275
|
+
functionSetActive: ['code-dev', 'apl', 'set-active'],
|
|
16276
|
+
functionListExecutionLogs: ['code-dev', 'apl', 'list-execution-logs'],
|
|
16277
|
+
functionGetExecutionLog: ['code-dev', 'apl', 'get-execution-log'],
|
|
16498
16278
|
},
|
|
16499
16279
|
};
|
|
16500
16280
|
function getShareCliCommandPath(namespace, key) {
|
|
@@ -16898,6 +16678,7 @@ exports.traceCommand = traceCommand;
|
|
|
16898
16678
|
exports.traceService = traceService;
|
|
16899
16679
|
exports.traceExecute = traceExecute;
|
|
16900
16680
|
exports.traceSkill = traceSkill;
|
|
16681
|
+
exports.traceCliUpdate = traceCliUpdate;
|
|
16901
16682
|
const node_os_1 = __importDefault(__webpack_require__(48161));
|
|
16902
16683
|
const logger_ts_1 = __webpack_require__(87562);
|
|
16903
16684
|
const request_ts_1 = __webpack_require__(83733);
|
|
@@ -17048,6 +16829,20 @@ function traceExecute(commandPath) {
|
|
|
17048
16829
|
function traceSkill(skillName) {
|
|
17049
16830
|
sendTrace({ subModule: 'skill', str1: skillName });
|
|
17050
16831
|
}
|
|
16832
|
+
/**
|
|
16833
|
+
* cli 版本升级检查埋点。
|
|
16834
|
+
* @param event 事件名:check(每次检查)/ forced(强制拦截)
|
|
16835
|
+
* @param currentVersion 当前版本
|
|
16836
|
+
* @param minVersion 最低支持版本(可空)
|
|
16837
|
+
*/
|
|
16838
|
+
function traceCliUpdate(event, currentVersion, minVersion) {
|
|
16839
|
+
sendTrace({
|
|
16840
|
+
subModule: 'cli-update',
|
|
16841
|
+
str1: event,
|
|
16842
|
+
str2: currentVersion,
|
|
16843
|
+
str3: minVersion ?? ''
|
|
16844
|
+
});
|
|
16845
|
+
}
|
|
17051
16846
|
|
|
17052
16847
|
|
|
17053
16848
|
/***/ },
|
|
@@ -26079,6 +25874,101 @@ async function executeBpmRuntimeShareCli(commandPath, data, others) {
|
|
|
26079
25874
|
}
|
|
26080
25875
|
|
|
26081
25876
|
|
|
25877
|
+
/***/ },
|
|
25878
|
+
|
|
25879
|
+
/***/ 38749
|
|
25880
|
+
(__unused_webpack_module, exports) {
|
|
25881
|
+
|
|
25882
|
+
var __webpack_unused_export__;
|
|
25883
|
+
|
|
25884
|
+
__webpack_unused_export__ = ({ value: true });
|
|
25885
|
+
exports.CLI_UPDATE_MANIFEST_URL = void 0;
|
|
25886
|
+
/**
|
|
25887
|
+
* sharedev CLI 自身版本升级的远端 manifest 地址。
|
|
25888
|
+
* 与 spec 模板的 sharecrm-skills-kit.json 同目录下发,服务端通过该文件控制
|
|
25889
|
+
* 客户端的最低支持版本(minVersion)与最新版本(version)。
|
|
25890
|
+
*/
|
|
25891
|
+
exports.CLI_UPDATE_MANIFEST_URL = 'https://developer.fxiaoke.com/sharedev/sharedev-cli-manifest.json';
|
|
25892
|
+
|
|
25893
|
+
|
|
25894
|
+
/***/ },
|
|
25895
|
+
|
|
25896
|
+
/***/ 17295
|
|
25897
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
25898
|
+
|
|
25899
|
+
|
|
25900
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25901
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
25902
|
+
};
|
|
25903
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
25904
|
+
exports.cliUpdateCheckService = void 0;
|
|
25905
|
+
const normalize_ts_1 = __importDefault(__webpack_require__(80399));
|
|
25906
|
+
const request_ts_1 = __webpack_require__(94600);
|
|
25907
|
+
/**
|
|
25908
|
+
* sharedev CLI 自身版本升级检查(仅供 cli 启动调用,不暴露为命令,不含日志/交互)。
|
|
25909
|
+
* - 拉取远端 manifest,按 minVersion 判定是否强制升级
|
|
25910
|
+
* - 任何异常都吞掉并写入 errorMessage,不影响命令执行(拉取失败不阻断,交由调用方降级)
|
|
25911
|
+
* 判定:
|
|
25912
|
+
* - compareSemver(current, minVersion) < 0 -> 'forced'(强制升级拦截)
|
|
25913
|
+
* - 其余 -> 'none'
|
|
25914
|
+
*/
|
|
25915
|
+
const cliUpdateCheckService = async (currentVersion, signal) => {
|
|
25916
|
+
// 当前版本缺失时无法判定,直接返回 none
|
|
25917
|
+
if (!currentVersion) {
|
|
25918
|
+
return { status: 'none', currentVersion: '', errorMessage: '' };
|
|
25919
|
+
}
|
|
25920
|
+
try {
|
|
25921
|
+
const manifest = await (0, request_ts_1.requestCliUpdateManifest)(signal);
|
|
25922
|
+
// 低于最低支持版本 -> 强制升级
|
|
25923
|
+
if (normalize_ts_1.default.compareSemver(currentVersion, manifest.minVersion) < 0) {
|
|
25924
|
+
return { status: 'forced', currentVersion, manifest, errorMessage: '' };
|
|
25925
|
+
}
|
|
25926
|
+
return { status: 'none', currentVersion, manifest, errorMessage: '' };
|
|
25927
|
+
}
|
|
25928
|
+
catch (error) {
|
|
25929
|
+
return {
|
|
25930
|
+
status: 'none',
|
|
25931
|
+
currentVersion,
|
|
25932
|
+
errorMessage: error instanceof Error ? error.message : String(error)
|
|
25933
|
+
};
|
|
25934
|
+
}
|
|
25935
|
+
};
|
|
25936
|
+
exports.cliUpdateCheckService = cliUpdateCheckService;
|
|
25937
|
+
|
|
25938
|
+
|
|
25939
|
+
/***/ },
|
|
25940
|
+
|
|
25941
|
+
/***/ 94600
|
|
25942
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
25943
|
+
|
|
25944
|
+
var __webpack_unused_export__;
|
|
25945
|
+
|
|
25946
|
+
__webpack_unused_export__ = ({ value: true });
|
|
25947
|
+
exports.requestCliUpdateManifest = void 0;
|
|
25948
|
+
const request_ts_1 = __webpack_require__(83733);
|
|
25949
|
+
const cli_update_config_ts_1 = __webpack_require__(38749);
|
|
25950
|
+
/**
|
|
25951
|
+
* 拉取 sharedev CLI 自身版本升级的远端 manifest。
|
|
25952
|
+
* 复用 requestService.fetch(干净请求,不带业务 baseURL/Authorization,仅保留 trace 与 debug)。
|
|
25953
|
+
* @param signal 可选 AbortSignal,用于启动检查时加超时控制
|
|
25954
|
+
*/
|
|
25955
|
+
const requestCliUpdateManifest = async (signal) => {
|
|
25956
|
+
let data;
|
|
25957
|
+
try {
|
|
25958
|
+
data = await request_ts_1.requestService.fetch(cli_update_config_ts_1.CLI_UPDATE_MANIFEST_URL, { signal }, { noDebug: true });
|
|
25959
|
+
}
|
|
25960
|
+
catch (error) {
|
|
25961
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
25962
|
+
throw new Error(`Failed to fetch cli update manifest: ${message}`);
|
|
25963
|
+
}
|
|
25964
|
+
if (!data || !data.minVersion) {
|
|
25965
|
+
throw new Error('Invalid cli update manifest: missing minVersion field.');
|
|
25966
|
+
}
|
|
25967
|
+
return data;
|
|
25968
|
+
};
|
|
25969
|
+
exports.requestCliUpdateManifest = requestCliUpdateManifest;
|
|
25970
|
+
|
|
25971
|
+
|
|
26082
25972
|
/***/ },
|
|
26083
25973
|
|
|
26084
25974
|
/***/ 81610
|
|
@@ -50636,8 +50526,8 @@ async function readCliPackageMeta() {
|
|
|
50636
50526
|
? "@share-crm/sharedev-cli".trim()
|
|
50637
50527
|
: '@share-crm/sharedev-cli';
|
|
50638
50528
|
const debugEnabled = true && Boolean(false);
|
|
50639
|
-
const rawVersion = ( true && "0.0.4-rc.
|
|
50640
|
-
? "0.0.4-rc.
|
|
50529
|
+
const rawVersion = ( true && "0.0.4-rc.54".trim())
|
|
50530
|
+
? "0.0.4-rc.54".trim()
|
|
50641
50531
|
: '0.0.0';
|
|
50642
50532
|
const version = rawVersion + (debugEnabled ? '-debug' : '');
|
|
50643
50533
|
return { name, version };
|
|
@@ -51844,13 +51734,6 @@ module.exports = __WEBPACK_EXTERNAL_createRequire_require("node:fs/promises");
|
|
|
51844
51734
|
|
|
51845
51735
|
/***/ },
|
|
51846
51736
|
|
|
51847
|
-
/***/ 44708
|
|
51848
|
-
(module) {
|
|
51849
|
-
|
|
51850
|
-
module.exports = __WEBPACK_EXTERNAL_createRequire_require("node:https");
|
|
51851
|
-
|
|
51852
|
-
/***/ },
|
|
51853
|
-
|
|
51854
51737
|
/***/ 98995
|
|
51855
51738
|
(module) {
|
|
51856
51739
|
|
|
@@ -67804,10 +67687,185 @@ module.exports = /*#__PURE__*/JSON.parse('{"application/1d-interleaved-parityfec
|
|
|
67804
67687
|
/******/ })();
|
|
67805
67688
|
/******/
|
|
67806
67689
|
/************************************************************************/
|
|
67807
|
-
|
|
67808
|
-
|
|
67809
|
-
|
|
67810
|
-
|
|
67811
|
-
|
|
67812
|
-
|
|
67813
|
-
|
|
67690
|
+
let __webpack_exports__ = {};
|
|
67691
|
+
// This entry needs to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
|
|
67692
|
+
(() => {
|
|
67693
|
+
let exports = __webpack_exports__;
|
|
67694
|
+
//#!/usr/bin/env node
|
|
67695
|
+
|
|
67696
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
67697
|
+
// 默认抑制所有 Node 警告;debug 构建产物或显式 --debug 时放开,方便排查依赖弃用/运行告警
|
|
67698
|
+
const isDebugBuild = true && false;
|
|
67699
|
+
if (!process.argv.includes('--debug') && !isDebugBuild) {
|
|
67700
|
+
process.removeAllListeners('warning');
|
|
67701
|
+
process.on('warning', () => { });
|
|
67702
|
+
}
|
|
67703
|
+
const commander_1 = __webpack_require__(63219);
|
|
67704
|
+
const index_ts_1 = __webpack_require__(22841);
|
|
67705
|
+
const context_ts_1 = __webpack_require__(29531);
|
|
67706
|
+
const logger_ts_1 = __webpack_require__(87562);
|
|
67707
|
+
const request_ts_1 = __webpack_require__(83733);
|
|
67708
|
+
const pkgMeta_ts_1 = __webpack_require__(48559);
|
|
67709
|
+
const debug_ts_1 = __webpack_require__(90667);
|
|
67710
|
+
const index_ts_2 = __webpack_require__(45606);
|
|
67711
|
+
const cli_update_check_ts_1 = __webpack_require__(17295);
|
|
67712
|
+
const trace_ts_1 = __webpack_require__(36097);
|
|
67713
|
+
function readBootstrapOptions() {
|
|
67714
|
+
const args = process.argv.slice(2);
|
|
67715
|
+
return {
|
|
67716
|
+
debug: args.includes('--debug')
|
|
67717
|
+
};
|
|
67718
|
+
}
|
|
67719
|
+
function createHelpRuntimeContext() {
|
|
67720
|
+
const cwd = process.cwd();
|
|
67721
|
+
return {
|
|
67722
|
+
cwd,
|
|
67723
|
+
verbose: false,
|
|
67724
|
+
settings: {
|
|
67725
|
+
certificate: '',
|
|
67726
|
+
domain: 'https://help.invalid',
|
|
67727
|
+
developerName: '',
|
|
67728
|
+
developerMobile: '',
|
|
67729
|
+
specVersion: '',
|
|
67730
|
+
settingsPath: '',
|
|
67731
|
+
settingsDir: cwd
|
|
67732
|
+
},
|
|
67733
|
+
workspaceRoot: cwd
|
|
67734
|
+
};
|
|
67735
|
+
}
|
|
67736
|
+
function isHelpRequest(argv) {
|
|
67737
|
+
return argv.slice(2).some((arg) => arg === '--help' || arg === '-h');
|
|
67738
|
+
}
|
|
67739
|
+
function isVersionRequest(argv) {
|
|
67740
|
+
return argv.slice(2).some((arg) => arg === '--version' || arg === '-v');
|
|
67741
|
+
}
|
|
67742
|
+
function resolveCommandPath(argv) {
|
|
67743
|
+
const args = argv.slice(2);
|
|
67744
|
+
const path = [];
|
|
67745
|
+
const valueOptions = new Set(['--ea', '--domain', '--certificate', '--platform']);
|
|
67746
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
67747
|
+
const token = args[i];
|
|
67748
|
+
if (!token.startsWith('-')) {
|
|
67749
|
+
path.push(token);
|
|
67750
|
+
if (path.length === 2) {
|
|
67751
|
+
break;
|
|
67752
|
+
}
|
|
67753
|
+
continue;
|
|
67754
|
+
}
|
|
67755
|
+
if (token.startsWith('--')) {
|
|
67756
|
+
const [name] = token.split('=');
|
|
67757
|
+
if (valueOptions.has(name) && !token.includes('=')) {
|
|
67758
|
+
i += 1;
|
|
67759
|
+
}
|
|
67760
|
+
continue;
|
|
67761
|
+
}
|
|
67762
|
+
if (token === '-y' || token === '-h') {
|
|
67763
|
+
continue;
|
|
67764
|
+
}
|
|
67765
|
+
}
|
|
67766
|
+
return path;
|
|
67767
|
+
}
|
|
67768
|
+
function shouldSkipSettings(argv) {
|
|
67769
|
+
if (isHelpRequest(argv)) {
|
|
67770
|
+
return true;
|
|
67771
|
+
}
|
|
67772
|
+
if (isVersionRequest(argv)) {
|
|
67773
|
+
return true;
|
|
67774
|
+
}
|
|
67775
|
+
const commandPath = resolveCommandPath(argv);
|
|
67776
|
+
return commandPath[0] === 'init' || commandPath[0] === 'config' || commandPath[0] === 'completion' || commandPath[0] === 'spec';
|
|
67777
|
+
}
|
|
67778
|
+
async function checkForCliUpdate(packageName, currentVersion) {
|
|
67779
|
+
const controller = new AbortController();
|
|
67780
|
+
const timeout = setTimeout(() => controller.abort(), 1500);
|
|
67781
|
+
try {
|
|
67782
|
+
const result = await (0, cli_update_check_ts_1.cliUpdateCheckService)(currentVersion, controller.signal);
|
|
67783
|
+
// 每次版本检查都上报埋点(漏斗起点)
|
|
67784
|
+
(0, trace_ts_1.traceCliUpdate)('check', currentVersion, result.manifest?.minVersion);
|
|
67785
|
+
if (result.status === 'forced' && result.manifest) {
|
|
67786
|
+
// 命中强制升级:上报 + 醒目提示,阻断命令执行(由调用方 return)
|
|
67787
|
+
(0, trace_ts_1.traceCliUpdate)('forced', currentVersion, result.manifest.minVersion);
|
|
67788
|
+
logger_ts_1.loggerService.error(`This version of ${packageName} (${currentVersion}) is no longer supported. ` +
|
|
67789
|
+
`Please upgrade to at least ${result.manifest.minVersion} by running: npm i -g ${packageName}`);
|
|
67790
|
+
return true;
|
|
67791
|
+
}
|
|
67792
|
+
return false;
|
|
67793
|
+
}
|
|
67794
|
+
catch {
|
|
67795
|
+
// 拉取失败不阻断,静默降级
|
|
67796
|
+
return false;
|
|
67797
|
+
}
|
|
67798
|
+
finally {
|
|
67799
|
+
clearTimeout(timeout);
|
|
67800
|
+
}
|
|
67801
|
+
}
|
|
67802
|
+
async function checkForSpecUpdate(localSpecVersion) {
|
|
67803
|
+
// 本地未安装 spec 模板时无需提示更新
|
|
67804
|
+
if (!localSpecVersion) {
|
|
67805
|
+
return;
|
|
67806
|
+
}
|
|
67807
|
+
try {
|
|
67808
|
+
const controller = new AbortController();
|
|
67809
|
+
const timeout = setTimeout(() => controller.abort(), 1500);
|
|
67810
|
+
const result = await (0, index_ts_2.specCheckService)(localSpecVersion, controller.signal);
|
|
67811
|
+
clearTimeout(timeout);
|
|
67812
|
+
if (result.hasUpdate && result.manifest) {
|
|
67813
|
+
logger_ts_1.loggerService.warn(`A newer spec template is available: ${localSpecVersion} -> ${result.manifest.version}. Run: sharedev spec update`);
|
|
67814
|
+
}
|
|
67815
|
+
}
|
|
67816
|
+
catch {
|
|
67817
|
+
// Ignore spec version-check errors to avoid impacting command execution.
|
|
67818
|
+
}
|
|
67819
|
+
}
|
|
67820
|
+
async function bootstrap() {
|
|
67821
|
+
const bootstrapOptions = readBootstrapOptions();
|
|
67822
|
+
const pkgMeta = await (0, pkgMeta_ts_1.readCliPackageMeta)();
|
|
67823
|
+
const version = pkgMeta.version;
|
|
67824
|
+
const program = new commander_1.Command();
|
|
67825
|
+
program
|
|
67826
|
+
.name('sharedev')
|
|
67827
|
+
.description('sharedev command line tool')
|
|
67828
|
+
.version(version, '-v, --version', 'output the current version')
|
|
67829
|
+
.option('--debug', 'enable trace debug output for current command')
|
|
67830
|
+
.showHelpAfterError(true);
|
|
67831
|
+
(0, debug_ts_1.setRuntimeDebugEnabled)(Boolean(bootstrapOptions.debug));
|
|
67832
|
+
logger_ts_1.loggerService.debug('You are in debug mode; ignore any cli version gap versus the release build.');
|
|
67833
|
+
if (shouldSkipSettings(process.argv)) {
|
|
67834
|
+
(0, index_ts_1.registerNamespaces)(program, createHelpRuntimeContext());
|
|
67835
|
+
// --version 放行,方便用户确认自身版本;其余场景(含 help)也执行强制升级检查
|
|
67836
|
+
if (!isVersionRequest(process.argv)) {
|
|
67837
|
+
const forced = await checkForCliUpdate(pkgMeta.name, version);
|
|
67838
|
+
if (forced) {
|
|
67839
|
+
process.exitCode = 1;
|
|
67840
|
+
return;
|
|
67841
|
+
}
|
|
67842
|
+
}
|
|
67843
|
+
await program.parseAsync(process.argv, { from: 'node' });
|
|
67844
|
+
logger_ts_1.loggerService.printTraceIdsIfNeeded('');
|
|
67845
|
+
return;
|
|
67846
|
+
}
|
|
67847
|
+
const runtimeContext = await (0, context_ts_1.createCliRuntimeContext)(bootstrapOptions);
|
|
67848
|
+
request_ts_1.requestService.configure(runtimeContext.settings);
|
|
67849
|
+
// 强制升级检查:命中即阻断,不再执行任何命令(全拦,仅 --version 放行)
|
|
67850
|
+
const forcedUpdate = await checkForCliUpdate(pkgMeta.name, version);
|
|
67851
|
+
if (forcedUpdate) {
|
|
67852
|
+
process.exitCode = 1;
|
|
67853
|
+
return;
|
|
67854
|
+
}
|
|
67855
|
+
// spec 版本检查(带 1.5s 超时,错误吞掉,不影响命令执行)
|
|
67856
|
+
await checkForSpecUpdate(runtimeContext.settings.specVersion);
|
|
67857
|
+
(0, index_ts_1.registerNamespaces)(program, runtimeContext);
|
|
67858
|
+
await program.parseAsync(process.argv, { from: 'node' });
|
|
67859
|
+
logger_ts_1.loggerService.printTraceIdsIfNeeded('');
|
|
67860
|
+
}
|
|
67861
|
+
bootstrap().catch((error) => {
|
|
67862
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
67863
|
+
logger_ts_1.loggerService.error(message);
|
|
67864
|
+
process.exitCode = 1;
|
|
67865
|
+
});
|
|
67866
|
+
|
|
67867
|
+
})();
|
|
67868
|
+
|
|
67869
|
+
const __webpack_exports___esModule = __webpack_exports__.__esModule;
|
|
67870
|
+
export { __webpack_exports___esModule as __esModule };
|
|
67871
|
+
export default __webpack_exports__;
|