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 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
- '${remoteName}/${toBranch}..${remoteName}/${fromBranch}',
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
- '${remoteName}/${fromBranch}..${remoteName}/${toBranch}',
74
+ `${remoteName}/${fromBranch}..${remoteName}/${toBranch}`,
75
75
  ])).all;
76
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}:`);
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 listed above.${logColors.reset} (y/N): `);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deploy-vir",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Deploy a branch to another branch with notifications.",
5
5
  "keywords": [
6
6
  "deploy",
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
- '${remoteName}/${toBranch}..${remoteName}/${fromBranch}',
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
- '${remoteName}/${fromBranch}..${remoteName}/${toBranch}',
156
+ `${remoteName}/${fromBranch}..${remoteName}/${toBranch}`,
157
157
  ])
158
158
  ).all;
159
159
 
160
160
  if (commitsBehind.length > 0) {
161
- log.info(
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
- );
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 listed above.${logColors.reset} (y/N): `,
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') {