deploy-vir 0.3.0 → 1.0.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.d.ts +6 -1
- package/dist/cli/cli.js +8 -3
- package/dist/cli/cli.script.js +15 -4
- package/dist/git.d.ts +1 -1
- package/dist/git.js +8 -7
- package/package.json +31 -30
- package/src/cli/cli.script.ts +21 -6
- package/src/cli/cli.ts +27 -3
- package/src/git.ts +9 -6
package/dist/cli/cli.d.ts
CHANGED
|
@@ -4,7 +4,10 @@ import { type DeployVirConfig } from '../config.js';
|
|
|
4
4
|
*
|
|
5
5
|
* @category Internal
|
|
6
6
|
*/
|
|
7
|
-
export declare function runDeployVirCli(args
|
|
7
|
+
export declare function runDeployVirCli({ args, y, }: {
|
|
8
|
+
y: boolean;
|
|
9
|
+
args: ReadonlyArray<string>;
|
|
10
|
+
}, cwd?: string): Promise<void>;
|
|
8
11
|
/**
|
|
9
12
|
* Args for {@link runDeployVir}.
|
|
10
13
|
*
|
|
@@ -16,6 +19,8 @@ export type DeployVirArgs = {
|
|
|
16
19
|
/** This much match a deploy name in your config. */
|
|
17
20
|
deployName: string;
|
|
18
21
|
cwd: string;
|
|
22
|
+
/** If true, manual confirmation is not required. */
|
|
23
|
+
bypassConfirmation: boolean;
|
|
19
24
|
};
|
|
20
25
|
/**
|
|
21
26
|
* Run a deploy.
|
package/dist/cli/cli.js
CHANGED
|
@@ -10,12 +10,17 @@ import { sendNotifications } from '../notifications/send-notifications.js';
|
|
|
10
10
|
*
|
|
11
11
|
* @category Internal
|
|
12
12
|
*/
|
|
13
|
-
export async function runDeployVirCli(args, cwd = process.cwd()) {
|
|
13
|
+
export async function runDeployVirCli({ args, y, }, cwd = process.cwd()) {
|
|
14
14
|
const configPath = assertWrap.isTruthy(args[0], 'Missing config path.');
|
|
15
15
|
const repoName = assertWrap.isTruthy(args[1], 'Missing repo name.');
|
|
16
16
|
const deployName = assertWrap.isTruthy(args[2], 'Missing deploy name.');
|
|
17
17
|
const config = (await import(resolve(cwd, configPath))).default;
|
|
18
|
-
await runDeployVir({
|
|
18
|
+
await runDeployVir({
|
|
19
|
+
cwd,
|
|
20
|
+
deployName,
|
|
21
|
+
repoName,
|
|
22
|
+
bypassConfirmation: y,
|
|
23
|
+
}, config);
|
|
19
24
|
}
|
|
20
25
|
/**
|
|
21
26
|
* Run a deploy.
|
|
@@ -29,7 +34,7 @@ export async function runDeployVir(args, config) {
|
|
|
29
34
|
const branchConfig = assertWrap.isDefined(repoConfig.deploys.find((deploy) => deploy.deployName === args.deployName, `Failed to find a deploy named '${args.deployName}' in repo '${args.repoName}'.`));
|
|
30
35
|
const remoteName = await getGitRemoteName(git, repoConfig);
|
|
31
36
|
log.faint(`Remote: ${remoteName}`);
|
|
32
|
-
const deployResult = await pushDeploy(git, branchConfig, remoteName);
|
|
37
|
+
const deployResult = await pushDeploy(git, branchConfig, remoteName, args.bypassConfirmation);
|
|
33
38
|
if (config.notifications?.length) {
|
|
34
39
|
await sendNotifications(config.notifications, {
|
|
35
40
|
branchConfig,
|
package/dist/cli/cli.script.js
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FlagRequirement, parseArgs } from 'cli-vir';
|
|
2
2
|
import { runDeployVirCli } from './cli.js';
|
|
3
|
-
await runDeployVirCli(
|
|
3
|
+
await runDeployVirCli(parseArgs(process.argv, {
|
|
4
|
+
y: {
|
|
5
|
+
flag: {
|
|
6
|
+
valueRequirement: FlagRequirement.Blocked,
|
|
7
|
+
},
|
|
8
|
+
description: 'If set, bypass manual validation.',
|
|
9
|
+
},
|
|
10
|
+
args: {
|
|
11
|
+
position: {
|
|
12
|
+
rest: true,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
}, {
|
|
4
16
|
binName: 'deploy-vir',
|
|
5
|
-
|
|
6
|
-
rawArgs: process.argv,
|
|
17
|
+
importMeta: import.meta,
|
|
7
18
|
}), process.cwd());
|
package/dist/git.d.ts
CHANGED
|
@@ -44,4 +44,4 @@ export type DeployResult = {
|
|
|
44
44
|
*
|
|
45
45
|
* @category Internal
|
|
46
46
|
*/
|
|
47
|
-
export declare function pushDeploy(git: Readonly<SimpleGit>, { deployName, fromBranch, toBranch }: Readonly<DeployVirBranchConfig>, remoteName: string): Promise<DeployResult>;
|
|
47
|
+
export declare function pushDeploy(git: Readonly<SimpleGit>, { deployName, fromBranch, toBranch }: Readonly<DeployVirBranchConfig>, remoteName: string, bypassConfirmation?: boolean): Promise<DeployResult>;
|
package/dist/git.js
CHANGED
|
@@ -30,7 +30,7 @@ export async function getGitRemoteName(git, repoConfig) {
|
|
|
30
30
|
*
|
|
31
31
|
* @category Internal
|
|
32
32
|
*/
|
|
33
|
-
export async function pushDeploy(git, { deployName, fromBranch, toBranch }, remoteName) {
|
|
33
|
+
export async function pushDeploy(git, { deployName, fromBranch, toBranch }, remoteName, bypassConfirmation = false) {
|
|
34
34
|
assert.isTruthy(fromBranch, `Deploy '${deployName}' fromBranch cannot be empty.`);
|
|
35
35
|
assert.isTruthy(toBranch, `Deploy '${deployName}' toBranch cannot be empty.`);
|
|
36
36
|
assert.isTruthy(remoteName, 'Remote name cannot be empty.');
|
|
@@ -69,12 +69,13 @@ export async function pushDeploy(git, { deployName, fromBranch, toBranch }, remo
|
|
|
69
69
|
log.faint(` ${index + 1}. ${commit.hash.slice(0, 7)} (${commit.author_name}) - ${commit.message}`);
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
const shouldPush =
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
const shouldPush = bypassConfirmation ||
|
|
73
|
+
(await confirm({
|
|
74
|
+
message: requiresForcePush
|
|
75
|
+
? `\n${logColors.warning}Do you want to force push ${logColors.bold}${fromBranch}${logColors.normalWeight} to ${logColors.bold}${toBranch}${logColors.normalWeight}?\n\nThis will overwrite the commits only on ${logColors.bold}${toBranch}${logColors.normalWeight}.${logColors.reset}?`
|
|
76
|
+
: 'Ready to deploy?',
|
|
77
|
+
default: false,
|
|
78
|
+
}));
|
|
78
79
|
if (!shouldPush) {
|
|
79
80
|
throw new KnownError(`Deploy aborted.`);
|
|
80
81
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deploy-vir",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Deploy a branch to another branch with notifications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deploy",
|
|
@@ -41,50 +41,51 @@
|
|
|
41
41
|
"test:update": "npm run test update"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@augment-vir/assert": "^31.
|
|
45
|
-
"@augment-vir/common": "^31.
|
|
46
|
-
"@augment-vir/node": "^31.
|
|
47
|
-
"@inquirer/prompts": "^
|
|
48
|
-
"@slack/web-api": "^7.
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
44
|
+
"@augment-vir/assert": "^31.54.3",
|
|
45
|
+
"@augment-vir/common": "^31.54.3",
|
|
46
|
+
"@augment-vir/node": "^31.54.3",
|
|
47
|
+
"@inquirer/prompts": "^8.0.2",
|
|
48
|
+
"@slack/web-api": "^7.13.0",
|
|
49
|
+
"cli-vir": "^1.0.3",
|
|
50
|
+
"simple-git": "^3.30.0",
|
|
51
|
+
"tsx": "^4.21.0",
|
|
52
|
+
"url-vir": "^2.1.7"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
|
-
"@eslint/eslintrc": "^3.3.
|
|
55
|
-
"@eslint/js": "^9.
|
|
56
|
-
"@stylistic/eslint-plugin": "^5.
|
|
55
|
+
"@eslint/eslintrc": "^3.3.3",
|
|
56
|
+
"@eslint/js": "^9.39.1",
|
|
57
|
+
"@stylistic/eslint-plugin": "^5.6.1",
|
|
57
58
|
"@stylistic/eslint-plugin-ts": "^4.4.1",
|
|
58
59
|
"@types/node": "^24.3.0",
|
|
59
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
60
|
-
"cspell": "^9.
|
|
61
|
-
"dependency-cruiser": "^17.
|
|
62
|
-
"esbuild": "^0.
|
|
63
|
-
"eslint": "^9.
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^8.47.0",
|
|
61
|
+
"cspell": "^9.4.0",
|
|
62
|
+
"dependency-cruiser": "^17.3.2",
|
|
63
|
+
"esbuild": "^0.27.1",
|
|
64
|
+
"eslint": "^9.39.1",
|
|
64
65
|
"eslint-config-prettier": "^10.1.8",
|
|
65
|
-
"eslint-plugin-jsdoc": "^
|
|
66
|
+
"eslint-plugin-jsdoc": "^61.5.0",
|
|
66
67
|
"eslint-plugin-monorepo-cop": "^1.0.2",
|
|
67
|
-
"eslint-plugin-playwright": "^2.
|
|
68
|
+
"eslint-plugin-playwright": "^2.4.0",
|
|
68
69
|
"eslint-plugin-prettier": "^5.5.4",
|
|
69
70
|
"eslint-plugin-require-extensions": "^0.1.3",
|
|
70
71
|
"eslint-plugin-sonarjs": "^3.0.5",
|
|
71
|
-
"eslint-plugin-unicorn": "^
|
|
72
|
+
"eslint-plugin-unicorn": "^62.0.0",
|
|
72
73
|
"istanbul-smart-text-reporter": "^1.1.5",
|
|
73
74
|
"markdown-code-example-inserter": "^3.0.3",
|
|
74
|
-
"npm-check-updates": "^
|
|
75
|
+
"npm-check-updates": "^19.1.2",
|
|
75
76
|
"prettier": "~3.3.3",
|
|
76
77
|
"prettier-plugin-interpolated-html-tags": "^2.0.1",
|
|
77
|
-
"prettier-plugin-jsdoc": "^1.
|
|
78
|
-
"prettier-plugin-multiline-arrays": "^4.0.
|
|
79
|
-
"prettier-plugin-organize-imports": "^4.
|
|
80
|
-
"prettier-plugin-packagejson": "^2.5.
|
|
78
|
+
"prettier-plugin-jsdoc": "^1.8.0",
|
|
79
|
+
"prettier-plugin-multiline-arrays": "^4.0.5",
|
|
80
|
+
"prettier-plugin-organize-imports": "^4.3.0",
|
|
81
|
+
"prettier-plugin-packagejson": "^2.5.20",
|
|
81
82
|
"prettier-plugin-sort-json": "^4.1.1",
|
|
82
83
|
"prettier-plugin-toml": "^2.0.6",
|
|
83
|
-
"runstorm": "^0.
|
|
84
|
-
"typedoc": "^0.28.
|
|
85
|
-
"typescript": "^5.9.
|
|
86
|
-
"typescript-eslint": "^8.
|
|
87
|
-
"virmator": "^14.
|
|
84
|
+
"runstorm": "^1.0.0",
|
|
85
|
+
"typedoc": "^0.28.15",
|
|
86
|
+
"typescript": "^5.9.3",
|
|
87
|
+
"typescript-eslint": "^8.47.0",
|
|
88
|
+
"virmator": "^14.3.3"
|
|
88
89
|
},
|
|
89
90
|
"engines": {
|
|
90
91
|
"node": ">=22"
|
package/src/cli/cli.script.ts
CHANGED
|
@@ -1,11 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {FlagRequirement, parseArgs} from 'cli-vir';
|
|
2
2
|
import {runDeployVirCli} from './cli.js';
|
|
3
3
|
|
|
4
4
|
await runDeployVirCli(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
parseArgs(
|
|
6
|
+
process.argv,
|
|
7
|
+
{
|
|
8
|
+
y: {
|
|
9
|
+
flag: {
|
|
10
|
+
valueRequirement: FlagRequirement.Blocked,
|
|
11
|
+
},
|
|
12
|
+
description: 'If set, bypass manual validation.',
|
|
13
|
+
},
|
|
14
|
+
args: {
|
|
15
|
+
position: {
|
|
16
|
+
rest: true,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
binName: 'deploy-vir',
|
|
22
|
+
importMeta: import.meta,
|
|
23
|
+
},
|
|
24
|
+
),
|
|
10
25
|
process.cwd(),
|
|
11
26
|
);
|
package/src/cli/cli.ts
CHANGED
|
@@ -12,14 +12,31 @@ import {sendNotifications} from '../notifications/send-notifications.js';
|
|
|
12
12
|
*
|
|
13
13
|
* @category Internal
|
|
14
14
|
*/
|
|
15
|
-
export async function runDeployVirCli(
|
|
15
|
+
export async function runDeployVirCli(
|
|
16
|
+
{
|
|
17
|
+
args,
|
|
18
|
+
y,
|
|
19
|
+
}: {
|
|
20
|
+
y: boolean;
|
|
21
|
+
args: ReadonlyArray<string>;
|
|
22
|
+
},
|
|
23
|
+
cwd = process.cwd(),
|
|
24
|
+
) {
|
|
16
25
|
const configPath = assertWrap.isTruthy(args[0], 'Missing config path.');
|
|
17
26
|
const repoName = assertWrap.isTruthy(args[1], 'Missing repo name.');
|
|
18
27
|
const deployName = assertWrap.isTruthy(args[2], 'Missing deploy name.');
|
|
19
28
|
|
|
20
29
|
const config = (await import(resolve(cwd, configPath))).default;
|
|
21
30
|
|
|
22
|
-
await runDeployVir(
|
|
31
|
+
await runDeployVir(
|
|
32
|
+
{
|
|
33
|
+
cwd,
|
|
34
|
+
deployName,
|
|
35
|
+
repoName,
|
|
36
|
+
bypassConfirmation: y,
|
|
37
|
+
},
|
|
38
|
+
config,
|
|
39
|
+
);
|
|
23
40
|
}
|
|
24
41
|
|
|
25
42
|
/**
|
|
@@ -33,6 +50,8 @@ export type DeployVirArgs = {
|
|
|
33
50
|
/** This much match a deploy name in your config. */
|
|
34
51
|
deployName: string;
|
|
35
52
|
cwd: string;
|
|
53
|
+
/** If true, manual confirmation is not required. */
|
|
54
|
+
bypassConfirmation: boolean;
|
|
36
55
|
};
|
|
37
56
|
|
|
38
57
|
/**
|
|
@@ -62,7 +81,12 @@ export async function runDeployVir(
|
|
|
62
81
|
const remoteName = await getGitRemoteName(git, repoConfig);
|
|
63
82
|
log.faint(`Remote: ${remoteName}`);
|
|
64
83
|
|
|
65
|
-
const deployResult = await pushDeploy(
|
|
84
|
+
const deployResult = await pushDeploy(
|
|
85
|
+
git,
|
|
86
|
+
branchConfig,
|
|
87
|
+
remoteName,
|
|
88
|
+
args.bypassConfirmation,
|
|
89
|
+
);
|
|
66
90
|
|
|
67
91
|
if (config.notifications?.length) {
|
|
68
92
|
await sendNotifications(config.notifications, {
|
package/src/git.ts
CHANGED
|
@@ -90,6 +90,7 @@ export async function pushDeploy(
|
|
|
90
90
|
git: Readonly<SimpleGit>,
|
|
91
91
|
{deployName, fromBranch, toBranch}: Readonly<DeployVirBranchConfig>,
|
|
92
92
|
remoteName: string,
|
|
93
|
+
bypassConfirmation = false,
|
|
93
94
|
): Promise<DeployResult> {
|
|
94
95
|
assert.isTruthy(fromBranch, `Deploy '${deployName}' fromBranch cannot be empty.`);
|
|
95
96
|
assert.isTruthy(toBranch, `Deploy '${deployName}' toBranch cannot be empty.`);
|
|
@@ -161,12 +162,14 @@ export async function pushDeploy(
|
|
|
161
162
|
});
|
|
162
163
|
}
|
|
163
164
|
|
|
164
|
-
const shouldPush =
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
:
|
|
168
|
-
|
|
169
|
-
|
|
165
|
+
const shouldPush =
|
|
166
|
+
bypassConfirmation ||
|
|
167
|
+
(await confirm({
|
|
168
|
+
message: requiresForcePush
|
|
169
|
+
? `\n${logColors.warning}Do you want to force push ${logColors.bold}${fromBranch}${logColors.normalWeight} to ${logColors.bold}${toBranch}${logColors.normalWeight}?\n\nThis will overwrite the commits only on ${logColors.bold}${toBranch}${logColors.normalWeight}.${logColors.reset}?`
|
|
170
|
+
: 'Ready to deploy?',
|
|
171
|
+
default: false,
|
|
172
|
+
}));
|
|
170
173
|
|
|
171
174
|
if (!shouldPush) {
|
|
172
175
|
throw new KnownError(`Deploy aborted.`);
|