avil13-co 2.2.2 → 2.2.4

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.
Files changed (27) hide show
  1. package/dist/{src/ask.d.ts → ask.d.ts} +0 -0
  2. package/dist/{src/ask.js → ask.js} +0 -0
  3. package/dist/{src/cli-commands → cli-commands}/index.d.ts +0 -0
  4. package/dist/{src/cli-commands → cli-commands}/index.js +0 -2
  5. package/dist/{src/color.d.ts → color.d.ts} +0 -0
  6. package/dist/{src/color.js → color.js} +0 -0
  7. package/dist/{src/commands → commands}/checkout-branch.d.ts +0 -0
  8. package/dist/{src/commands → commands}/checkout-branch.js +0 -0
  9. package/dist/{src/commands → commands}/delete-barnch.d.ts +0 -0
  10. package/dist/{src/commands → commands}/delete-barnch.js +0 -0
  11. package/dist/{src/commands → commands}/exec.d.ts +0 -0
  12. package/dist/{src/commands → commands}/exec.js +0 -0
  13. package/dist/{src/commands → commands}/get-branches.d.ts +0 -0
  14. package/dist/{src/commands → commands}/get-branches.js +0 -0
  15. package/dist/{src/commands → commands}/get-current-branch-name.d.ts +0 -0
  16. package/dist/{src/commands → commands}/get-current-branch-name.js +0 -0
  17. package/dist/{src/commands → commands}/index.d.ts +0 -0
  18. package/dist/{src/commands → commands}/index.js +0 -0
  19. package/dist/{src/commands → commands}/merge-branch.d.ts +0 -0
  20. package/dist/commands/merge-branch.js +44 -0
  21. package/dist/{src/index.d.ts → index.d.ts} +0 -0
  22. package/dist/{src/index.js → index.js} +0 -0
  23. package/package.json +1 -1
  24. package/src/cli-commands/index.ts +0 -2
  25. package/src/commands/merge-branch.ts +34 -4
  26. package/dist/package.json +0 -50
  27. package/dist/src/commands/merge-branch.js +0 -16
File without changes
File without changes
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getHelp = exports.getWishOfUser = exports.Commands = void 0;
4
- const package_json_1 = require("../../package.json");
5
4
  const args = process.argv.slice(2);
6
5
  var Commands;
7
6
  (function (Commands) {
@@ -35,7 +34,6 @@ const getHelp = () => {
35
34
  return `
36
35
  DESCRIPTION:
37
36
  A console program for quickly switching between branches
38
- VERSION: ${package_json_1.version}
39
37
 
40
38
  OPTIONS:
41
39
  help, -h, --h, --help
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.mergeBranch = void 0;
7
+ const exec_1 = require("./exec");
8
+ const color_1 = require("../color");
9
+ const inquirer_1 = __importDefault(require("inquirer"));
10
+ //
11
+ async function mergeBranch(branchName) {
12
+ if (!branchName) {
13
+ throw new Error('No branch...');
14
+ }
15
+ const currentBranch = await (0, exec_1.exec)('git rev-parse --abbrev-ref HEAD');
16
+ const message = [
17
+ color_1.clc._blue,
18
+ 'Do you want to merge branch ',
19
+ color_1.clc._green,
20
+ branchName,
21
+ color_1.clc._blue,
22
+ ' into ',
23
+ color_1.clc._green,
24
+ currentBranch,
25
+ color_1.clc._blue,
26
+ '?',
27
+ color_1.clc._off,
28
+ ].join('');
29
+ const res = await inquirer_1.default.prompt({
30
+ type: 'confirm',
31
+ name: 'answer',
32
+ message,
33
+ default: false,
34
+ });
35
+ if (res.answer === true) {
36
+ const checkoutCommand = `git merge ${branchName}`;
37
+ console.log(' ' + color_1.clc.green('git merge', branchName) + '\n');
38
+ const checkoutCommandResult = await (0, exec_1.exec)(checkoutCommand);
39
+ console.log(checkoutCommandResult);
40
+ return;
41
+ }
42
+ console.log(color_1.clc.yellow('The branch was not merged'));
43
+ }
44
+ exports.mergeBranch = mergeBranch;
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "avil13-co",
3
- "version": "2.2.2",
3
+ "version": "2.2.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "public": true,
@@ -1,5 +1,4 @@
1
1
  import { clc } from '../color';
2
- import { version } from '../../package.json';
3
2
 
4
3
  const args = process.argv.slice(2);
5
4
 
@@ -41,7 +40,6 @@ export const getHelp = (): string => {
41
40
  return `
42
41
  DESCRIPTION:
43
42
  A console program for quickly switching between branches
44
- VERSION: ${version}
45
43
 
46
44
  OPTIONS:
47
45
  help, -h, --h, --help
@@ -1,5 +1,6 @@
1
1
  import { exec } from './exec';
2
2
  import { clc } from '../color';
3
+ import inquirer from 'inquirer';
3
4
 
4
5
  //
5
6
  export async function mergeBranch(branchName: string) {
@@ -7,10 +8,39 @@ export async function mergeBranch(branchName: string) {
7
8
  throw new Error('No branch...');
8
9
  }
9
10
 
10
- const checkoutCommand = `git merge ${branchName}`;
11
+ const currentBranch = await exec('git rev-parse --abbrev-ref HEAD');
11
12
 
12
- console.log(' ' + clc.green('git merge', branchName) + '\n');
13
+ const message = [
14
+ clc._blue,
15
+ 'Do you want to merge branch ',
16
+ clc._green,
17
+ branchName, // branch
18
+ clc._blue,
19
+ ' into ',
20
+ clc._green,
21
+ currentBranch, // branch
22
+ clc._blue,
23
+ '?',
24
+ clc._off,
25
+ ].join('');
13
26
 
14
- const checkoutCommandResult = await exec(checkoutCommand);
15
- console.log(checkoutCommandResult);
27
+ const res = await inquirer.prompt({
28
+ type: 'confirm',
29
+ name: 'answer',
30
+ message,
31
+ default: false,
32
+ });
33
+
34
+ if (res.answer === true) {
35
+ const checkoutCommand = `git merge ${branchName}`;
36
+
37
+ console.log(' ' + clc.green('git merge', branchName) + '\n');
38
+
39
+ const checkoutCommandResult = await exec(checkoutCommand);
40
+ console.log(checkoutCommandResult);
41
+
42
+ return;
43
+ }
44
+
45
+ console.log(clc.yellow('The branch was not merged'));
16
46
  }
package/dist/package.json DELETED
@@ -1,50 +0,0 @@
1
- {
2
- "name": "avil13-co",
3
- "version": "2.2.2",
4
- "description": "",
5
- "main": "dist/index.js",
6
- "public": true,
7
- "bin": {
8
- "co": "./bin/co"
9
- },
10
- "files": [
11
- "dist",
12
- "bin",
13
- "src",
14
- "assets"
15
- ],
16
- "scripts": {
17
- "prepublishOnly": "npm run build",
18
- "start": "npm run build && node dist/index.js",
19
- "dev": "ts-node --project tsconfig.json src/index.ts",
20
- "dev:watch": "nodemon",
21
- "lint:fix": "eslint --fix --ext .js,.ts .",
22
- "test": "vitest run",
23
- "test:watch": "vitest",
24
- "type-check": "tsc -p . --noEmit",
25
- "type-check:watch": "npm run type-check -- --watch",
26
- "build": "rm -rf ./dist && tsc -p ."
27
- },
28
- "keywords": [
29
- "git",
30
- "git checkout",
31
- "cli"
32
- ],
33
- "author": "Aleksey Pivkin",
34
- "license": "ISC",
35
- "repository": {
36
- "type": "git",
37
- "url": "git@github.com:avil13/avil13-git-co.git"
38
- },
39
- "dependencies": {
40
- "inquirer": "^8.2.2",
41
- "inquirer-autocomplete-prompt": "^2.0.0"
42
- },
43
- "devDependencies": {
44
- "@types/inquirer": "^8.2.1",
45
- "@types/node": "^17.0.23",
46
- "ts-node": "^10.7.0",
47
- "typescript": "^4.6.3",
48
- "vitest": "^0.10.0"
49
- }
50
- }
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeBranch = void 0;
4
- const exec_1 = require("./exec");
5
- const color_1 = require("../color");
6
- //
7
- async function mergeBranch(branchName) {
8
- if (!branchName) {
9
- throw new Error('No branch...');
10
- }
11
- const checkoutCommand = `git merge ${branchName}`;
12
- console.log(' ' + color_1.clc.green('git merge', branchName) + '\n');
13
- const checkoutCommandResult = await (0, exec_1.exec)(checkoutCommand);
14
- console.log(checkoutCommandResult);
15
- }
16
- exports.mergeBranch = mergeBranch;