deploy-vir 0.2.0 → 0.2.2
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/git.js +14 -12
- package/package.json +1 -1
- package/src/git.ts +20 -15
package/dist/git.js
CHANGED
|
@@ -48,10 +48,9 @@ export async function pushDeploy(git, { deployName, fromBranch, toBranch }, remo
|
|
|
48
48
|
'-1',
|
|
49
49
|
])).latest, `Failed to get current commit for ${remoteName}/${fromBranch}`);
|
|
50
50
|
/** Get commits that are on {@link toBranch} but not on {@link fromBranch}. */
|
|
51
|
-
const commitsAhead = (await git.log(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
})).all;
|
|
51
|
+
const commitsAhead = (await git.log([
|
|
52
|
+
`${remoteName}/${toBranch}..${remoteName}/${fromBranch}`,
|
|
53
|
+
])).all;
|
|
55
54
|
if (!commitsAhead.length) {
|
|
56
55
|
throw new KnownError('No commit diff: nothing to deploy!');
|
|
57
56
|
}
|
|
@@ -71,13 +70,16 @@ export async function pushDeploy(git, { deployName, fromBranch, toBranch }, remo
|
|
|
71
70
|
catch (error) {
|
|
72
71
|
log.error(`Push failed: ${extractErrorMessage(error)}`);
|
|
73
72
|
/** Get commits that are on {@link toBranch} but not on {@link fromBranch}. */
|
|
74
|
-
const commitsBehind = await git.log(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
73
|
+
const commitsBehind = (await git.log([
|
|
74
|
+
`${remoteName}/${fromBranch}..${remoteName}/${toBranch}`,
|
|
75
|
+
])).all;
|
|
76
|
+
if (commitsBehind.length > 0) {
|
|
77
|
+
log.info(`\nOnn ${logColors.bold}${fromBranch}${logColors.reset}:`);
|
|
78
|
+
commitsBehind.forEach((commit, index) => {
|
|
79
|
+
log.faint(` ${index + 1}. ${commit.hash.slice(0, 7)} (${commit.author_name}) - ${commit.message}`);
|
|
80
|
+
});
|
|
81
|
+
log.info(`\nOnn ${logColors.bold}${toBranch}${logColors.reset}:`);
|
|
82
|
+
commitsBehind.forEach((commit, index) => {
|
|
81
83
|
log.faint(` ${index + 1}. ${commit.hash.slice(0, 7)} (${commit.author_name}) - ${commit.message}`);
|
|
82
84
|
});
|
|
83
85
|
}
|
|
@@ -92,7 +94,7 @@ export async function pushDeploy(git, { deployName, fromBranch, toBranch }, remo
|
|
|
92
94
|
return {
|
|
93
95
|
deployCommits: {
|
|
94
96
|
deployedCommits: commitsAhead,
|
|
95
|
-
overwrittenCommits: commitsBehind
|
|
97
|
+
overwrittenCommits: commitsBehind,
|
|
96
98
|
},
|
|
97
99
|
branchStatus: {
|
|
98
100
|
before: beforeCommit,
|
package/package.json
CHANGED
package/src/git.ts
CHANGED
|
@@ -125,10 +125,9 @@ export async function pushDeploy(
|
|
|
125
125
|
|
|
126
126
|
/** Get commits that are on {@link toBranch} but not on {@link fromBranch}. */
|
|
127
127
|
const commitsAhead = (
|
|
128
|
-
await git.log(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
})
|
|
128
|
+
await git.log([
|
|
129
|
+
`${remoteName}/${toBranch}..${remoteName}/${fromBranch}`,
|
|
130
|
+
])
|
|
132
131
|
).all;
|
|
133
132
|
|
|
134
133
|
if (!commitsAhead.length) {
|
|
@@ -152,16 +151,22 @@ export async function pushDeploy(
|
|
|
152
151
|
log.error(`Push failed: ${extractErrorMessage(error)}`);
|
|
153
152
|
|
|
154
153
|
/** Get commits that are on {@link toBranch} but not on {@link fromBranch}. */
|
|
155
|
-
const commitsBehind =
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
)
|
|
164
|
-
|
|
154
|
+
const commitsBehind = (
|
|
155
|
+
await git.log([
|
|
156
|
+
`${remoteName}/${fromBranch}..${remoteName}/${toBranch}`,
|
|
157
|
+
])
|
|
158
|
+
).all;
|
|
159
|
+
|
|
160
|
+
if (commitsBehind.length > 0) {
|
|
161
|
+
log.info(`\nOnn ${logColors.bold}${fromBranch}${logColors.reset}:`);
|
|
162
|
+
commitsBehind.forEach((commit, index) => {
|
|
163
|
+
log.faint(
|
|
164
|
+
` ${index + 1}. ${commit.hash.slice(0, 7)} (${commit.author_name}) - ${commit.message}`,
|
|
165
|
+
);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
log.info(`\nOnn ${logColors.bold}${toBranch}${logColors.reset}:`);
|
|
169
|
+
commitsBehind.forEach((commit, index) => {
|
|
165
170
|
log.faint(
|
|
166
171
|
` ${index + 1}. ${commit.hash.slice(0, 7)} (${commit.author_name}) - ${commit.message}`,
|
|
167
172
|
);
|
|
@@ -184,7 +189,7 @@ export async function pushDeploy(
|
|
|
184
189
|
return {
|
|
185
190
|
deployCommits: {
|
|
186
191
|
deployedCommits: commitsAhead,
|
|
187
|
-
overwrittenCommits: commitsBehind
|
|
192
|
+
overwrittenCommits: commitsBehind,
|
|
188
193
|
},
|
|
189
194
|
branchStatus: {
|
|
190
195
|
before: beforeCommit,
|