imdone-cli 0.1.3 → 0.1.5

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/package.json CHANGED
@@ -1,12 +1,17 @@
1
1
  {
2
2
  "name": "imdone-cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "author": "Jesse Piascik",
5
5
  "description": "An imdone cli that automates your task updates with markdown files.",
6
+ "license": "Proprietary",
7
+ "engines": {
8
+ "node": ">=22.0.0"
9
+ },
10
+
6
11
  "main": "src/index.js",
7
12
  "type": "module",
8
13
  "bin": {
9
- "imdone": "dist/index.cjs"
14
+ "imdone": "dist/index.min.cjs"
10
15
  },
11
16
  "scripts": {
12
17
  "prepublishOnly": "npm --prefix ../ install && npm --prefix ../ run build && npm i && npm test && npm run build",
@@ -16,12 +21,11 @@
16
21
  "test": "vitest --run",
17
22
  "test-ci": "vitest --run"
18
23
  },
19
- "license": "ISC",
20
24
  "dependencies": {
21
25
  "chalk": "^5.4.1",
22
26
  "commander": "^13.1.0",
23
27
  "dotenv": "16.4.5",
24
- "imdone-core": "^2.0.9",
28
+ "imdone-core": "^2.0.11",
25
29
  "inquirer": "^12.5.2",
26
30
  "jsonwebtoken": "^9.0.2",
27
31
  "ora": "^8.2.0",
package/src/bin.js CHANGED
@@ -9,35 +9,56 @@ import { gitRepoCheck, imdoneProjectCheck, dotEnvCheck, gitIgnoreCheck, promptFo
9
9
  import { imdoneInit } from './usecases/init.js';
10
10
  import { verifyLicense } from './adapters/license.js';
11
11
  import { init as initEnv, storeLicense } from './adapters/env.js';
12
-
12
+ // get the version from package.json
13
+ import { version } from '../package.json';
13
14
  logger.setLevel(process.env.LOG_LEVEL || LogLevel.ERROR);
14
15
 
16
+ async function pullCommand() {
17
+ const spinner = ora('Pulling issues from Jira...').start();
18
+
19
+ try {
20
+ const { result } = await pullFromJira(process.cwd(), { ...pullDeps, feedback: spinner });
21
+ const { existing, added } = result
22
+ const message = existing.length > 0 || added.length > 0
23
+ ? `Pulled ${existing.length} existing and ${added.length} new issues from Jira`
24
+ : 'No issues to pull from Jira';
25
+ spinner.succeed(message);
26
+ } catch (error) {
27
+ spinner.fail(`Failed to pull issues from Jira: ${error.message}`);
28
+ logger.error(error.stack);
29
+ process.exit(1);
30
+ }
31
+ }
32
+
33
+ async function pushCommand() {
34
+ const spinner = ora('Pushing changes to Jira...').start();
35
+ try {
36
+ const { result } = await pushToJira(process.cwd(), { ...pushDeps, feedback: ora });
37
+ const message = result.length > 0 ? `Pushed ${result.length} changes to Jira` : 'No changes to push to Jira';
38
+ spinner.succeed(message);
39
+ result.forEach(res => {
40
+ console.log(res.url)
41
+ })
42
+ } catch (error) {
43
+ spinner.fail(`Failed to push changes to Jira: ${error.message}`);
44
+ logger.error(error.stack)
45
+ process.exit(1);
46
+ }
47
+ }
48
+
15
49
  const program = new Command();
16
50
 
17
51
  program
18
52
  .name('imdone')
19
53
  .description('Imdone CLI to pull from and push to Jira')
20
- .version('1.0.0');
54
+ .version(version);
21
55
 
22
56
  program
23
57
  .command('pull')
24
58
  .description('Pull issues from Jira')
25
59
  .action(async () => {
26
60
  await checkLicense();
27
- const spinner = ora('Pulling issues from Jira...').start();
28
-
29
- try {
30
- const { result } = await pullFromJira(process.cwd(), { ...pullDeps, feedback: spinner });
31
- const { existing, added } = result
32
- const message = existing.length > 0 || added.length > 0
33
- ? `Pulled ${existing.length} existing and ${added.length} new issues from Jira`
34
- : 'No issues to pull from Jira';
35
- spinner.succeed(message);
36
- } catch (error) {
37
- spinner.fail(`Failed to pull issues from Jira: ${error.message}`);
38
- logger.error(error.stack);
39
- process.exit(1);
40
- }
61
+ await pullCommand();
41
62
  });
42
63
 
43
64
  program
@@ -45,20 +66,8 @@ program
45
66
  .description('Push changes to Jira')
46
67
  .action(async () => {
47
68
  await checkLicense();
48
- const spinner = ora('Pushing changes to Jira...').start();
49
-
50
- try {
51
- const { result } = await pushToJira(process.cwd(), { ...pushDeps, feedback: ora });
52
- const message = result.length > 0 ? `Pushed ${result.length} changes to Jira` : 'No changes to push to Jira';
53
- spinner.succeed(message);
54
- result.forEach(res => {
55
- console.log(res.url)
56
- })
57
- } catch (error) {
58
- spinner.fail(`Failed to push changes to Jira: ${error.message}`);
59
- logger.error(error.stack)
60
- process.exit(1);
61
- }
69
+ await pullCommand();
70
+ await pushCommand();
62
71
  });
63
72
 
64
73
  program