deploy-vir 0.2.0 → 0.2.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/dist/git.js +10 -12
- package/package.json +1 -1
- package/src/git.ts +12 -12
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,12 @@ 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
|
-
commitsBehind.all.forEach((commit, index) => {
|
|
73
|
+
const commitsBehind = (await git.log([
|
|
74
|
+
'${remoteName}/${fromBranch}..${remoteName}/${toBranch}',
|
|
75
|
+
])).all;
|
|
76
|
+
if (commitsBehind.length > 0) {
|
|
77
|
+
log.info(`\nThe following ${commitsBehind.length} commit${commitsBehind.length === 1 ? '' : 's'} are on ${logColors.bold}${toBranch}${logColors.reset} but not on ${logColors.bold}${fromBranch}${logColors.reset}:`);
|
|
78
|
+
commitsBehind.forEach((commit, index) => {
|
|
81
79
|
log.faint(` ${index + 1}. ${commit.hash.slice(0, 7)} (${commit.author_name}) - ${commit.message}`);
|
|
82
80
|
});
|
|
83
81
|
}
|
|
@@ -92,7 +90,7 @@ export async function pushDeploy(git, { deployName, fromBranch, toBranch }, remo
|
|
|
92
90
|
return {
|
|
93
91
|
deployCommits: {
|
|
94
92
|
deployedCommits: commitsAhead,
|
|
95
|
-
overwrittenCommits: commitsBehind
|
|
93
|
+
overwrittenCommits: commitsBehind,
|
|
96
94
|
},
|
|
97
95
|
branchStatus: {
|
|
98
96
|
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,17 @@ 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
|
-
|
|
154
|
+
const commitsBehind = (
|
|
155
|
+
await git.log([
|
|
156
|
+
'${remoteName}/${fromBranch}..${remoteName}/${toBranch}',
|
|
157
|
+
])
|
|
158
|
+
).all;
|
|
159
159
|
|
|
160
|
-
if (commitsBehind.
|
|
160
|
+
if (commitsBehind.length > 0) {
|
|
161
161
|
log.info(
|
|
162
|
-
`\nThe following ${commitsBehind.
|
|
162
|
+
`\nThe following ${commitsBehind.length} commit${commitsBehind.length === 1 ? '' : 's'} are on ${logColors.bold}${toBranch}${logColors.reset} but not on ${logColors.bold}${fromBranch}${logColors.reset}:`,
|
|
163
163
|
);
|
|
164
|
-
commitsBehind.
|
|
164
|
+
commitsBehind.forEach((commit, index) => {
|
|
165
165
|
log.faint(
|
|
166
166
|
` ${index + 1}. ${commit.hash.slice(0, 7)} (${commit.author_name}) - ${commit.message}`,
|
|
167
167
|
);
|
|
@@ -184,7 +184,7 @@ export async function pushDeploy(
|
|
|
184
184
|
return {
|
|
185
185
|
deployCommits: {
|
|
186
186
|
deployedCommits: commitsAhead,
|
|
187
|
-
overwrittenCommits: commitsBehind
|
|
187
|
+
overwrittenCommits: commitsBehind,
|
|
188
188
|
},
|
|
189
189
|
branchStatus: {
|
|
190
190
|
before: beforeCommit,
|