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 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: ReadonlyArray<string>, cwd?: string): Promise<void>;
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({ cwd, deployName, repoName }, config);
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,
@@ -1,7 +1,18 @@
1
- import { extractRelevantArgs } from '@augment-vir/node';
1
+ import { FlagRequirement, parseArgs } from 'cli-vir';
2
2
  import { runDeployVirCli } from './cli.js';
3
- await runDeployVirCli(extractRelevantArgs({
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
- fileName: import.meta.filename,
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 = await confirm({
73
- message: requiresForcePush
74
- ? `\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}?`
75
- : 'Ready to deploy?',
76
- default: false,
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.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.33.0",
45
- "@augment-vir/common": "^31.33.0",
46
- "@augment-vir/node": "^31.33.0",
47
- "@inquirer/prompts": "^7.8.4",
48
- "@slack/web-api": "^7.10.0",
49
- "simple-git": "^3.28.0",
50
- "tsx": "^4.20.5",
51
- "url-vir": "^2.1.4"
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.1",
55
- "@eslint/js": "^9.34.0",
56
- "@stylistic/eslint-plugin": "^5.2.3",
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.41.0",
60
- "cspell": "^9.2.0",
61
- "dependency-cruiser": "^17.0.1",
62
- "esbuild": "^0.25.9",
63
- "eslint": "^9.34.0",
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": "^54.1.1",
66
+ "eslint-plugin-jsdoc": "^61.5.0",
66
67
  "eslint-plugin-monorepo-cop": "^1.0.2",
67
- "eslint-plugin-playwright": "^2.2.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": "^57.0.0",
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": "^18.0.3",
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.3.3",
78
- "prettier-plugin-multiline-arrays": "^4.0.3",
79
- "prettier-plugin-organize-imports": "^4.2.0",
80
- "prettier-plugin-packagejson": "^2.5.19",
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.6.1",
84
- "typedoc": "^0.28.11",
85
- "typescript": "^5.9.2",
86
- "typescript-eslint": "^8.41.0",
87
- "virmator": "^14.0.1"
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"
@@ -1,11 +1,26 @@
1
- import {extractRelevantArgs} from '@augment-vir/node';
1
+ import {FlagRequirement, parseArgs} from 'cli-vir';
2
2
  import {runDeployVirCli} from './cli.js';
3
3
 
4
4
  await runDeployVirCli(
5
- extractRelevantArgs({
6
- binName: 'deploy-vir',
7
- fileName: import.meta.filename,
8
- rawArgs: process.argv,
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(args: ReadonlyArray<string>, cwd = process.cwd()) {
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({cwd, deployName, repoName}, config);
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(git, branchConfig, remoteName);
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 = await confirm({
165
- message: requiresForcePush
166
- ? `\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}?`
167
- : 'Ready to deploy?',
168
- default: false,
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.`);