openxiangda 1.0.185 → 1.0.187
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/lib/application-environments.js +8 -0
- package/lib/change-baseline.js +27 -2
- package/lib/cli.js +24 -15
- package/lib/publish-lease.js +12 -6
- package/package.json +1 -1
|
@@ -376,6 +376,13 @@ function withManagedReleaseForwardedFlags(stepId, args = [], flags = {}) {
|
|
|
376
376
|
return forwarded;
|
|
377
377
|
}
|
|
378
378
|
|
|
379
|
+
function withReleaseClientSessionArgs(args = [], flags = {}) {
|
|
380
|
+
const clientSessionId = String(flags['client-session-id'] || '').trim();
|
|
381
|
+
return clientSessionId
|
|
382
|
+
? [...args, '--client-session-id', clientSessionId]
|
|
383
|
+
: [...args];
|
|
384
|
+
}
|
|
385
|
+
|
|
379
386
|
module.exports = {
|
|
380
387
|
bindEnvironmentTarget,
|
|
381
388
|
buildCandidateBundle,
|
|
@@ -393,5 +400,6 @@ module.exports = {
|
|
|
393
400
|
saveCandidate,
|
|
394
401
|
sha256Canonical,
|
|
395
402
|
withManagedReleaseForwardedFlags,
|
|
403
|
+
withReleaseClientSessionArgs,
|
|
396
404
|
writePrivateJsonAtomic,
|
|
397
405
|
};
|
package/lib/change-baseline.js
CHANGED
|
@@ -806,7 +806,8 @@ function assertTargetIdentity(target) {
|
|
|
806
806
|
);
|
|
807
807
|
}
|
|
808
808
|
const boundAppType = normalizeOptionalString(target.bound.appType);
|
|
809
|
-
const
|
|
809
|
+
const managedStateBound = resolveManagedStateBinding(target, appType);
|
|
810
|
+
const stateBound = managedStateBound || target.state.profiles?.[profile];
|
|
810
811
|
const stateAppType = normalizeOptionalString(stateBound?.appType);
|
|
811
812
|
if (
|
|
812
813
|
(boundAppType && boundAppType !== appType) ||
|
|
@@ -820,6 +821,26 @@ function assertTargetIdentity(target) {
|
|
|
820
821
|
return { appType, profile };
|
|
821
822
|
}
|
|
822
823
|
|
|
824
|
+
function resolveManagedStateBinding(target, appType) {
|
|
825
|
+
const targetName = normalizeOptionalString(target?.targetName);
|
|
826
|
+
if (!targetName) return null;
|
|
827
|
+
const binding = target.state?.targets?.[targetName];
|
|
828
|
+
const bindingAppType = normalizeOptionalString(binding?.appType);
|
|
829
|
+
const environmentId = normalizeOptionalString(target.environmentId);
|
|
830
|
+
const bindingEnvironmentId = normalizeOptionalString(binding?.environmentId);
|
|
831
|
+
if (
|
|
832
|
+
!binding ||
|
|
833
|
+
bindingAppType !== appType ||
|
|
834
|
+
(environmentId && bindingEnvironmentId !== environmentId)
|
|
835
|
+
) {
|
|
836
|
+
throw changeBaselineError(
|
|
837
|
+
'CHANGE_BASELINE_TARGET_INVALID',
|
|
838
|
+
`change baseline managed target ${targetName} 与 state.targets binding 不一致`
|
|
839
|
+
);
|
|
840
|
+
}
|
|
841
|
+
return binding;
|
|
842
|
+
}
|
|
843
|
+
|
|
823
844
|
function assertInputIdentity(input, identity) {
|
|
824
845
|
const appType = normalizeOptionalString(input.appType);
|
|
825
846
|
const profile = normalizeOptionalString(input.profile);
|
|
@@ -839,7 +860,11 @@ function assertInputIdentity(input, identity) {
|
|
|
839
860
|
|
|
840
861
|
function persistTargetState(target, options) {
|
|
841
862
|
target.bound.updatedAt = normalizeNow(options.now);
|
|
842
|
-
|
|
863
|
+
const targetName = normalizeOptionalString(target.targetName);
|
|
864
|
+
if (targetName) {
|
|
865
|
+
target.state.targets ||= {};
|
|
866
|
+
target.state.targets[targetName] = target.bound;
|
|
867
|
+
} else if (target.state.profiles?.[target.profileName]) {
|
|
843
868
|
target.state.profiles[target.profileName] = target.bound;
|
|
844
869
|
}
|
|
845
870
|
(options.saveState || saveProjectState)(
|
package/lib/cli.js
CHANGED
|
@@ -141,6 +141,7 @@ const {
|
|
|
141
141
|
saveCandidate,
|
|
142
142
|
sha256Canonical,
|
|
143
143
|
withManagedReleaseForwardedFlags,
|
|
144
|
+
withReleaseClientSessionArgs,
|
|
144
145
|
} = require('./application-environments');
|
|
145
146
|
const { startDeveloperCenter } = require('./developer-center');
|
|
146
147
|
const {
|
|
@@ -1472,6 +1473,7 @@ function changeIdFromStep(step) {
|
|
|
1472
1473
|
async function publishWorkspaceRelease(config, target, flags = {}) {
|
|
1473
1474
|
const changeId = readStringFlag(flags, 'change');
|
|
1474
1475
|
const deploymentId = readStringFlag(flags, 'deployment-id') || null;
|
|
1476
|
+
const clientSessionId = readStringFlag(flags, 'client-session-id');
|
|
1475
1477
|
if (!changeId) {
|
|
1476
1478
|
fail('用法: openxiangda release publish --change <id> --profile <name>');
|
|
1477
1479
|
}
|
|
@@ -1614,6 +1616,10 @@ async function publishWorkspaceRelease(config, target, flags = {}) {
|
|
|
1614
1616
|
id: 'lease-and-capture',
|
|
1615
1617
|
command: `openxiangda release begin --change ${changeId} --profile ${target.profileName}${
|
|
1616
1618
|
target.targetName ? ` --environment ${target.targetName}` : ''
|
|
1619
|
+
}${
|
|
1620
|
+
clientSessionId
|
|
1621
|
+
? ` --client-session-id ${clientSessionId}`
|
|
1622
|
+
: ''
|
|
1617
1623
|
} --freeze-app-capture`,
|
|
1618
1624
|
status: 'pending',
|
|
1619
1625
|
},
|
|
@@ -1659,21 +1665,24 @@ async function publishWorkspaceRelease(config, target, flags = {}) {
|
|
|
1659
1665
|
const runnable = [
|
|
1660
1666
|
{
|
|
1661
1667
|
id: 'lease-and-capture',
|
|
1662
|
-
args:
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1668
|
+
args: withReleaseClientSessionArgs(
|
|
1669
|
+
[
|
|
1670
|
+
'release',
|
|
1671
|
+
'begin',
|
|
1672
|
+
'--change',
|
|
1673
|
+
changeId,
|
|
1674
|
+
'--profile',
|
|
1675
|
+
target.profileName,
|
|
1676
|
+
...(target.targetName
|
|
1677
|
+
? ['--environment', target.targetName]
|
|
1678
|
+
: []),
|
|
1679
|
+
...(deploymentId
|
|
1680
|
+
? ['--deployment-id', deploymentId]
|
|
1681
|
+
: []),
|
|
1682
|
+
'--freeze-app-capture',
|
|
1683
|
+
],
|
|
1684
|
+
flags
|
|
1685
|
+
),
|
|
1677
1686
|
},
|
|
1678
1687
|
...steps,
|
|
1679
1688
|
{
|
package/lib/publish-lease.js
CHANGED
|
@@ -63,9 +63,7 @@ function savePublishLease(target, input, options = {}) {
|
|
|
63
63
|
publishLease: lease,
|
|
64
64
|
};
|
|
65
65
|
target.bound.updatedAt = new Date().toISOString();
|
|
66
|
-
|
|
67
|
-
target.state.profiles[target.profileName] = target.bound;
|
|
68
|
-
}
|
|
66
|
+
persistTargetBinding(target);
|
|
69
67
|
(options.saveState || saveProjectState)(target.state, options.cwd || process.cwd());
|
|
70
68
|
return lease;
|
|
71
69
|
}
|
|
@@ -80,13 +78,21 @@ function clearPublishLease(target, leaseId, options = {}) {
|
|
|
80
78
|
delete target.bound.promotion;
|
|
81
79
|
}
|
|
82
80
|
target.bound.updatedAt = new Date().toISOString();
|
|
83
|
-
|
|
84
|
-
target.state.profiles[target.profileName] = target.bound;
|
|
85
|
-
}
|
|
81
|
+
persistTargetBinding(target);
|
|
86
82
|
(options.saveState || saveProjectState)(target.state, options.cwd || process.cwd());
|
|
87
83
|
return true;
|
|
88
84
|
}
|
|
89
85
|
|
|
86
|
+
function persistTargetBinding(target) {
|
|
87
|
+
const targetName = String(target?.targetName || '').trim();
|
|
88
|
+
if (targetName) {
|
|
89
|
+
target.state.targets ||= {};
|
|
90
|
+
target.state.targets[targetName] = target.bound;
|
|
91
|
+
} else if (target.state.profiles?.[target.profileName]) {
|
|
92
|
+
target.state.profiles[target.profileName] = target.bound;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
90
96
|
function normalizePublishLease(input, target) {
|
|
91
97
|
const leaseId = String(input?.leaseId || '').trim();
|
|
92
98
|
const expiresAt = normalizeDate(input?.expiresAt, 'expiresAt');
|