sn-typescript-util 1.0.10 → 1.0.14

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/.prettierrc.yml CHANGED
@@ -1,4 +1,3 @@
1
- trailingComma: 'none'
2
- tabWidth: 2
3
- semi: true
4
1
  singleQuote: true
2
+ tabWidth: 2
3
+ trailingComma: 'none'
package/README.md CHANGED
@@ -77,6 +77,10 @@ Build project utility files and package dependencies. Creates a `ts` directory f
77
77
 
78
78
  ```bash
79
79
  snts --build
80
+
81
+ # or
82
+
83
+ snts -b
80
84
  ```
81
85
 
82
86
  ### Compile
@@ -85,6 +89,10 @@ Compile TypeScript files in the `ts` directory to JavaScript ES5 and moves them
85
89
 
86
90
  ```bash
87
91
  snts --compile
92
+
93
+ # or
94
+
95
+ snts -c
88
96
  ```
89
97
 
90
98
  ### Help
@@ -93,6 +101,10 @@ Display help for the command.
93
101
 
94
102
  ```bash
95
103
  snts --help
104
+
105
+ # or
106
+
107
+ snts -h
96
108
  ```
97
109
 
98
110
  ### Sync
@@ -101,6 +113,10 @@ Sync new instance-based `src` files to the `ts` directory.
101
113
 
102
114
  ```bash
103
115
  snts --sync
116
+
117
+ # or
118
+
119
+ snts -s
104
120
  ```
105
121
 
106
122
  ### Version
@@ -109,6 +125,10 @@ Output the version number.
109
125
 
110
126
  ```bash
111
127
  snts --version
128
+
129
+ # or
130
+
131
+ snts -V
112
132
  ```
113
133
 
114
134
  **[Back to top](#table-of-contents)**
package/bin/snts.ts CHANGED
@@ -15,15 +15,24 @@ const { bold, red } = require('colorette');
15
15
  return init();
16
16
  })();
17
17
 
18
+ function getBuildName() {
19
+ const defaultBuild = 'rome';
20
+ try {
21
+ const workspace = JSON.parse(getWorkspaceConfig());
22
+ const app = workspace.ACTIVE_APPLICATION;
23
+ const build = workspace.ALL_APPLICATIONS[app].BUILD_NAME;
24
+ return Object.entries(build).length !== 0
25
+ ? build.toLowerCase()
26
+ : defaultBuild;
27
+ } catch (e) {
28
+ return defaultBuild;
29
+ }
30
+ }
31
+
18
32
  function getErrorMsg() {
19
- return console.error(
20
- bold(
21
- red(
22
- 'No active application detected. Please create a project with the ServiceNow Extension for VS Code.\n\n' +
23
- 'https://docs.servicenow.com/bundle/quebec-application-development/page/build/applications/task/create-project.html'
24
- )
25
- )
26
- );
33
+ var url = `https://docs.servicenow.com/bundle/${getBuildName()}-application-development/page/build/applications/task/create-project.html`;
34
+ var msg = `No active application detected. Please create a project with the ServiceNow Extension for VS Code.\n\n${url}`;
35
+ return console.error(bold(red(msg)));
27
36
  }
28
37
 
29
38
  function getOption(opts) {
@@ -57,10 +66,13 @@ function getProgressBar() {
57
66
  });
58
67
  }
59
68
 
69
+ function getWorkspaceConfig() {
70
+ return fs.readFileSync('./system/sn-workspace.json');
71
+ }
72
+
60
73
  function hasApplication() {
61
74
  try {
62
- const workspace = fs.readFileSync('system/sn-workspace.json');
63
- const app = JSON.parse(workspace).ACTIVE_APPLICATION;
75
+ const app = JSON.parse(getWorkspaceConfig()).ACTIVE_APPLICATION;
64
76
  return Object.entries(app).length === 0 ? getErrorMsg() : true;
65
77
  } catch (e) {
66
78
  getErrorMsg();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sn-typescript-util",
3
- "version": "1.0.10",
3
+ "version": "1.0.14",
4
4
  "description": "A TypeScript utility for ServiceNow developers using VS Code",
5
5
  "bin": {
6
6
  "snts": "bin/snts.ts"
@@ -17,16 +17,16 @@
17
17
  "url": "https://github.com/stevengregory/sn-typescript-util.git"
18
18
  },
19
19
  "dependencies": {
20
- "@types/node": "^14.14.25",
20
+ "@types/node": "^15.12.2",
21
21
  "@types/servicenow": "^10.0.1",
22
22
  "cli-progress": "^3.9.0",
23
- "colorette": "^1.2.1",
23
+ "colorette": "^1.2.2",
24
24
  "colors": "^1.4.0",
25
- "commander": "^7.0.0",
25
+ "commander": "^7.2.0",
26
26
  "nodemon": "^2.0.7",
27
27
  "npm-add-script": "^1.1.0",
28
- "prettier": "^2.2.1",
29
- "ts-node": "^9.1.1",
30
- "typescript": "^4.1.3"
28
+ "prettier": "^2.3.1",
29
+ "ts-node": "^10.0.0",
30
+ "typescript": "^4.3.2"
31
31
  }
32
32
  }
@@ -1,6 +1,5 @@
1
1
  {
2
- "trailingComma": "none",
2
+ "singleQuote": true,
3
3
  "tabWidth": 2,
4
- "semi": true,
5
- "singleQuote": true
4
+ "trailingComma": "none"
6
5
  }
@@ -4,12 +4,13 @@
4
4
  "outDir": "dist",
5
5
  "baseUrl": ".",
6
6
  "paths": {
7
- "*": ["./lib/dts/index.d.ts"]
7
+ "*": ["./lib/dts/*.d.ts"]
8
8
  }
9
9
  },
10
10
  "include": [
11
11
  "./@project/ts/**/*",
12
- "./lib/dts/index.d.ts",
12
+ "./lib/dts/*.d.ts",
13
13
  "./@project/ts/Interfaces/*.ts"
14
- ]
14
+ ],
15
+ "exclude": ["node_modules"]
15
16
  }