hsh19900502 1.0.7 → 1.0.8

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 ADDED
File without changes
@@ -1,3 +1,4 @@
1
1
  import 'zx/globals';
2
2
  export declare const gcm: (message: string, isPush?: boolean) => Promise<void>;
3
+ export declare const merge: (branch: string) => Promise<void>;
3
4
  export declare const push: () => Promise<void>;
@@ -9,6 +9,18 @@ export const gcm = async function (message, isPush) {
9
9
  await push();
10
10
  }
11
11
  };
12
+ export const merge = async (branch) => {
13
+ const currentBranch = (await $ `git branch --show-current`).stdout.trim();
14
+ if (currentBranch === branch) {
15
+ console.warn(chalk.yellow('Current branch is the same as the branch to be merged'));
16
+ return;
17
+ }
18
+ await $ `git checkout ${branch}`;
19
+ await $ `git pull origin ${branch}`;
20
+ await $ `git checkout ${currentBranch}`;
21
+ await $ `git merge ${branch}`;
22
+ console.log(chalk.green('Merged branch into current branch successfully!\n'));
23
+ };
12
24
  export const push = async function () {
13
25
  const question = [
14
26
  {
package/dist/hsh.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { gcm, push } from './commands/git.js';
2
+ import { gcm, merge, push } from './commands/git.js';
3
3
  import { Command } from 'commander';
4
4
  import packageJson from '../package.json' assert { type: "json" };
5
5
  import { initMonoRepo, monoCd } from './commands/mono.js';
@@ -21,6 +21,12 @@ program
21
21
  .action(() => {
22
22
  push();
23
23
  });
24
+ program.command('merge')
25
+ .description('merge branch into current branch')
26
+ .argument('<branch>')
27
+ .action((branch) => {
28
+ merge(branch);
29
+ });
24
30
  const mono = program.command('mono').description('multi repo management');
25
31
  mono.command('init').description('init mono repo').action(() => {
26
32
  initMonoRepo();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hsh19900502",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "index.js",
@@ -12,6 +12,19 @@ export const gcm = async function (message: string, isPush?: boolean): Promise<v
12
12
  }
13
13
  };
14
14
 
15
+ export const merge = async (branch: string) => {
16
+ const currentBranch = (await $`git branch --show-current`).stdout.trim()
17
+ if(currentBranch === branch) {
18
+ console.warn(chalk.yellow('Current branch is the same as the branch to be merged'));
19
+ return;
20
+ }
21
+ await $`git checkout ${branch}`;
22
+ await $`git pull origin ${branch}`;
23
+ await $`git checkout ${currentBranch}`;
24
+ await $`git merge ${branch}`;
25
+ console.log(chalk.green('Merged branch into current branch successfully!\n'));
26
+ }
27
+
15
28
  interface BranchQuestion {
16
29
  type: 'input';
17
30
  name: 'branch';
package/src/hsh.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { gcm, push } from './commands/git.js';
2
+ import { gcm, merge, push } from './commands/git.js';
3
3
  import { Command } from 'commander';
4
4
  import packageJson from '../package.json' assert { type: "json" };
5
5
  import { initMonoRepo, monoCd } from './commands/mono.js';
@@ -27,6 +27,13 @@ program
27
27
  push();
28
28
  });
29
29
 
30
+ program.command('merge')
31
+ .description('merge branch into current branch')
32
+ .argument('<branch>')
33
+ .action((branch: string) => {
34
+ merge(branch);
35
+ })
36
+
30
37
  const mono = program.command('mono').description('multi repo management')
31
38
  mono.command('init').description('init mono repo').action(() => {
32
39
  initMonoRepo();