sn-typescript-util 1.3.12 → 1.3.13
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.js +32 -19
- package/bun.lockb +0 -0
- package/package.json +5 -5
- package/scripts/snts.ts +26 -19
package/bin/snts.js
CHANGED
|
@@ -36,15 +36,36 @@ async function doSync() {
|
|
|
36
36
|
return stdout;
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
+
function getConstants() {
|
|
40
|
+
let Constants;
|
|
41
|
+
(function (Constants) {
|
|
42
|
+
Constants['projectName'] = 'SN TypeScript Util';
|
|
43
|
+
Constants['projectDescription'] =
|
|
44
|
+
'is a TS utility for ServiceNow developers using VS Code.';
|
|
45
|
+
Constants['errorMsg'] =
|
|
46
|
+
'No active application detected. Please create a project with the ServiceNow Extension for VS Code.';
|
|
47
|
+
Constants['docsUrl'] =
|
|
48
|
+
'https://docs.servicenow.com/bundle/vancouver-application-development/page/build/applications/task/create-project.html';
|
|
49
|
+
Constants['buildOption'] =
|
|
50
|
+
'Build project utility files & package dependencies';
|
|
51
|
+
Constants['compileOption'] =
|
|
52
|
+
'Compile TypeScript files to JavaScript & move to src';
|
|
53
|
+
Constants['helpOption'] = 'Display help for command';
|
|
54
|
+
Constants['syncOption'] =
|
|
55
|
+
'Sync new instance-based src files to the ts directory';
|
|
56
|
+
Constants['versionOption'] = 'Output the current version';
|
|
57
|
+
})(Constants || (Constants = {}));
|
|
58
|
+
return Constants;
|
|
59
|
+
}
|
|
39
60
|
function getDescription(version) {
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
61
|
+
const constants = getConstants();
|
|
62
|
+
const title = constants.projectName;
|
|
63
|
+
const description = constants.projectDescription;
|
|
43
64
|
return `${bold(magenta(title))} ${description} ${gray(`(v${version})`)}\n`;
|
|
44
65
|
}
|
|
45
66
|
function getErrorMsg() {
|
|
46
|
-
const
|
|
47
|
-
const msg =
|
|
67
|
+
const constants = getConstants();
|
|
68
|
+
const msg = `${constants.errorMsg}\n\n${constants.docsUrl}`;
|
|
48
69
|
return console.error(bold(red(msg)));
|
|
49
70
|
}
|
|
50
71
|
function getFilePath(file, dir = 'scripts/build') {
|
|
@@ -106,21 +127,13 @@ async function hasApplication() {
|
|
|
106
127
|
async function init() {
|
|
107
128
|
const program = new Command();
|
|
108
129
|
const info = await getPackageInfo();
|
|
130
|
+
const constants = getConstants();
|
|
109
131
|
const version = info.version;
|
|
110
|
-
program.option(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
);
|
|
114
|
-
program.
|
|
115
|
-
'-c, --compile',
|
|
116
|
-
'compile TypeScript files to JavaScript & move to src'
|
|
117
|
-
);
|
|
118
|
-
program.option('-h, --help', 'display help for command');
|
|
119
|
-
program.option(
|
|
120
|
-
'-s, --sync',
|
|
121
|
-
'sync new instance-based src files to the ts directory'
|
|
122
|
-
);
|
|
123
|
-
program.version(version, '-v, --version', 'output the current version');
|
|
132
|
+
program.option('-b, --build', constants.buildOption);
|
|
133
|
+
program.option('-c, --compile', constants.compileOption);
|
|
134
|
+
program.option('-h, --help', constants.helpOption);
|
|
135
|
+
program.option('-s, --sync', constants.syncOption);
|
|
136
|
+
program.version(version, '-v, --version', constants.versionOption);
|
|
124
137
|
program.usage(cyan('[options]'));
|
|
125
138
|
return doOptions(program, version);
|
|
126
139
|
}
|
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.3.
|
|
3
|
+
"version": "1.3.13",
|
|
4
4
|
"description": "A TypeScript utility for ServiceNow developers using VS Code",
|
|
5
5
|
"bin": {
|
|
6
6
|
"snts": "bin/snts.js"
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/commander": "^2.12.2",
|
|
36
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
37
|
-
"@typescript-eslint/parser": "^6.
|
|
38
|
-
"bun-types": "^1.0.
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "^6.19.0",
|
|
37
|
+
"@typescript-eslint/parser": "^6.19.0",
|
|
38
|
+
"bun-types": "^1.0.23",
|
|
39
39
|
"eslint": "^8.56.0",
|
|
40
|
-
"prettier": "^3.
|
|
40
|
+
"prettier": "^3.2.2"
|
|
41
41
|
}
|
|
42
42
|
}
|
package/scripts/snts.ts
CHANGED
|
@@ -50,16 +50,31 @@ async function doSync() {
|
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
function getConstants() {
|
|
54
|
+
enum Constants {
|
|
55
|
+
projectName = 'SN TypeScript Util',
|
|
56
|
+
projectDescription = 'is a TS utility for ServiceNow developers using VS Code.',
|
|
57
|
+
errorMsg = 'No active application detected. Please create a project with the ServiceNow Extension for VS Code.',
|
|
58
|
+
docsUrl = 'https://docs.servicenow.com/bundle/vancouver-application-development/page/build/applications/task/create-project.html',
|
|
59
|
+
buildOption = 'Build project utility files & package dependencies',
|
|
60
|
+
compileOption = 'Compile TypeScript files to JavaScript & move to src',
|
|
61
|
+
helpOption = 'Display help for command',
|
|
62
|
+
syncOption = 'Sync new instance-based src files to the ts directory',
|
|
63
|
+
versionOption = 'Output the current version'
|
|
64
|
+
}
|
|
65
|
+
return Constants;
|
|
66
|
+
}
|
|
67
|
+
|
|
53
68
|
function getDescription(version: string) {
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
|
|
69
|
+
const constants = getConstants();
|
|
70
|
+
const title: string = constants.projectName;
|
|
71
|
+
const description: string = constants.projectDescription;
|
|
57
72
|
return `${bold(magenta(title))} ${description} ${gray(`(v${version})`)}\n`;
|
|
58
73
|
}
|
|
59
74
|
|
|
60
75
|
function getErrorMsg() {
|
|
61
|
-
const
|
|
62
|
-
const msg: string =
|
|
76
|
+
const constants = getConstants();
|
|
77
|
+
const msg: string = `${constants.errorMsg}\n\n${constants.docsUrl}`;
|
|
63
78
|
return console.error(bold(red(msg)));
|
|
64
79
|
}
|
|
65
80
|
|
|
@@ -135,21 +150,13 @@ async function hasApplication() {
|
|
|
135
150
|
async function init() {
|
|
136
151
|
const program = new Command();
|
|
137
152
|
const info = await getPackageInfo();
|
|
153
|
+
const constants = getConstants();
|
|
138
154
|
const version = info.version;
|
|
139
|
-
program.option(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
);
|
|
143
|
-
program.
|
|
144
|
-
'-c, --compile',
|
|
145
|
-
'compile TypeScript files to JavaScript & move to src'
|
|
146
|
-
);
|
|
147
|
-
program.option('-h, --help', 'display help for command');
|
|
148
|
-
program.option(
|
|
149
|
-
'-s, --sync',
|
|
150
|
-
'sync new instance-based src files to the ts directory'
|
|
151
|
-
);
|
|
152
|
-
program.version(version, '-v, --version', 'output the current version');
|
|
155
|
+
program.option('-b, --build', constants.buildOption);
|
|
156
|
+
program.option('-c, --compile', constants.compileOption);
|
|
157
|
+
program.option('-h, --help', constants.helpOption);
|
|
158
|
+
program.option('-s, --sync', constants.syncOption);
|
|
159
|
+
program.version(version, '-v, --version', constants.versionOption);
|
|
153
160
|
program.usage(cyan('[options]'));
|
|
154
161
|
return doOptions(program, version);
|
|
155
162
|
}
|