deploy-vir 0.2.3 → 0.2.5

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
@@ -83,7 +83,7 @@ export async function pushDeploy(git, { deployName, fromBranch, toBranch }, remo
83
83
  log.faint(` ${index + 1}. ${commit.hash.slice(0, 7)} (${commit.author_name}) - ${commit.message}`);
84
84
  });
85
85
  }
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): `);
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.normalWeight}.${logColors.reset} (y/N): `);
87
87
  if (shouldForcePush.toLowerCase() === 'y' || shouldForcePush.toLowerCase() === 'yes') {
88
88
  await git.push(remoteName, pushString, ['--force']);
89
89
  log.warning(`Force pushed ${logColors.bold}${fromBranch}${logColors.reset} to ${logColors.bold}${toBranch}${logColors.reset}.`);
@@ -37,6 +37,17 @@ export async function sendNotificationToSlack({ branchConfig, deployResult: { de
37
37
  const afterText = repoConfig.commitBaseUrl
38
38
  ? `<${joinUrlPaths(repoConfig.commitBaseUrl, after.hash)}|${after.hash.slice(0, 7)}>`
39
39
  : before.hash;
40
+ const overwrittenCommitBlocks = overwrittenCommitBulletsText
41
+ ? [
42
+ {
43
+ type: 'section',
44
+ text: {
45
+ type: 'mrkdwn',
46
+ text: `\n*Overwritten Commits*\n${overwrittenCommitBulletsText}`,
47
+ },
48
+ },
49
+ ]
50
+ : [];
40
51
  const blocks = [
41
52
  {
42
53
  type: 'section',
@@ -47,10 +58,12 @@ export async function sendNotificationToSlack({ branchConfig, deployResult: { de
47
58
  },
48
59
  {
49
60
  type: 'context',
50
- text: {
51
- type: 'mrkdwn',
52
- text: `${beforeText} -> ${afterText}`,
53
- },
61
+ elements: [
62
+ {
63
+ type: 'mrkdwn',
64
+ text: `${beforeText} :arrow_right: ${afterText}`,
65
+ },
66
+ ],
54
67
  },
55
68
  {
56
69
  type: 'section',
@@ -59,17 +72,7 @@ export async function sendNotificationToSlack({ branchConfig, deployResult: { de
59
72
  text: `\n*Deployed Commits*\n${deployedCommitBulletsText}`,
60
73
  },
61
74
  },
62
- ...(overwrittenCommitBulletsText
63
- ? [
64
- {
65
- type: 'section',
66
- text: {
67
- type: 'mrkdwn',
68
- text: `\n*Overwritten Commits*\n${overwrittenCommitBulletsText}`,
69
- },
70
- },
71
- ]
72
- : []),
75
+ ...overwrittenCommitBlocks,
73
76
  ];
74
77
  await sendSlackMessage(notification, {
75
78
  attachments: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deploy-vir",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Deploy a branch to another branch with notifications.",
5
5
  "keywords": [
6
6
  "deploy",
package/src/git.ts CHANGED
@@ -174,7 +174,7 @@ export async function pushDeploy(
174
174
  }
175
175
 
176
176
  const shouldForcePush = await askQuestion(
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): `,
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.normalWeight}.${logColors.reset} (y/N): `,
178
178
  );
179
179
 
180
180
  if (shouldForcePush.toLowerCase() === 'y' || shouldForcePush.toLowerCase() === 'yes') {
@@ -1,5 +1,5 @@
1
1
  import {addPrefix, capitalizeFirstLetter} from '@augment-vir/common';
2
- import {type ChatPostMessageArguments} from '@slack/web-api';
2
+ import {type ChatPostMessageArguments, type KnownBlock} from '@slack/web-api';
3
3
  import {joinUrlPaths} from 'url-vir';
4
4
  import {type SlackNotificationConfig} from '../config.js';
5
5
  import {type Commit} from '../git.js';
@@ -61,7 +61,19 @@ export async function sendNotificationToSlack({
61
61
  ? `<${joinUrlPaths(repoConfig.commitBaseUrl, after.hash)}|${after.hash.slice(0, 7)}>`
62
62
  : before.hash;
63
63
 
64
- const blocks: any[] = [
64
+ const overwrittenCommitBlocks: KnownBlock[] = overwrittenCommitBulletsText
65
+ ? [
66
+ {
67
+ type: 'section',
68
+ text: {
69
+ type: 'mrkdwn',
70
+ text: `\n*Overwritten Commits*\n${overwrittenCommitBulletsText}`,
71
+ },
72
+ },
73
+ ]
74
+ : [];
75
+
76
+ const blocks: KnownBlock[] = [
65
77
  {
66
78
  type: 'section',
67
79
  text: {
@@ -71,10 +83,12 @@ export async function sendNotificationToSlack({
71
83
  },
72
84
  {
73
85
  type: 'context',
74
- text: {
75
- type: 'mrkdwn',
76
- text: `${beforeText} -> ${afterText}`,
77
- },
86
+ elements: [
87
+ {
88
+ type: 'mrkdwn',
89
+ text: `${beforeText} :arrow_right: ${afterText}`,
90
+ },
91
+ ],
78
92
  },
79
93
  {
80
94
  type: 'section',
@@ -83,17 +97,7 @@ export async function sendNotificationToSlack({
83
97
  text: `\n*Deployed Commits*\n${deployedCommitBulletsText}`,
84
98
  },
85
99
  },
86
- ...(overwrittenCommitBulletsText
87
- ? [
88
- {
89
- type: 'section',
90
- text: {
91
- type: 'mrkdwn',
92
- text: `\n*Overwritten Commits*\n${overwrittenCommitBulletsText}`,
93
- },
94
- },
95
- ]
96
- : []),
100
+ ...overwrittenCommitBlocks,
97
101
  ];
98
102
 
99
103
  await sendSlackMessage(notification, {