sn-typescript-util 1.3.9 → 1.3.10
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 +6 -6
- package/package.json +1 -1
- package/scripts/snts.ts +6 -6
- package/scripts/sync.sh +2 -2
package/bin/snts.js
CHANGED
|
@@ -33,13 +33,13 @@ function doOptions(program, version) {
|
|
|
33
33
|
doCompile();
|
|
34
34
|
},
|
|
35
35
|
help: () => {
|
|
36
|
-
program
|
|
36
|
+
showHelp(program);
|
|
37
37
|
},
|
|
38
38
|
sync: () => {
|
|
39
39
|
doSync();
|
|
40
40
|
},
|
|
41
41
|
default: () => {
|
|
42
|
-
program
|
|
42
|
+
showHelp(program);
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
return handleOptions(program, options, optionKey, version);
|
|
@@ -55,7 +55,7 @@ function getDescription(version) {
|
|
|
55
55
|
const title = 'SN TypeScript Util';
|
|
56
56
|
const description =
|
|
57
57
|
'is a TS utility for ServiceNow developers using VS Code.';
|
|
58
|
-
return `${bold(magenta(title))} ${description} ${gray(`(${version})`)}\n`;
|
|
58
|
+
return `${bold(magenta(title))} ${description} ${gray(`(v${version})`)}\n`;
|
|
59
59
|
}
|
|
60
60
|
function getErrorMsg() {
|
|
61
61
|
const url = `https://docs.servicenow.com/bundle/vancouver-application-development/page/build/applications/task/create-project.html`;
|
|
@@ -80,7 +80,7 @@ function handleError() {
|
|
|
80
80
|
function handleOptions(program, options, option, version) {
|
|
81
81
|
if (option === 'help' || !option) {
|
|
82
82
|
console.log(getDescription(version));
|
|
83
|
-
program
|
|
83
|
+
showHelp(program);
|
|
84
84
|
}
|
|
85
85
|
return (
|
|
86
86
|
shouldShowHelp(program, option) ||
|
|
@@ -103,7 +103,6 @@ async function init() {
|
|
|
103
103
|
const program = new Command();
|
|
104
104
|
const info = await getPackageInfo();
|
|
105
105
|
const version = info.version;
|
|
106
|
-
program.version(version, '-v, --version', 'output the current version');
|
|
107
106
|
program.option(
|
|
108
107
|
'-b, --build',
|
|
109
108
|
'build project utility files & package dependencies'
|
|
@@ -112,11 +111,12 @@ async function init() {
|
|
|
112
111
|
'-c, --compile',
|
|
113
112
|
'compile TypeScript files to JavaScript & move to src'
|
|
114
113
|
);
|
|
114
|
+
program.option('-h, --help', 'display help for command');
|
|
115
115
|
program.option(
|
|
116
116
|
'-s, --sync',
|
|
117
117
|
'sync new instance-based src files to the ts directory'
|
|
118
118
|
);
|
|
119
|
-
program.
|
|
119
|
+
program.version(version, '-v, --version', 'output the current version');
|
|
120
120
|
program.usage(cyan('[options]'));
|
|
121
121
|
return doOptions(program, version);
|
|
122
122
|
}
|
package/package.json
CHANGED
package/scripts/snts.ts
CHANGED
|
@@ -39,13 +39,13 @@ function doOptions(program: Command, version: string) {
|
|
|
39
39
|
doCompile();
|
|
40
40
|
},
|
|
41
41
|
help: () => {
|
|
42
|
-
program
|
|
42
|
+
showHelp(program);
|
|
43
43
|
},
|
|
44
44
|
sync: () => {
|
|
45
45
|
doSync();
|
|
46
46
|
},
|
|
47
47
|
default: () => {
|
|
48
|
-
program
|
|
48
|
+
showHelp(program);
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
return handleOptions(program, options, optionKey, version);
|
|
@@ -63,7 +63,7 @@ function getDescription(version: string) {
|
|
|
63
63
|
const title = 'SN TypeScript Util';
|
|
64
64
|
const description =
|
|
65
65
|
'is a TS utility for ServiceNow developers using VS Code.';
|
|
66
|
-
return `${bold(magenta(title))} ${description} ${gray(`(${version})`)}\n`;
|
|
66
|
+
return `${bold(magenta(title))} ${description} ${gray(`(v${version})`)}\n`;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
function getErrorMsg() {
|
|
@@ -99,7 +99,7 @@ function handleOptions(
|
|
|
99
99
|
) {
|
|
100
100
|
if (option === 'help' || !option) {
|
|
101
101
|
console.log(getDescription(version));
|
|
102
|
-
program
|
|
102
|
+
showHelp(program);
|
|
103
103
|
}
|
|
104
104
|
return (
|
|
105
105
|
shouldShowHelp(program, option) ||
|
|
@@ -125,7 +125,6 @@ async function init() {
|
|
|
125
125
|
const program = new Command();
|
|
126
126
|
const info = await getPackageInfo();
|
|
127
127
|
const version = info.version;
|
|
128
|
-
program.version(version, '-v, --version', 'output the current version');
|
|
129
128
|
program.option(
|
|
130
129
|
'-b, --build',
|
|
131
130
|
'build project utility files & package dependencies'
|
|
@@ -134,11 +133,12 @@ async function init() {
|
|
|
134
133
|
'-c, --compile',
|
|
135
134
|
'compile TypeScript files to JavaScript & move to src'
|
|
136
135
|
);
|
|
136
|
+
program.option('-h, --help', 'display help for command');
|
|
137
137
|
program.option(
|
|
138
138
|
'-s, --sync',
|
|
139
139
|
'sync new instance-based src files to the ts directory'
|
|
140
140
|
);
|
|
141
|
-
program.
|
|
141
|
+
program.version(version, '-v, --version', 'output the current version');
|
|
142
142
|
program.usage(cyan('[options]'));
|
|
143
143
|
return doOptions(program, version);
|
|
144
144
|
}
|
package/scripts/sync.sh
CHANGED
|
@@ -15,14 +15,14 @@ get_project_name() {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
sync() {
|
|
18
|
-
|
|
18
|
+
types_dir="Types"
|
|
19
19
|
src_path="$(get_project_name system/sn-workspace.json ACTIVE_APPLICATION)/src"
|
|
20
20
|
ts_path="$(get_project_name system/sn-workspace.json ACTIVE_APPLICATION)/ts"
|
|
21
21
|
clean_build "$build_dir"
|
|
22
22
|
if [ -d "$ts_path" ]; then
|
|
23
23
|
find "$ts_path" -name "*.ts" -exec sh -c 'mv "$0" "${0%.ts}.js"' {} \;
|
|
24
24
|
fi
|
|
25
|
-
rsync --ignore-existing --delete-after -raz --progress --prune-empty-dirs --include "*/" --include "*.js" --exclude="*" "$
|
|
25
|
+
rsync --ignore-existing --delete-after -raz --progress --prune-empty-dirs --include "*/" --include "*.js" --exclude="*" "$types_dir" "$src_path/" "$ts_path"
|
|
26
26
|
find "$ts_path" -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;
|
|
27
27
|
}
|
|
28
28
|
|