deploy-vir 3.1.0 → 3.2.0
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 +1 -1
- package/dist/config.d.ts +28 -0
- package/dist/git.d.ts +2 -2
- package/dist/git.js +11 -1
- package/package.json +22 -22
- package/src/cli/cli.ts +1 -0
- package/src/config.ts +31 -0
- package/src/git.ts +13 -0
package/dist/cli/cli.js
CHANGED
|
@@ -48,7 +48,7 @@ export async function runDeployVir(args, config) {
|
|
|
48
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}'.`));
|
|
49
49
|
const remoteName = await getGitRemoteName(git, repoConfig);
|
|
50
50
|
log.faint(`Remote: ${remoteName}`);
|
|
51
|
-
await pushDeploy(git, branchConfig, repoConfig, remoteName, config.notifications, args.bypassConfirmation);
|
|
51
|
+
await pushDeploy(git, branchConfig, repoConfig, remoteName, config.notifications, args.bypassConfirmation, config.hooks);
|
|
52
52
|
}
|
|
53
53
|
catch (error) {
|
|
54
54
|
if (error instanceof KnownError) {
|
package/dist/config.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type MaybePromise } from '@augment-vir/common';
|
|
2
|
+
import { type DeployResult } from './git.js';
|
|
1
3
|
/**
|
|
2
4
|
* The full deploy-vir config object.
|
|
3
5
|
*
|
|
@@ -6,6 +8,32 @@
|
|
|
6
8
|
export type DeployVirConfig = {
|
|
7
9
|
repos: DeployVirRepoConfig[];
|
|
8
10
|
notifications?: NotificationConfig[] | undefined;
|
|
11
|
+
hooks?: DeployVirHooks | undefined;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Hooks to run at various points during a deploy.
|
|
15
|
+
*
|
|
16
|
+
* @category Config
|
|
17
|
+
*/
|
|
18
|
+
export type DeployVirHooks = {
|
|
19
|
+
/**
|
|
20
|
+
* Runs after the user accepts (or bypasses confirmation for) a deploy and the push has
|
|
21
|
+
* completed successfully. Fires once per branch deploy.
|
|
22
|
+
*/
|
|
23
|
+
postAccept?: ((params: Readonly<PostAcceptHookParams>) => MaybePromise<void>) | undefined;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Params passed to a {@link DeployVirHooks.postAccept} hook.
|
|
27
|
+
*
|
|
28
|
+
* @category Config
|
|
29
|
+
*/
|
|
30
|
+
export type PostAcceptHookParams = {
|
|
31
|
+
repoConfig: Readonly<DeployVirRepoConfig>;
|
|
32
|
+
branchConfig: Readonly<DeployVirBranchConfig>;
|
|
33
|
+
fromBranch: string;
|
|
34
|
+
toBranch: string;
|
|
35
|
+
remoteName: string;
|
|
36
|
+
deployResult: Readonly<DeployResult>;
|
|
9
37
|
};
|
|
10
38
|
/**
|
|
11
39
|
* All available targets for sending notifications to.
|
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, type NotificationConfig } from './config.js';
|
|
2
|
+
import { type DeployVirBranchConfig, type DeployVirHooks, 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>, branchConfig: Readonly<DeployVirBranchConfig>, repoConfig: Readonly<DeployVirRepoConfig>, remoteName: string, notifications: ReadonlyArray<Readonly<NotificationConfig>> | undefined, bypassConfirmation
|
|
48
|
+
export declare function pushDeploy(git: Readonly<SimpleGit>, branchConfig: Readonly<DeployVirBranchConfig>, repoConfig: Readonly<DeployVirRepoConfig>, remoteName: string, notifications: ReadonlyArray<Readonly<NotificationConfig>> | undefined, bypassConfirmation: boolean | undefined, hooks: Readonly<DeployVirHooks> | undefined): Promise<DeployResult[]>;
|
package/dist/git.js
CHANGED
|
@@ -31,7 +31,7 @@ export async function getGitRemoteName(git, repoConfig) {
|
|
|
31
31
|
*
|
|
32
32
|
* @category Internal
|
|
33
33
|
*/
|
|
34
|
-
export async function pushDeploy(git, branchConfig, repoConfig, remoteName, notifications, bypassConfirmation = false) {
|
|
34
|
+
export async function pushDeploy(git, branchConfig, repoConfig, remoteName, notifications, bypassConfirmation = false, hooks) {
|
|
35
35
|
const { deployName, branches } = branchConfig;
|
|
36
36
|
return await awaitedBlockingMap(branches, async ({ fromBranch, toBranch, enableNotifications }) => {
|
|
37
37
|
assert.isTruthy(fromBranch, `Deploy '${deployName}' fromBranch cannot be empty.`);
|
|
@@ -100,6 +100,16 @@ export async function pushDeploy(git, branchConfig, repoConfig, remoteName, noti
|
|
|
100
100
|
after: afterCommit,
|
|
101
101
|
},
|
|
102
102
|
};
|
|
103
|
+
if (hooks?.postAccept) {
|
|
104
|
+
await hooks.postAccept({
|
|
105
|
+
branchConfig,
|
|
106
|
+
deployResult,
|
|
107
|
+
fromBranch,
|
|
108
|
+
remoteName,
|
|
109
|
+
repoConfig,
|
|
110
|
+
toBranch,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
103
113
|
const resolvedNotifications = resolveNotifications({
|
|
104
114
|
branchConfig,
|
|
105
115
|
enableNotifications,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deploy-vir",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
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.68.
|
|
45
|
-
"@augment-vir/common": "^31.68.
|
|
46
|
-
"@augment-vir/node": "^31.68.
|
|
47
|
-
"@inquirer/prompts": "^8.
|
|
48
|
-
"@slack/web-api": "^7.15.
|
|
44
|
+
"@augment-vir/assert": "^31.68.4",
|
|
45
|
+
"@augment-vir/common": "^31.68.4",
|
|
46
|
+
"@augment-vir/node": "^31.68.4",
|
|
47
|
+
"@inquirer/prompts": "^8.4.2",
|
|
48
|
+
"@slack/web-api": "^7.15.1",
|
|
49
49
|
"cli-vir": "^1.0.3",
|
|
50
|
-
"simple-git": "^3.
|
|
50
|
+
"simple-git": "^3.36.0",
|
|
51
51
|
"tsx": "^4.21.0",
|
|
52
|
-
"url-vir": "^2.1.
|
|
52
|
+
"url-vir": "^2.1.8"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@eslint/eslintrc": "^3.3.5",
|
|
56
56
|
"@eslint/js": "^9.39.2",
|
|
57
57
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
58
58
|
"@stylistic/eslint-plugin-ts": "^4.4.1",
|
|
59
|
-
"@types/node": "^25.
|
|
60
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
61
|
-
"cspell": "^
|
|
62
|
-
"dependency-cruiser": "^17.3.
|
|
63
|
-
"esbuild": "^0.
|
|
59
|
+
"@types/node": "^25.6.0",
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^8.59.0",
|
|
61
|
+
"cspell": "^10.0.0",
|
|
62
|
+
"dependency-cruiser": "^17.3.10",
|
|
63
|
+
"esbuild": "^0.28.0",
|
|
64
64
|
"eslint": "^9.39.2",
|
|
65
65
|
"eslint-config-prettier": "^10.1.8",
|
|
66
|
-
"eslint-plugin-jsdoc": "^62.
|
|
66
|
+
"eslint-plugin-jsdoc": "^62.9.0",
|
|
67
67
|
"eslint-plugin-monorepo-cop": "^1.0.2",
|
|
68
|
-
"eslint-plugin-playwright": "^2.
|
|
68
|
+
"eslint-plugin-playwright": "^2.10.2",
|
|
69
69
|
"eslint-plugin-prettier": "^5.5.5",
|
|
70
70
|
"eslint-plugin-require-extensions": "^0.1.3",
|
|
71
|
-
"eslint-plugin-sonarjs": "^4.0.
|
|
72
|
-
"eslint-plugin-unicorn": "^
|
|
71
|
+
"eslint-plugin-sonarjs": "^4.0.3",
|
|
72
|
+
"eslint-plugin-unicorn": "^64.0.0",
|
|
73
73
|
"istanbul-smart-text-reporter": "^1.1.5",
|
|
74
|
-
"markdown-code-example-inserter": "^3.0.
|
|
75
|
-
"npm-check-updates": "^
|
|
74
|
+
"markdown-code-example-inserter": "^3.0.5",
|
|
75
|
+
"npm-check-updates": "^21.0.3",
|
|
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.
|
|
79
|
+
"prettier-plugin-multiline-arrays": "^4.1.7",
|
|
80
80
|
"prettier-plugin-organize-imports": "^4.3.0",
|
|
81
81
|
"prettier-plugin-packagejson": "^3.0.2",
|
|
82
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.
|
|
85
|
+
"typedoc": "^0.28.19",
|
|
86
86
|
"typescript": "^5.9.3",
|
|
87
87
|
"typescript-eslint": "^8.57.1",
|
|
88
|
-
"virmator": "^14.
|
|
88
|
+
"virmator": "^14.12.2"
|
|
89
89
|
},
|
|
90
90
|
"engines": {
|
|
91
91
|
"node": ">=22"
|
package/src/cli/cli.ts
CHANGED
package/src/config.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {type MaybePromise} from '@augment-vir/common';
|
|
2
|
+
import {type DeployResult} from './git.js';
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* The full deploy-vir config object.
|
|
3
6
|
*
|
|
@@ -6,6 +9,34 @@
|
|
|
6
9
|
export type DeployVirConfig = {
|
|
7
10
|
repos: DeployVirRepoConfig[];
|
|
8
11
|
notifications?: NotificationConfig[] | undefined;
|
|
12
|
+
hooks?: DeployVirHooks | undefined;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Hooks to run at various points during a deploy.
|
|
17
|
+
*
|
|
18
|
+
* @category Config
|
|
19
|
+
*/
|
|
20
|
+
export type DeployVirHooks = {
|
|
21
|
+
/**
|
|
22
|
+
* Runs after the user accepts (or bypasses confirmation for) a deploy and the push has
|
|
23
|
+
* completed successfully. Fires once per branch deploy.
|
|
24
|
+
*/
|
|
25
|
+
postAccept?: ((params: Readonly<PostAcceptHookParams>) => MaybePromise<void>) | undefined;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Params passed to a {@link DeployVirHooks.postAccept} hook.
|
|
30
|
+
*
|
|
31
|
+
* @category Config
|
|
32
|
+
*/
|
|
33
|
+
export type PostAcceptHookParams = {
|
|
34
|
+
repoConfig: Readonly<DeployVirRepoConfig>;
|
|
35
|
+
branchConfig: Readonly<DeployVirBranchConfig>;
|
|
36
|
+
fromBranch: string;
|
|
37
|
+
toBranch: string;
|
|
38
|
+
remoteName: string;
|
|
39
|
+
deployResult: Readonly<DeployResult>;
|
|
9
40
|
};
|
|
10
41
|
|
|
11
42
|
/**
|
package/src/git.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {type DefaultLogFields, type ListLogLine, type SimpleGit} from 'simple-gi
|
|
|
5
5
|
import {
|
|
6
6
|
type DeployNotificationConfig,
|
|
7
7
|
type DeployVirBranchConfig,
|
|
8
|
+
type DeployVirHooks,
|
|
8
9
|
type DeployVirRepoConfig,
|
|
9
10
|
type NotificationConfig,
|
|
10
11
|
} from './config.js';
|
|
@@ -100,6 +101,7 @@ export async function pushDeploy(
|
|
|
100
101
|
remoteName: string,
|
|
101
102
|
notifications: ReadonlyArray<Readonly<NotificationConfig>> | undefined,
|
|
102
103
|
bypassConfirmation = false,
|
|
104
|
+
hooks: Readonly<DeployVirHooks> | undefined,
|
|
103
105
|
): Promise<DeployResult[]> {
|
|
104
106
|
const {deployName, branches} = branchConfig;
|
|
105
107
|
return await awaitedBlockingMap(
|
|
@@ -209,6 +211,17 @@ export async function pushDeploy(
|
|
|
209
211
|
},
|
|
210
212
|
};
|
|
211
213
|
|
|
214
|
+
if (hooks?.postAccept) {
|
|
215
|
+
await hooks.postAccept({
|
|
216
|
+
branchConfig,
|
|
217
|
+
deployResult,
|
|
218
|
+
fromBranch,
|
|
219
|
+
remoteName,
|
|
220
|
+
repoConfig,
|
|
221
|
+
toBranch,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
212
225
|
const resolvedNotifications = resolveNotifications({
|
|
213
226
|
branchConfig,
|
|
214
227
|
enableNotifications,
|