deploy-vir 2.1.1 → 3.0.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/cli/cli.js CHANGED
@@ -1,11 +1,10 @@
1
1
  import { assertWrap } from '@augment-vir/assert';
2
- import { awaitedForEach, extractErrorMessage, log } from '@augment-vir/common';
2
+ import { extractErrorMessage, log } from '@augment-vir/common';
3
3
  import { select } from '@inquirer/prompts';
4
4
  import { resolve } from 'node:path';
5
5
  import { simpleGit } from 'simple-git';
6
6
  import { getGitRemoteName, pushDeploy } from '../git.js';
7
7
  import { KnownError } from '../known.error.js';
8
- import { sendNotifications } from '../notifications/send-notifications.js';
9
8
  /**
10
9
  * Run the deploy-vir CLI.
11
10
  *
@@ -49,17 +48,7 @@ export async function runDeployVir(args, config) {
49
48
  const branchConfig = assertWrap.isDefined(repoConfig.deploys.find((deploy) => deploy.deployName === args.deployName, `Failed to find a deploy named '${args.deployName}' in repo '${args.repoName}'.`));
50
49
  const remoteName = await getGitRemoteName(git, repoConfig);
51
50
  log.faint(`Remote: ${remoteName}`);
52
- const deployResults = await pushDeploy(git, branchConfig, remoteName, args.bypassConfirmation);
53
- const notifications = config.notifications;
54
- if (notifications?.length) {
55
- await awaitedForEach(deployResults, async (deployResult) => {
56
- await sendNotifications(notifications, {
57
- branchConfig,
58
- deployResult,
59
- repoConfig,
60
- });
61
- });
62
- }
51
+ await pushDeploy(git, branchConfig, repoConfig, remoteName, config.notifications, args.bypassConfirmation);
63
52
  }
64
53
  catch (error) {
65
54
  if (error instanceof KnownError) {
package/dist/config.d.ts CHANGED
@@ -82,6 +82,7 @@ export type DeployVirRepoConfig = {
82
82
  */
83
83
  commitBaseUrl?: string | undefined;
84
84
  deploys: DeployVirBranchConfig[];
85
+ enableNotifications?: boolean | undefined;
85
86
  };
86
87
  /**
87
88
  * A deploy configuration.
@@ -93,7 +94,9 @@ export type DeployVirBranchConfig = {
93
94
  branches: {
94
95
  fromBranch: string;
95
96
  toBranch: string;
97
+ enableNotifications?: boolean | undefined;
96
98
  }[];
99
+ enableNotifications?: boolean | undefined;
97
100
  };
98
101
  /**
99
102
  * Define a type safe deploy-vir config.
package/dist/git.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type DefaultLogFields, type ListLogLine, type SimpleGit } from 'simple-git';
2
- import { type DeployVirBranchConfig, type DeployVirRepoConfig } from './config.js';
2
+ import { type DeployVirBranchConfig, type DeployVirRepoConfig, type NotificationConfig } from './config.js';
3
3
  /**
4
4
  * Find the git remote's name, or create a new one.
5
5
  *
@@ -45,4 +45,4 @@ export type DeployResult = {
45
45
  *
46
46
  * @category Internal
47
47
  */
48
- export declare function pushDeploy(git: Readonly<SimpleGit>, { deployName, branches }: Readonly<DeployVirBranchConfig>, remoteName: string, bypassConfirmation?: boolean): Promise<DeployResult[]>;
48
+ export declare function pushDeploy(git: Readonly<SimpleGit>, branchConfig: Readonly<DeployVirBranchConfig>, repoConfig: Readonly<DeployVirRepoConfig>, remoteName: string, notifications: ReadonlyArray<Readonly<NotificationConfig>> | undefined, bypassConfirmation?: boolean): Promise<DeployResult[]>;
package/dist/git.js CHANGED
@@ -2,6 +2,7 @@ import { assert, assertWrap, check } from '@augment-vir/assert';
2
2
  import { awaitedBlockingMap, log, logColors } from '@augment-vir/common';
3
3
  import { confirm } from '@inquirer/prompts';
4
4
  import { KnownError } from './known.error.js';
5
+ import { sendNotifications } from './notifications/send-notifications.js';
5
6
  /**
6
7
  * Find the git remote's name, or create a new one.
7
8
  *
@@ -30,8 +31,9 @@ export async function getGitRemoteName(git, repoConfig) {
30
31
  *
31
32
  * @category Internal
32
33
  */
33
- export async function pushDeploy(git, { deployName, branches }, remoteName, bypassConfirmation = false) {
34
- return await awaitedBlockingMap(branches, async ({ fromBranch, toBranch }) => {
34
+ export async function pushDeploy(git, branchConfig, repoConfig, remoteName, notifications, bypassConfirmation = false) {
35
+ const { deployName, branches } = branchConfig;
36
+ return await awaitedBlockingMap(branches, async ({ fromBranch, toBranch, enableNotifications }) => {
35
37
  assert.isTruthy(fromBranch, `Deploy '${deployName}' fromBranch cannot be empty.`);
36
38
  assert.isTruthy(toBranch, `Deploy '${deployName}' toBranch cannot be empty.`);
37
39
  assert.isTruthy(remoteName, 'Remote name cannot be empty.');
@@ -87,7 +89,7 @@ export async function pushDeploy(git, { deployName, branches }, remoteName, bypa
87
89
  else {
88
90
  await git.push(remoteName, pushString);
89
91
  }
90
- return {
92
+ const deployResult = {
91
93
  toBranchName: toBranch,
92
94
  deployCommits: {
93
95
  deployedCommits: commitsAhead,
@@ -98,5 +100,16 @@ export async function pushDeploy(git, { deployName, branches }, remoteName, bypa
98
100
  after: afterCommit,
99
101
  },
100
102
  };
103
+ if (notifications?.length &&
104
+ (repoConfig.enableNotifications ||
105
+ enableNotifications ||
106
+ branchConfig.enableNotifications)) {
107
+ await sendNotifications(notifications, {
108
+ branchConfig,
109
+ deployResult,
110
+ repoConfig,
111
+ });
112
+ }
113
+ return deployResult;
101
114
  });
102
115
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deploy-vir",
3
- "version": "2.1.1",
3
+ "version": "3.0.1",
4
4
  "description": "Deploy a branch to another branch with notifications.",
5
5
  "keywords": [
6
6
  "deploy",
@@ -41,51 +41,51 @@
41
41
  "test:update": "npm run test update"
42
42
  },
43
43
  "dependencies": {
44
- "@augment-vir/assert": "^31.57.5",
45
- "@augment-vir/common": "^31.57.5",
46
- "@augment-vir/node": "^31.57.5",
47
- "@inquirer/prompts": "^8.1.0",
48
- "@slack/web-api": "^7.13.0",
44
+ "@augment-vir/assert": "^31.61.0",
45
+ "@augment-vir/common": "^31.61.0",
46
+ "@augment-vir/node": "^31.61.0",
47
+ "@inquirer/prompts": "^8.2.1",
48
+ "@slack/web-api": "^7.14.1",
49
49
  "cli-vir": "^1.0.3",
50
- "simple-git": "^3.30.0",
50
+ "simple-git": "^3.31.1",
51
51
  "tsx": "^4.21.0",
52
52
  "url-vir": "^2.1.7"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@eslint/eslintrc": "^3.3.3",
56
56
  "@eslint/js": "^9.39.2",
57
- "@stylistic/eslint-plugin": "^5.6.1",
57
+ "@stylistic/eslint-plugin": "^5.8.0",
58
58
  "@stylistic/eslint-plugin-ts": "^4.4.1",
59
- "@types/node": "^25.0.3",
60
- "@typescript-eslint/eslint-plugin": "^8.52.0",
61
- "cspell": "^9.4.0",
62
- "dependency-cruiser": "^17.3.6",
63
- "esbuild": "^0.27.2",
59
+ "@types/node": "^25.2.3",
60
+ "@typescript-eslint/eslint-plugin": "^8.56.0",
61
+ "cspell": "^9.6.4",
62
+ "dependency-cruiser": "^17.3.8",
63
+ "esbuild": "^0.27.3",
64
64
  "eslint": "^9.39.2",
65
65
  "eslint-config-prettier": "^10.1.8",
66
- "eslint-plugin-jsdoc": "^61.5.0",
66
+ "eslint-plugin-jsdoc": "^62.5.0",
67
67
  "eslint-plugin-monorepo-cop": "^1.0.2",
68
- "eslint-plugin-playwright": "^2.4.0",
69
- "eslint-plugin-prettier": "^5.5.4",
68
+ "eslint-plugin-playwright": "^2.5.1",
69
+ "eslint-plugin-prettier": "^5.5.5",
70
70
  "eslint-plugin-require-extensions": "^0.1.3",
71
- "eslint-plugin-sonarjs": "^3.0.5",
72
- "eslint-plugin-unicorn": "^62.0.0",
71
+ "eslint-plugin-sonarjs": "^3.0.6",
72
+ "eslint-plugin-unicorn": "^63.0.0",
73
73
  "istanbul-smart-text-reporter": "^1.1.5",
74
74
  "markdown-code-example-inserter": "^3.0.3",
75
- "npm-check-updates": "^19.3.1",
75
+ "npm-check-updates": "^19.3.2",
76
76
  "prettier": "~3.3.3",
77
77
  "prettier-plugin-interpolated-html-tags": "^2.0.1",
78
78
  "prettier-plugin-jsdoc": "^1.8.0",
79
- "prettier-plugin-multiline-arrays": "^4.1.3",
79
+ "prettier-plugin-multiline-arrays": "^4.1.4",
80
80
  "prettier-plugin-organize-imports": "^4.3.0",
81
- "prettier-plugin-packagejson": "^2.5.20",
82
- "prettier-plugin-sort-json": "^4.1.1",
81
+ "prettier-plugin-packagejson": "^3.0.0",
82
+ "prettier-plugin-sort-json": "^4.2.0",
83
83
  "prettier-plugin-toml": "^2.0.6",
84
84
  "runstorm": "^1.0.0",
85
- "typedoc": "^0.28.15",
85
+ "typedoc": "^0.28.17",
86
86
  "typescript": "^5.9.3",
87
- "typescript-eslint": "^8.52.0",
88
- "virmator": "^14.4.2"
87
+ "typescript-eslint": "^8.56.0",
88
+ "virmator": "^14.5.2"
89
89
  },
90
90
  "engines": {
91
91
  "node": ">=22"
package/src/cli/cli.ts CHANGED
@@ -1,12 +1,11 @@
1
1
  import {assertWrap} from '@augment-vir/assert';
2
- import {awaitedForEach, extractErrorMessage, log} from '@augment-vir/common';
2
+ import {extractErrorMessage, log} from '@augment-vir/common';
3
3
  import {select} from '@inquirer/prompts';
4
4
  import {resolve} from 'node:path';
5
5
  import {simpleGit} from 'simple-git';
6
6
  import {type DeployVirConfig} from '../config.js';
7
7
  import {getGitRemoteName, pushDeploy} from '../git.js';
8
8
  import {KnownError} from '../known.error.js';
9
- import {sendNotifications} from '../notifications/send-notifications.js';
10
9
 
11
10
  /**
12
11
  * Run the deploy-vir CLI.
@@ -106,24 +105,14 @@ export async function runDeployVir(
106
105
  const remoteName = await getGitRemoteName(git, repoConfig);
107
106
  log.faint(`Remote: ${remoteName}`);
108
107
 
109
- const deployResults = await pushDeploy(
108
+ await pushDeploy(
110
109
  git,
111
110
  branchConfig,
111
+ repoConfig,
112
112
  remoteName,
113
+ config.notifications,
113
114
  args.bypassConfirmation,
114
115
  );
115
-
116
- const notifications = config.notifications;
117
-
118
- if (notifications?.length) {
119
- await awaitedForEach(deployResults, async (deployResult) => {
120
- await sendNotifications(notifications, {
121
- branchConfig,
122
- deployResult,
123
- repoConfig,
124
- });
125
- });
126
- }
127
116
  } catch (error) {
128
117
  if (error instanceof KnownError) {
129
118
  /** If its a known error, don't log the whole stack trace. */
package/src/config.ts CHANGED
@@ -87,6 +87,7 @@ export type DeployVirRepoConfig = {
87
87
  */
88
88
  commitBaseUrl?: string | undefined;
89
89
  deploys: DeployVirBranchConfig[];
90
+ enableNotifications?: boolean | undefined;
90
91
  };
91
92
 
92
93
  /**
@@ -99,7 +100,9 @@ export type DeployVirBranchConfig = {
99
100
  branches: {
100
101
  fromBranch: string;
101
102
  toBranch: string;
103
+ enableNotifications?: boolean | undefined;
102
104
  }[];
105
+ enableNotifications?: boolean | undefined;
103
106
  };
104
107
 
105
108
  /**
package/src/git.ts CHANGED
@@ -2,8 +2,13 @@ import {assert, assertWrap, check} from '@augment-vir/assert';
2
2
  import {awaitedBlockingMap, log, logColors} from '@augment-vir/common';
3
3
  import {confirm} from '@inquirer/prompts';
4
4
  import {type DefaultLogFields, type ListLogLine, type SimpleGit} from 'simple-git';
5
- import {type DeployVirBranchConfig, type DeployVirRepoConfig} from './config.js';
5
+ import {
6
+ type DeployVirBranchConfig,
7
+ type DeployVirRepoConfig,
8
+ type NotificationConfig,
9
+ } from './config.js';
6
10
  import {KnownError} from './known.error.js';
11
+ import {sendNotifications} from './notifications/send-notifications.js';
7
12
 
8
13
  /**
9
14
  * Find the git remote's name, or create a new one.
@@ -89,13 +94,16 @@ export type DeployResult = {
89
94
  */
90
95
  export async function pushDeploy(
91
96
  git: Readonly<SimpleGit>,
92
- {deployName, branches}: Readonly<DeployVirBranchConfig>,
97
+ branchConfig: Readonly<DeployVirBranchConfig>,
98
+ repoConfig: Readonly<DeployVirRepoConfig>,
93
99
  remoteName: string,
100
+ notifications: ReadonlyArray<Readonly<NotificationConfig>> | undefined,
94
101
  bypassConfirmation = false,
95
102
  ): Promise<DeployResult[]> {
103
+ const {deployName, branches} = branchConfig;
96
104
  return await awaitedBlockingMap(
97
105
  branches,
98
- async ({fromBranch, toBranch}): Promise<DeployResult> => {
106
+ async ({fromBranch, toBranch, enableNotifications}): Promise<DeployResult> => {
99
107
  assert.isTruthy(fromBranch, `Deploy '${deployName}' fromBranch cannot be empty.`);
100
108
  assert.isTruthy(toBranch, `Deploy '${deployName}' toBranch cannot be empty.`);
101
109
  assert.isTruthy(remoteName, 'Remote name cannot be empty.');
@@ -188,7 +196,7 @@ export async function pushDeploy(
188
196
  await git.push(remoteName, pushString);
189
197
  }
190
198
 
191
- return {
199
+ const deployResult: DeployResult = {
192
200
  toBranchName: toBranch,
193
201
  deployCommits: {
194
202
  deployedCommits: commitsAhead,
@@ -199,6 +207,21 @@ export async function pushDeploy(
199
207
  after: afterCommit,
200
208
  },
201
209
  };
210
+
211
+ if (
212
+ notifications?.length &&
213
+ (repoConfig.enableNotifications ||
214
+ enableNotifications ||
215
+ branchConfig.enableNotifications)
216
+ ) {
217
+ await sendNotifications(notifications, {
218
+ branchConfig,
219
+ deployResult,
220
+ repoConfig,
221
+ });
222
+ }
223
+
224
+ return deployResult;
202
225
  },
203
226
  );
204
227
  }