@apexdevtools/git-ops 1.4.0 → 1.4.1
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/CHANGELOG.md +4 -0
- package/lib/src/tracking.d.ts +2 -0
- package/lib/src/tracking.js +39 -16
- package/lib/test/tracking.spec.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/lib/src/tracking.d.ts
CHANGED
|
@@ -35,6 +35,8 @@ export declare class OrgTracking {
|
|
|
35
35
|
getLocalStatus(withConflicts?: boolean): Promise<SyncStatus>;
|
|
36
36
|
deployAndUpdateSourceTracking(paths: Array<string>): Promise<void>;
|
|
37
37
|
private deploy;
|
|
38
|
+
private reportDeployStatus;
|
|
39
|
+
private reportDeployErrors;
|
|
38
40
|
private updateSourceTracking;
|
|
39
41
|
private toSyncStatusRow;
|
|
40
42
|
private withWorkingDir;
|
package/lib/src/tracking.js
CHANGED
|
@@ -69,33 +69,55 @@ class OrgTracking {
|
|
|
69
69
|
deployAndUpdateSourceTracking(paths) {
|
|
70
70
|
return __awaiter(this, void 0, void 0, function* () {
|
|
71
71
|
return yield this.withWorkingDir(this.options.projectDir, () => __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
|
|
73
|
-
.
|
|
74
|
-
|
|
72
|
+
try {
|
|
73
|
+
this.logger.logDeployProgress('Starting deploy');
|
|
74
|
+
const result = yield this.deploy(paths);
|
|
75
|
+
if (result.response.success) {
|
|
76
|
+
yield this.updateSourceTracking(result);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
this.reportDeployErrors(result);
|
|
80
|
+
}
|
|
81
|
+
this.logger.logDeployProgress('Finished deploy');
|
|
82
|
+
}
|
|
83
|
+
catch (e) {
|
|
84
|
+
this.logger.logError(e);
|
|
85
|
+
}
|
|
75
86
|
}));
|
|
76
87
|
});
|
|
77
88
|
}
|
|
78
89
|
deploy(paths) {
|
|
79
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
const
|
|
81
|
-
const deploy = yield set.deploy({
|
|
91
|
+
const deploy = yield source_deploy_retrieve_1.ComponentSet.fromSource(paths).deploy({
|
|
82
92
|
usernameOrConnection: this.options.connection,
|
|
83
93
|
});
|
|
84
|
-
this.
|
|
85
|
-
deploy.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const message = `Status: ${status} Progress: ${progress}`;
|
|
89
|
-
this.logger.logDeployProgress(message);
|
|
90
|
-
});
|
|
91
|
-
return yield deploy.pollStatus().then(res => {
|
|
92
|
-
this.logger.logMessage('Finished deploy');
|
|
93
|
-
return res;
|
|
94
|
-
});
|
|
94
|
+
deploy.onUpdate(response => this.reportDeployStatus(response));
|
|
95
|
+
const result = yield deploy.pollStatus();
|
|
96
|
+
this.reportDeployStatus(result.response);
|
|
97
|
+
return result;
|
|
95
98
|
});
|
|
96
99
|
}
|
|
100
|
+
reportDeployStatus(response) {
|
|
101
|
+
const { status, numberComponentsDeployed, numberComponentsTotal, numberComponentErrors, } = response;
|
|
102
|
+
const progress = `${numberComponentsDeployed}/${numberComponentsTotal}`;
|
|
103
|
+
const message = `Status: ${status} | Progress: ${progress} | Errors: ${numberComponentErrors}`;
|
|
104
|
+
this.logger.logDeployProgress(message);
|
|
105
|
+
}
|
|
106
|
+
reportDeployErrors(result) {
|
|
107
|
+
const errors = result.getFileResponses().reduce((a, c) => {
|
|
108
|
+
if (c.state === source_deploy_retrieve_1.ComponentStatus.Failed) {
|
|
109
|
+
a.push(new Error(`${c.fullName}: ${c.error}`));
|
|
110
|
+
}
|
|
111
|
+
return a;
|
|
112
|
+
}, []);
|
|
113
|
+
if (errors.length) {
|
|
114
|
+
this.logger.logDeployProgress('Deploy errors:');
|
|
115
|
+
errors.forEach(err => this.logger.logError(err));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
97
118
|
updateSourceTracking(result) {
|
|
98
119
|
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
this.logger.logDeployProgress('Starting source tracking update');
|
|
99
121
|
const project = core_1.SfProject.getInstance(this.options.projectDir);
|
|
100
122
|
const org = yield core_1.Org.create({ connection: this.options.connection });
|
|
101
123
|
const tracking = yield source_tracking_1.SourceTracking.create({
|
|
@@ -104,6 +126,7 @@ class OrgTracking {
|
|
|
104
126
|
ignoreLocalCache: true,
|
|
105
127
|
});
|
|
106
128
|
yield tracking.updateTrackingFromDeploy(result);
|
|
129
|
+
this.logger.logDeployProgress('Finished source tracking update');
|
|
107
130
|
});
|
|
108
131
|
}
|
|
109
132
|
toSyncStatusRow(from) {
|
|
@@ -105,7 +105,7 @@ const mockDeploy = {
|
|
|
105
105
|
.fn()
|
|
106
106
|
.mockImplementation(() => Promise.resolve(mockDeployResult)),
|
|
107
107
|
};
|
|
108
|
-
const mockDeployResult = {
|
|
108
|
+
const mockDeployResult = { response: { success: true } };
|
|
109
109
|
const mockComponentSet = {
|
|
110
110
|
deploy: jest
|
|
111
111
|
.fn()
|