deploy-vir 0.0.3 → 0.1.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/README.md CHANGED
@@ -22,7 +22,7 @@ export default defineDeployVirConfig({
22
22
  {
23
23
  /** This does not need to match the actual repo name. */
24
24
  name: 'whatever',
25
- girUrl: 'git@github.com:electrovir/deploy-vir.git',
25
+ gitUrl: 'git@github.com:electrovir/deploy-vir.git',
26
26
  deploys: [
27
27
  {
28
28
  deployName: 'staging',
package/dist/cli/cli.js CHANGED
@@ -27,6 +27,7 @@ export async function runDeployVir(args, config) {
27
27
  const repoConfig = assertWrap.isDefined(config.repos.find((repo) => repo.name === args.repoName, `Failed to find a repo config by name '${args.repoName}'`));
28
28
  const branchConfig = assertWrap.isDefined(repoConfig.deploys.find((deploy) => deploy.deployName === args.deployName, `Failed to find a deploy named '${args.deployName}' in repo '${args.repoName}'.`));
29
29
  const remoteName = await getGitRemoteName(git, repoConfig);
30
+ log.faint(`Remote: ${remoteName}`);
30
31
  const deployCommits = await pushDeploy(git, branchConfig, remoteName);
31
32
  if (config.notifications?.length) {
32
33
  await sendNotifications(config.notifications, {
@@ -1,2 +1,7 @@
1
+ import { extractRelevantArgs } from '@augment-vir/node';
1
2
  import { runDeployVirCli } from './cli.js';
2
- await runDeployVirCli(process.argv, process.cwd());
3
+ await runDeployVirCli(extractRelevantArgs({
4
+ binName: 'deploy-vir',
5
+ fileName: import.meta.filename,
6
+ rawArgs: process.argv,
7
+ }), process.cwd());
package/dist/config.d.ts CHANGED
@@ -71,7 +71,7 @@ export type DeployVirRepoConfig = {
71
71
  * - 'git@github.com:electrovir/deploy-vir.git'
72
72
  * - 'https://github.com/electrovir/deploy-vir.git'
73
73
  */
74
- girUrl: string;
74
+ gitUrl: string;
75
75
  /**
76
76
  * A url to the base commit path for links. The commit hash will be appended to this for links
77
77
  * in notifications. If this is omitted, there simply won't be any links.
package/dist/git.d.ts CHANGED
@@ -5,7 +5,7 @@ import { type DeployVirBranchConfig, type DeployVirRepoConfig } from './config.j
5
5
  *
6
6
  * @category Internal
7
7
  */
8
- export declare function getGitRemoteName(git: Readonly<SimpleGit>, repoConfig: Readonly<Pick<DeployVirRepoConfig, 'name' | 'girUrl'>>): Promise<string>;
8
+ export declare function getGitRemoteName(git: Readonly<SimpleGit>, repoConfig: Readonly<Pick<DeployVirRepoConfig, 'name' | 'gitUrl'>>): Promise<string>;
9
9
  /**
10
10
  * A git commit.
11
11
  *
package/dist/git.js CHANGED
@@ -9,9 +9,9 @@ import { KnownError } from './known.error.js';
9
9
  */
10
10
  export async function getGitRemoteName(git, repoConfig) {
11
11
  assert.isTruthy(repoConfig.name, 'Repo config name cannot be empty.');
12
- assert.isTruthy(repoConfig.girUrl, 'Repo git URL cannot be empty.');
12
+ assert.isTruthy(repoConfig.gitUrl, 'Repo git URL cannot be empty.');
13
13
  const remotes = await git.getRemotes(true);
14
- const remoteMatchByUrl = remotes.find((remote) => remote.refs.fetch === repoConfig.girUrl || remote.refs.push === repoConfig.girUrl);
14
+ const remoteMatchByUrl = remotes.find((remote) => remote.refs.fetch === repoConfig.gitUrl || remote.refs.push === repoConfig.gitUrl);
15
15
  if (remoteMatchByUrl) {
16
16
  return remoteMatchByUrl.name;
17
17
  }
@@ -22,7 +22,7 @@ export async function getGitRemoteName(git, repoConfig) {
22
22
  ]
23
23
  .filter(check.isTruthy)
24
24
  .join('-');
25
- await git.addRemote(newRemoteName, repoConfig.girUrl);
25
+ await git.addRemote(newRemoteName, repoConfig.gitUrl);
26
26
  return newRemoteName;
27
27
  }
28
28
  /**
@@ -34,6 +34,7 @@ export async function pushDeploy(git, { deployName, fromBranch, toBranch }, remo
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.');
37
+ log.faint(`Pushing ${remoteName}/${fromBranch} to ${toBranch}`);
37
38
  await git.fetch(remoteName, fromBranch);
38
39
  const pushString = `${remoteName}/${fromBranch}:${toBranch}`;
39
40
  /** Get commits that are on {@link toBranch} but not on {@link fromBranch}. */
@@ -26,10 +26,10 @@ export async function sendNotificationToSlack({ branchConfig, deployCommits: { d
26
26
  const deployedCommitBullets = deployedCommits.map((commit) => formatCommit(repoConfig.commitBaseUrl, commit));
27
27
  const overwrittenCommitBullets = overwrittenCommits.map((commit) => formatCommit(repoConfig.commitBaseUrl, commit));
28
28
  const deployedCommitBulletsText = deployedCommitBullets
29
- .map((bullet) => `• ${bullet}`)
29
+ .map((bullet) => `- ${bullet}`)
30
30
  .join('\n');
31
31
  const overwrittenCommitBulletsText = overwrittenCommitBullets.length
32
- ? overwrittenCommitBullets.map((bullet) => `• ${bullet}`).join('\n')
32
+ ? overwrittenCommitBullets.map((bullet) => `- ${bullet}`).join('\n')
33
33
  : undefined;
34
34
  const blocks = [
35
35
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deploy-vir",
3
- "version": "0.0.3",
3
+ "version": "0.1.1",
4
4
  "description": "Deploy a branch to another branch with notifications.",
5
5
  "keywords": [
6
6
  "deploy",
@@ -1,3 +1,11 @@
1
+ import {extractRelevantArgs} from '@augment-vir/node';
1
2
  import {runDeployVirCli} from './cli.js';
2
3
 
3
- await runDeployVirCli(process.argv, process.cwd());
4
+ await runDeployVirCli(
5
+ extractRelevantArgs({
6
+ binName: 'deploy-vir',
7
+ fileName: import.meta.filename,
8
+ rawArgs: process.argv,
9
+ }),
10
+ process.cwd(),
11
+ );
package/src/cli/cli.ts CHANGED
@@ -59,6 +59,7 @@ export async function runDeployVir(
59
59
  ),
60
60
  );
61
61
  const remoteName = await getGitRemoteName(git, repoConfig);
62
+ log.faint(`Remote: ${remoteName}`);
62
63
 
63
64
  const deployCommits = await pushDeploy(git, branchConfig, remoteName);
64
65
 
package/src/config.ts CHANGED
@@ -76,7 +76,7 @@ export type DeployVirRepoConfig = {
76
76
  * - 'git@github.com:electrovir/deploy-vir.git'
77
77
  * - 'https://github.com/electrovir/deploy-vir.git'
78
78
  */
79
- girUrl: string;
79
+ gitUrl: string;
80
80
  /**
81
81
  * A url to the base commit path for links. The commit hash will be appended to this for links
82
82
  * in notifications. If this is omitted, there simply won't be any links.
package/src/git.ts CHANGED
@@ -12,16 +12,16 @@ import {KnownError} from './known.error.js';
12
12
  */
13
13
  export async function getGitRemoteName(
14
14
  git: Readonly<SimpleGit>,
15
- repoConfig: Readonly<Pick<DeployVirRepoConfig, 'name' | 'girUrl'>>,
15
+ repoConfig: Readonly<Pick<DeployVirRepoConfig, 'name' | 'gitUrl'>>,
16
16
  ): Promise<string> {
17
17
  assert.isTruthy(repoConfig.name, 'Repo config name cannot be empty.');
18
- assert.isTruthy(repoConfig.girUrl, 'Repo git URL cannot be empty.');
18
+ assert.isTruthy(repoConfig.gitUrl, 'Repo git URL cannot be empty.');
19
19
 
20
20
  const remotes = await git.getRemotes(true);
21
21
 
22
22
  const remoteMatchByUrl = remotes.find(
23
23
  (remote) =>
24
- remote.refs.fetch === repoConfig.girUrl || remote.refs.push === repoConfig.girUrl,
24
+ remote.refs.fetch === repoConfig.gitUrl || remote.refs.push === repoConfig.gitUrl,
25
25
  );
26
26
 
27
27
  if (remoteMatchByUrl) {
@@ -40,7 +40,7 @@ export async function getGitRemoteName(
40
40
  .filter(check.isTruthy)
41
41
  .join('-');
42
42
 
43
- await git.addRemote(newRemoteName, repoConfig.girUrl);
43
+ await git.addRemote(newRemoteName, repoConfig.gitUrl);
44
44
 
45
45
  return newRemoteName;
46
46
  }
@@ -76,6 +76,8 @@ export async function pushDeploy(
76
76
  assert.isTruthy(toBranch, `Deploy '${deployName}' toBranch cannot be empty.`);
77
77
  assert.isTruthy(remoteName, 'Remote name cannot be empty.');
78
78
 
79
+ log.faint(`Pushing ${remoteName}/${fromBranch} to ${toBranch}`);
80
+
79
81
  await git.fetch(remoteName, fromBranch);
80
82
 
81
83
  const pushString = `${remoteName}/${fromBranch}:${toBranch}`;
@@ -44,11 +44,11 @@ export async function sendNotificationToSlack({
44
44
  );
45
45
 
46
46
  const deployedCommitBulletsText = deployedCommitBullets
47
- .map((bullet) => `• ${bullet}`)
47
+ .map((bullet) => `- ${bullet}`)
48
48
  .join('\n');
49
49
 
50
50
  const overwrittenCommitBulletsText = overwrittenCommitBullets.length
51
- ? overwrittenCommitBullets.map((bullet) => `• ${bullet}`).join('\n')
51
+ ? overwrittenCommitBullets.map((bullet) => `- ${bullet}`).join('\n')
52
52
  : undefined;
53
53
 
54
54
  const blocks: any[] = [