sn-typescript-util 1.0.13 → 1.0.16

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,4 @@
1
+ .yarn
2
+ .vscode
3
+ .DS_Store
4
+ node_modules
package/README.md CHANGED
@@ -57,6 +57,10 @@ After installation & setup, simply run the `watch` script to start looking for T
57
57
 
58
58
  ```bash
59
59
  npm run watch
60
+
61
+ # or
62
+
63
+ yarn watch
60
64
  ```
61
65
 
62
66
  Any JavaScript ES2015 (ES6) code added will get converted down to ES5 and moved to the `src` directory. Then changes are ready to sync with the target instance using the ServiceNow Extension for VS Code.
package/bin/snts.ts CHANGED
@@ -15,10 +15,23 @@ 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
- var msg =
20
- 'No active application detected. Please create a project with the ServiceNow Extension for VS Code.\n\n' +
21
- 'https://docs.servicenow.com/bundle/quebec-application-development/page/build/applications/task/create-project.html';
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}`;
22
35
  return console.error(bold(red(msg)));
23
36
  }
24
37
 
@@ -53,10 +66,13 @@ function getProgressBar() {
53
66
  });
54
67
  }
55
68
 
69
+ function getWorkspaceConfig() {
70
+ return fs.readFileSync('./system/sn-workspace.json');
71
+ }
72
+
56
73
  function hasApplication() {
57
74
  try {
58
- const workspace = fs.readFileSync('system/sn-workspace.json');
59
- const app = JSON.parse(workspace).ACTIVE_APPLICATION;
75
+ const app = JSON.parse(getWorkspaceConfig()).ACTIVE_APPLICATION;
60
76
  return Object.entries(app).length === 0 ? getErrorMsg() : true;
61
77
  } catch (e) {
62
78
  getErrorMsg();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sn-typescript-util",
3
- "version": "1.0.13",
3
+ "version": "1.0.16",
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": "^15.12.2",
20
+ "@types/node": "^18.0.0",
21
21
  "@types/servicenow": "^10.0.1",
22
- "cli-progress": "^3.9.0",
23
- "colorette": "^1.2.2",
24
- "colors": "^1.4.0",
25
- "commander": "^7.2.0",
26
- "nodemon": "^2.0.7",
22
+ "cli-progress": "^3.11.1",
23
+ "colorette": "^2.0.19",
24
+ "colors": "1.4.0",
25
+ "commander": "^9.3.0",
26
+ "nodemon": "^2.0.18",
27
27
  "npm-add-script": "^1.1.0",
28
- "prettier": "^2.3.1",
29
- "ts-node": "^10.0.0",
30
- "typescript": "^4.3.2"
28
+ "prettier": "^2.7.1",
29
+ "ts-node": "^10.8.1",
30
+ "typescript": "^4.7.4"
31
31
  }
32
32
  }