sn-typescript-util 1.5.0 → 1.5.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.
- package/README.md +3 -3
- package/bin/snts.js +7 -10
- package/bun.lockb +0 -0
- package/package.json +4 -4
- package/scripts/snts.ts +8 -4
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ Using TypeScript, the CLI provides an enhanced developer workflow.
|
|
|
29
29
|
|
|
30
30
|
- [Node.js](https://nodejs.org/)
|
|
31
31
|
- [ServiceNow Extension for VS Code](https://marketplace.visualstudio.com/items?itemName=ServiceNow.now-vscode)
|
|
32
|
-
- An [imported application](https://docs.servicenow.com/bundle/
|
|
32
|
+
- An [imported application](https://docs.servicenow.com/bundle/washingtondc-application-development/page/build/applications/task/vscode-import-application.html) in VS Code
|
|
33
33
|
|
|
34
34
|
**[Back to top](#table-of-contents)**
|
|
35
35
|
|
|
@@ -44,7 +44,7 @@ npm install -g sn-typescript-util
|
|
|
44
44
|
Build the TypeScript and configuration files. This only needs to be done once for an application.
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
|
-
snts
|
|
47
|
+
snts -b
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
In the application directory created by the ServiceNow Extension for VS Code, the build creates a `ts` directory from the JavaScript files in the `src` directory. This is where all the TypeScript code resides and where the workflow begins.
|
|
@@ -59,7 +59,7 @@ After installation & setup, simply run the TypeScript compiler `--watch` command
|
|
|
59
59
|
tsc --watch
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
The TypeScript will get transpiled and moved to the `src` directory. Then changes are ready to sync with the target instance using the ServiceNow Extension for VS Code.
|
|
63
63
|
|
|
64
64
|
**[Back to top](#table-of-contents)**
|
|
65
65
|
|
package/bin/snts.js
CHANGED
|
@@ -20,7 +20,7 @@ async function addInterfaceFile() {
|
|
|
20
20
|
'scripts/templates',
|
|
21
21
|
'BaseTable.ts',
|
|
22
22
|
'ts/Types',
|
|
23
|
-
|
|
23
|
+
`Add a ${cyan('BaseTable.ts')} interface with global default fields?`
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
26
|
async function addPrettierFile() {
|
|
@@ -29,7 +29,7 @@ async function addPrettierFile() {
|
|
|
29
29
|
'scripts/templates',
|
|
30
30
|
'.prettierrc.json',
|
|
31
31
|
null,
|
|
32
|
-
|
|
32
|
+
`Add a ${cyan('.prettierrc.json')} default config?`
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
35
|
async function confirmFile(msg) {
|
|
@@ -52,6 +52,7 @@ async function doBuild() {
|
|
|
52
52
|
const esVersion = await getConfigTypes();
|
|
53
53
|
await addInterfaceFile();
|
|
54
54
|
await addPrettierFile();
|
|
55
|
+
await initGitRepo();
|
|
55
56
|
const s = startPrompts('Installing config(s)', null);
|
|
56
57
|
const filePath = getFilePath('tsconfig.json', 'scripts/templates');
|
|
57
58
|
await createTemplate('tsconfig.json', filePath);
|
|
@@ -103,14 +104,6 @@ function getConstants() {
|
|
|
103
104
|
Constants['projectName'] = 'SN TypeScript Util';
|
|
104
105
|
Constants['projectDescription'] =
|
|
105
106
|
'is a TS utility for ServiceNow developers using VS Code.';
|
|
106
|
-
Constants[
|
|
107
|
-
(Constants['confirmInterfaceMsg'] =
|
|
108
|
-
`Add a ${cyan('BaseTable.ts')} interface with global default fields?`)
|
|
109
|
-
] = 'confirmInterfaceMsg';
|
|
110
|
-
Constants[
|
|
111
|
-
(Constants['confirmPrettierMsg'] =
|
|
112
|
-
`Add a ${cyan('.prettierrc.json')} default config?`)
|
|
113
|
-
] = 'confirmPrettierMsg';
|
|
114
107
|
Constants['errorMsg'] =
|
|
115
108
|
'No active application detected. Please create a project with the ServiceNow Extension for VS Code.';
|
|
116
109
|
Constants['docsUrl'] =
|
|
@@ -225,6 +218,10 @@ async function init() {
|
|
|
225
218
|
program.usage(cyan('[options]'));
|
|
226
219
|
return doOptions(program);
|
|
227
220
|
}
|
|
221
|
+
async function initGitRepo() {
|
|
222
|
+
const msg = `Initialize a new git repository?`;
|
|
223
|
+
return (await confirmFile(msg)) && (await $`git init`);
|
|
224
|
+
}
|
|
228
225
|
function introPrompt(msg) {
|
|
229
226
|
return intro(msg);
|
|
230
227
|
}
|
package/bun.lockb
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sn-typescript-util",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "A TypeScript utility for ServiceNow developers using VS Code",
|
|
5
5
|
"bin": {
|
|
6
6
|
"snts": "bin/snts.js"
|
|
@@ -26,16 +26,16 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@clack/prompts": "^0.7.0",
|
|
28
28
|
"colorette": "^2.0.20",
|
|
29
|
-
"commander": "^12.
|
|
29
|
+
"commander": "^12.1.0",
|
|
30
30
|
"execa": "^9.1.0",
|
|
31
31
|
"typescript": "^5.4.5"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@eslint/js": "^9.3.0",
|
|
35
35
|
"@types/commander": "^2.12.2",
|
|
36
|
-
"bun-types": "^1.1.
|
|
36
|
+
"bun-types": "^1.1.9",
|
|
37
37
|
"eslint": "^9.3.0",
|
|
38
38
|
"prettier": "^3.2.5",
|
|
39
|
-
"typescript-eslint": "^7.
|
|
39
|
+
"typescript-eslint": "^7.10.0"
|
|
40
40
|
}
|
|
41
41
|
}
|
package/scripts/snts.ts
CHANGED
|
@@ -31,7 +31,7 @@ async function addInterfaceFile() {
|
|
|
31
31
|
'scripts/templates',
|
|
32
32
|
'BaseTable.ts',
|
|
33
33
|
'ts/Types',
|
|
34
|
-
|
|
34
|
+
`Add a ${cyan('BaseTable.ts')} interface with global default fields?`
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -41,7 +41,7 @@ async function addPrettierFile() {
|
|
|
41
41
|
'scripts/templates',
|
|
42
42
|
'.prettierrc.json',
|
|
43
43
|
null,
|
|
44
|
-
|
|
44
|
+
`Add a ${cyan('.prettierrc.json')} default config?`
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -68,6 +68,7 @@ async function doBuild() {
|
|
|
68
68
|
const esVersion: any = await getConfigTypes();
|
|
69
69
|
await addInterfaceFile();
|
|
70
70
|
await addPrettierFile();
|
|
71
|
+
await initGitRepo();
|
|
71
72
|
const s = startPrompts('Installing config(s)', null);
|
|
72
73
|
const filePath = getFilePath('tsconfig.json', 'scripts/templates');
|
|
73
74
|
await createTemplate('tsconfig.json', filePath);
|
|
@@ -127,8 +128,6 @@ function getConstants() {
|
|
|
127
128
|
enum Constants {
|
|
128
129
|
projectName = 'SN TypeScript Util',
|
|
129
130
|
projectDescription = 'is a TS utility for ServiceNow developers using VS Code.',
|
|
130
|
-
confirmInterfaceMsg = `Add a ${cyan('BaseTable.ts')} interface with global default fields?`,
|
|
131
|
-
confirmPrettierMsg = `Add a ${cyan('.prettierrc.json')} default config?`,
|
|
132
131
|
errorMsg = 'No active application detected. Please create a project with the ServiceNow Extension for VS Code.',
|
|
133
132
|
docsUrl = 'https://docs.servicenow.com/bundle/washingtondc-application-development/page/build/applications/task/create-project.html',
|
|
134
133
|
buildOption = 'Build project utility files & package dependencies',
|
|
@@ -257,6 +256,11 @@ async function init() {
|
|
|
257
256
|
return doOptions(program);
|
|
258
257
|
}
|
|
259
258
|
|
|
259
|
+
async function initGitRepo() {
|
|
260
|
+
const msg = `Initialize a new git repository?`;
|
|
261
|
+
return (await confirmFile(msg)) && (await $`git init`);
|
|
262
|
+
}
|
|
263
|
+
|
|
260
264
|
function introPrompt(msg: string) {
|
|
261
265
|
return intro(msg);
|
|
262
266
|
}
|