sn-typescript-util 1.0.13 → 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/bin/snts.ts +21 -5
- package/package.json +1 -1
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
|
|
20
|
-
|
|
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
|
|
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();
|