mstate-cli 0.1.0 → 0.1.2

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.
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "mstate-cli",
3
+ "version": "0.1.2",
4
+ "main": "index.js",
5
+ "bin": {
6
+ "mstate": "./dist/index.js"
7
+ },
8
+ "scripts": {
9
+ "build": "tsc",
10
+ "start": "npm run build && node dist/index.js"
11
+ },
12
+ "keywords": [
13
+ "mstate",
14
+ "workflow"
15
+ ],
16
+ "author": "",
17
+ "license": "ISC",
18
+ "description": "A CLI tool for maintaining mstate workflows config",
19
+ "devDependencies": {
20
+ "@types/node": "^22.9.0",
21
+ "typescript": "^5.6.3"
22
+ }
23
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MOBIOFFICE_URL = exports.MSTATE_URL = void 0;
4
- exports.MSTATE_URL = 'https://dev.mstate.mobioffice.io/api';
5
- // export const MSTATE_URL = 'https://api.mstate.mobioffice.io/api';
4
+ // export const MSTATE_URL = 'https://dev.mstate.mobioffice.io/api';
5
+ exports.MSTATE_URL = 'https://api.mstate.mobioffice.io/api';
6
6
  exports.MOBIOFFICE_URL = 'https://server.mobioffice.io/api';
@@ -8,6 +8,8 @@ var CmdAction;
8
8
  CmdAction["ADD"] = "add";
9
9
  CmdAction["CLONE"] = "clone";
10
10
  CmdAction["PUSH"] = "push";
11
- CmdAction["HELP"] = "help";
11
+ CmdAction["HELP"] = "--help";
12
12
  CmdAction["HELP_FLAG"] = "-h";
13
+ CmdAction["VERSION"] = "--version";
14
+ CmdAction["VERSION_FLAG"] = "-v";
13
15
  })(CmdAction || (exports.CmdAction = CmdAction = {}));
@@ -1,6 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
3
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ const package_json_1 = __importDefault(require("../package.json"));
4
8
  const action_handler_1 = require("./handlers/action.handler");
5
9
  const workflow_handler_1 = require("./handlers/workflow.handler");
6
10
  const enum_1 = require("./common/enum");
@@ -9,6 +13,10 @@ const utils_1 = require("./common/utils");
9
13
  const environment_handler_1 = require("./handlers/environment.handler");
10
14
  const [action] = process.argv.slice(2);
11
15
  switch (action) {
16
+ case enum_1.CmdAction.VERSION:
17
+ case enum_1.CmdAction.VERSION_FLAG:
18
+ console.log(`v${package_json_1.default.version}`);
19
+ break;
12
20
  case enum_1.CmdAction.LINK:
13
21
  case enum_1.CmdAction.UNLINK:
14
22
  mobioffice_handler_1.mobiofficeHandler.linkToMobioffice(action);
@@ -37,9 +45,10 @@ switch (action) {
37
45
  utils_1.customLog.info(enum_1.CmdAction.PUSH, 'Update the changes one in cloned workflow');
38
46
  utils_1.customLog.info(enum_1.CmdAction.LINK, 'add workflow and allow user to view workflow to mobioffice application');
39
47
  utils_1.customLog.info(enum_1.CmdAction.UNLINK, 'add workflow and remove user to view workflow to mobioffice application');
48
+ utils_1.customLog.info([enum_1.CmdAction.VERSION_FLAG, enum_1.CmdAction.VERSION].toString(), 'add workflow and remove user to view workflow to mobioffice application');
40
49
  break;
41
50
  default:
42
- utils_1.customLog.error(`${action ? 'Invalid' : 'Missing'} script: "${action !== null && action !== void 0 ? action : ''}"`);
43
- console.log('use `mstate help, -h` for getting allowed action');
51
+ utils_1.customLog.error(`${action ? 'Invalid' : 'Missing'} script: ${action !== null && action !== void 0 ? action : ''}`);
52
+ console.log(`use 'mstate ${enum_1.CmdAction.HELP_FLAG}, ${enum_1.CmdAction.HELP}' for getting allowed action`);
44
53
  }
45
54
  console.log('\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mstate-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "main": "index.js",
5
5
  "bin": {
6
6
  "mstate": "./dist/index.js"
@@ -1,3 +1,3 @@
1
- export const MSTATE_URL = 'https://dev.mstate.mobioffice.io/api';
2
- // export const MSTATE_URL = 'https://api.mstate.mobioffice.io/api';
1
+ // export const MSTATE_URL = 'https://dev.mstate.mobioffice.io/api';
2
+ export const MSTATE_URL = 'https://api.mstate.mobioffice.io/api';
3
3
  export const MOBIOFFICE_URL = 'https://server.mobioffice.io/api';
@@ -4,6 +4,8 @@ export enum CmdAction {
4
4
  ADD = 'add',
5
5
  CLONE = 'clone',
6
6
  PUSH = 'push',
7
- HELP = 'help',
7
+ HELP = '--help',
8
8
  HELP_FLAG = '-h',
9
+ VERSION = '--version',
10
+ VERSION_FLAG = '-v',
9
11
  }
package/src/index.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import packageJSON from '../package.json';
4
+
3
5
  import { actionHandler } from './handlers/action.handler';
4
6
  import { workflowHandler } from './handlers/workflow.handler';
5
7
  import { CmdAction } from './common/enum';
@@ -10,6 +12,11 @@ import { environmentHandler } from './handlers/environment.handler';
10
12
  const [action] = process.argv.slice(2);
11
13
 
12
14
  switch (action as CmdAction) {
15
+ case CmdAction.VERSION:
16
+ case CmdAction.VERSION_FLAG:
17
+ console.log(`v${packageJSON.version}`);
18
+ break;
19
+
13
20
  case CmdAction.LINK:
14
21
  case CmdAction.UNLINK:
15
22
  mobiofficeHandler.linkToMobioffice(
@@ -50,12 +57,18 @@ switch (action as CmdAction) {
50
57
  CmdAction.UNLINK,
51
58
  'add workflow and remove user to view workflow to mobioffice application',
52
59
  );
60
+ customLog.info(
61
+ [CmdAction.VERSION_FLAG, CmdAction.VERSION].toString(),
62
+ 'add workflow and remove user to view workflow to mobioffice application',
63
+ );
53
64
  break;
54
65
  default:
55
66
  customLog.error(
56
- `${action ? 'Invalid' : 'Missing'} script: "${action ?? ''}"`,
67
+ `${action ? 'Invalid' : 'Missing'} script: ${action ?? ''}`,
68
+ );
69
+ console.log(
70
+ `use 'mstate ${CmdAction.HELP_FLAG}, ${CmdAction.HELP}' for getting allowed action`,
57
71
  );
58
- console.log('use `mstate help, -h` for getting allowed action');
59
72
  }
60
73
 
61
74
  console.log('\n');
package/tsconfig.json CHANGED
@@ -7,6 +7,7 @@
7
7
  "forceConsistentCasingInFileNames": true,
8
8
  "strict": true,
9
9
  "skipLibCheck": true,
10
- "moduleResolution": "node"
10
+ "moduleResolution": "node",
11
+ "resolveJsonModule": true
11
12
  }
12
13
  }
File without changes