deploy-vir 0.2.1 → 0.2.3
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 +8 -4
- package/package.json +1 -1
- package/src/git.ts +11 -6
package/dist/git.js
CHANGED
|
@@ -49,7 +49,7 @@ export async function pushDeploy(git, { deployName, fromBranch, toBranch }, remo
|
|
|
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
51
|
const commitsAhead = (await git.log([
|
|
52
|
-
|
|
52
|
+
`${remoteName}/${toBranch}..${remoteName}/${fromBranch}`,
|
|
53
53
|
])).all;
|
|
54
54
|
if (!commitsAhead.length) {
|
|
55
55
|
throw new KnownError('No commit diff: nothing to deploy!');
|
|
@@ -71,15 +71,19 @@ export async function pushDeploy(git, { deployName, fromBranch, toBranch }, remo
|
|
|
71
71
|
log.error(`Push failed: ${extractErrorMessage(error)}`);
|
|
72
72
|
/** Get commits that are on {@link toBranch} but not on {@link fromBranch}. */
|
|
73
73
|
const commitsBehind = (await git.log([
|
|
74
|
-
|
|
74
|
+
`${remoteName}/${fromBranch}..${remoteName}/${toBranch}`,
|
|
75
75
|
])).all;
|
|
76
76
|
if (commitsBehind.length > 0) {
|
|
77
|
-
log.info(`\
|
|
77
|
+
log.info(`\nOnly on ${logColors.bold}${fromBranch}${logColors.reset}:`);
|
|
78
|
+
commitsAhead.forEach((commit, index) => {
|
|
79
|
+
log.faint(` ${index + 1}. ${commit.hash.slice(0, 7)} (${commit.author_name}) - ${commit.message}`);
|
|
80
|
+
});
|
|
81
|
+
log.info(`\nOnly on ${logColors.bold}${toBranch}${logColors.reset}:`);
|
|
78
82
|
commitsBehind.forEach((commit, index) => {
|
|
79
83
|
log.faint(` ${index + 1}. ${commit.hash.slice(0, 7)} (${commit.author_name}) - ${commit.message}`);
|
|
80
84
|
});
|
|
81
85
|
}
|
|
82
|
-
const shouldForcePush = await askQuestion(`\nDo you want to force push ${logColors.bold}${fromBranch}${logColors.reset} to ${logColors.bold}${toBranch}${logColors.reset}?\n\n${logColors.warning}This will overwrite the commits
|
|
86
|
+
const shouldForcePush = await askQuestion(`\nDo you want to force push ${logColors.bold}${fromBranch}${logColors.reset} to ${logColors.bold}${toBranch}${logColors.reset}?\n\n${logColors.warning}This will overwrite the commits only on ${logColors.bold}${toBranch}${logColors.reset}.${logColors.reset} (y/N): `);
|
|
83
87
|
if (shouldForcePush.toLowerCase() === 'y' || shouldForcePush.toLowerCase() === 'yes') {
|
|
84
88
|
await git.push(remoteName, pushString, ['--force']);
|
|
85
89
|
log.warning(`Force pushed ${logColors.bold}${fromBranch}${logColors.reset} to ${logColors.bold}${toBranch}${logColors.reset}.`);
|
package/package.json
CHANGED
package/src/git.ts
CHANGED
|
@@ -126,7 +126,7 @@ export async function pushDeploy(
|
|
|
126
126
|
/** Get commits that are on {@link toBranch} but not on {@link fromBranch}. */
|
|
127
127
|
const commitsAhead = (
|
|
128
128
|
await git.log([
|
|
129
|
-
|
|
129
|
+
`${remoteName}/${toBranch}..${remoteName}/${fromBranch}`,
|
|
130
130
|
])
|
|
131
131
|
).all;
|
|
132
132
|
|
|
@@ -153,14 +153,19 @@ export async function pushDeploy(
|
|
|
153
153
|
/** Get commits that are on {@link toBranch} but not on {@link fromBranch}. */
|
|
154
154
|
const commitsBehind = (
|
|
155
155
|
await git.log([
|
|
156
|
-
|
|
156
|
+
`${remoteName}/${fromBranch}..${remoteName}/${toBranch}`,
|
|
157
157
|
])
|
|
158
158
|
).all;
|
|
159
159
|
|
|
160
160
|
if (commitsBehind.length > 0) {
|
|
161
|
-
log.info(
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
log.info(`\nOnly on ${logColors.bold}${fromBranch}${logColors.reset}:`);
|
|
162
|
+
commitsAhead.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(`\nOnly on ${logColors.bold}${toBranch}${logColors.reset}:`);
|
|
164
169
|
commitsBehind.forEach((commit, index) => {
|
|
165
170
|
log.faint(
|
|
166
171
|
` ${index + 1}. ${commit.hash.slice(0, 7)} (${commit.author_name}) - ${commit.message}`,
|
|
@@ -169,7 +174,7 @@ export async function pushDeploy(
|
|
|
169
174
|
}
|
|
170
175
|
|
|
171
176
|
const shouldForcePush = await askQuestion(
|
|
172
|
-
`\nDo you want to force push ${logColors.bold}${fromBranch}${logColors.reset} to ${logColors.bold}${toBranch}${logColors.reset}?\n\n${logColors.warning}This will overwrite the commits
|
|
177
|
+
`\nDo you want to force push ${logColors.bold}${fromBranch}${logColors.reset} to ${logColors.bold}${toBranch}${logColors.reset}?\n\n${logColors.warning}This will overwrite the commits only on ${logColors.bold}${toBranch}${logColors.reset}.${logColors.reset} (y/N): `,
|
|
173
178
|
);
|
|
174
179
|
|
|
175
180
|
if (shouldForcePush.toLowerCase() === 'y' || shouldForcePush.toLowerCase() === 'yes') {
|