sn-typescript-util 1.0.11 → 1.0.15
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/.prettierignore +4 -0
- package/README.md +20 -0
- package/bin/snts.ts +22 -10
- package/package.json +9 -9
- package/scripts/build.rb +1 -1
- package/templates/tsconfig.json +4 -3
package/.prettierignore
ADDED
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
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.
|
|
3
|
+
"version": "1.0.15",
|
|
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": "^
|
|
20
|
+
"@types/node": "^16.11.11",
|
|
21
21
|
"@types/servicenow": "^10.0.1",
|
|
22
|
-
"cli-progress": "^3.9.
|
|
23
|
-
"colorette": "^
|
|
22
|
+
"cli-progress": "^3.9.1",
|
|
23
|
+
"colorette": "^2.0.16",
|
|
24
24
|
"colors": "^1.4.0",
|
|
25
|
-
"commander": "^
|
|
26
|
-
"nodemon": "^2.0.
|
|
25
|
+
"commander": "^8.3.0",
|
|
26
|
+
"nodemon": "^2.0.15",
|
|
27
27
|
"npm-add-script": "^1.1.0",
|
|
28
|
-
"prettier": "^2.
|
|
29
|
-
"ts-node": "^
|
|
30
|
-
"typescript": "^4.
|
|
28
|
+
"prettier": "^2.5.0",
|
|
29
|
+
"ts-node": "^10.4.0",
|
|
30
|
+
"typescript": "^4.5.2"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/scripts/build.rb
CHANGED
|
@@ -64,7 +64,7 @@ module ServiceNow
|
|
|
64
64
|
|
|
65
65
|
def transpile
|
|
66
66
|
%x( tsc )
|
|
67
|
-
%x( prettier --
|
|
67
|
+
%x( prettier --write "#{@out_dir}/**/*.js" )
|
|
68
68
|
%x( rsync -av --progress -a --exclude="Interfaces" "#{@out_dir}/" "#{@app}/src" )
|
|
69
69
|
end
|
|
70
70
|
end
|
package/templates/tsconfig.json
CHANGED
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
"outDir": "dist",
|
|
5
5
|
"baseUrl": ".",
|
|
6
6
|
"paths": {
|
|
7
|
-
"*": ["./lib/dts
|
|
7
|
+
"*": ["./lib/dts/*.d.ts"]
|
|
8
8
|
}
|
|
9
9
|
},
|
|
10
10
|
"include": [
|
|
11
11
|
"./@project/ts/**/*",
|
|
12
|
-
"./lib/dts
|
|
12
|
+
"./lib/dts/*.d.ts",
|
|
13
13
|
"./@project/ts/Interfaces/*.ts"
|
|
14
|
-
]
|
|
14
|
+
],
|
|
15
|
+
"exclude": ["node_modules"]
|
|
15
16
|
}
|