sn-typescript-util 1.3.10 → 1.3.12

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 CHANGED
@@ -8,7 +8,7 @@ import { bold, cyan, gray, magenta, red } from 'colorette';
8
8
  import { intro, outro, spinner } from '@clack/prompts';
9
9
  async function doBuild() {
10
10
  const s = startPrompts('Installing configs', 'Build started');
11
- return await execFile(getFilePath('init.rb'), (stdout) => {
11
+ return await execFile(getFilePath('init.rb', 'scripts/build'), (stdout) => {
12
12
  stopPrompt(s, 'Configs installed');
13
13
  runSync();
14
14
  return stdout;
@@ -16,37 +16,22 @@ async function doBuild() {
16
16
  }
17
17
  async function doCompile() {
18
18
  const s = startPrompts('Processing', 'Compile started');
19
- return await execFile(getFilePath('compile.rb'), (stdout) => {
20
- stopPrompt(s, 'Completed');
21
- return stdout;
22
- });
19
+ return await execFile(
20
+ getFilePath('compile.rb', 'scripts/build'),
21
+ (stdout) => {
22
+ stopPrompt(s, 'Completed');
23
+ return stdout;
24
+ }
25
+ );
23
26
  }
24
27
  function doOptions(program, version) {
25
- program.parse(process.argv).opts();
26
- const option = Object.keys(program.opts()).toString();
27
- const optionKey = option;
28
- const options = {
29
- build: () => {
30
- doBuild();
31
- },
32
- compile: () => {
33
- doCompile();
34
- },
35
- help: () => {
36
- showHelp(program);
37
- },
38
- sync: () => {
39
- doSync();
40
- },
41
- default: () => {
42
- showHelp(program);
43
- }
44
- };
45
- return handleOptions(program, options, optionKey, version);
28
+ const options = parseOptions(program);
29
+ const optionKey = options;
30
+ return handleOptions(program, getOptions(program), optionKey, version);
46
31
  }
47
32
  async function doSync() {
48
33
  const s = startPrompts('Processing', 'Sync started');
49
- return await execFile(getFilePath('sync.sh'), (stdout) => {
34
+ return await execFile(getFilePath('sync.sh', 'scripts/build'), (stdout) => {
50
35
  stopPrompt(s, 'Completed');
51
36
  return stdout;
52
37
  });
@@ -62,11 +47,30 @@ function getErrorMsg() {
62
47
  const msg = `No active application detected. Please create a project with the ServiceNow Extension for VS Code.\n\n${url}`;
63
48
  return console.error(bold(red(msg)));
64
49
  }
65
- function getFilePath(file, dir = 'scripts') {
50
+ function getFilePath(file, dir = 'scripts/build') {
66
51
  const fileName = fileURLToPath(import.meta.url);
67
52
  const dirName = path.dirname(fileName);
68
53
  return `${path.join(dirName, `../${dir}`)}/${file}`;
69
54
  }
55
+ function getOptions(program) {
56
+ return {
57
+ build: () => {
58
+ doBuild();
59
+ },
60
+ compile: () => {
61
+ doCompile();
62
+ },
63
+ help: () => {
64
+ showHelp(program);
65
+ },
66
+ sync: () => {
67
+ doSync();
68
+ },
69
+ default: () => {
70
+ showHelp(program);
71
+ }
72
+ };
73
+ }
70
74
  async function getPackageInfo() {
71
75
  return JSON.parse(readFileSync(getFilePath('package.json', '.')).toString());
72
76
  }
@@ -123,9 +127,13 @@ async function init() {
123
127
  function introPrompt(msg) {
124
128
  return intro(msg);
125
129
  }
130
+ function parseOptions(program) {
131
+ const options = program.parse(process.argv).opts();
132
+ return options && Object.keys(program.opts()).toString();
133
+ }
126
134
  async function runSync() {
127
135
  const s = startPrompts('Syncing', null);
128
- return await execFile(getFilePath('sync.sh'), (stdout) => {
136
+ return await execFile(getFilePath('sync.sh', 'scripts/build'), (stdout) => {
129
137
  stopPrompt(s, 'Sync completed');
130
138
  outro('Completed');
131
139
  return stdout;
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.10",
3
+ "version": "1.3.12",
4
4
  "description": "A TypeScript utility for ServiceNow developers using VS Code",
5
5
  "bin": {
6
6
  "snts": "bin/snts.js"
@@ -19,7 +19,7 @@
19
19
  "scripts": {
20
20
  "format": "prettier --write ./bin/*.js ./scripts/*.ts",
21
21
  "lint": "eslint .",
22
- "release": "./scripts/release.sh",
22
+ "release": "./scripts/utils/release.sh",
23
23
  "watch": "tsc --watch"
24
24
  },
25
25
  "type": "module",
@@ -33,9 +33,9 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/commander": "^2.12.2",
36
- "@typescript-eslint/eslint-plugin": "^6.17.0",
37
- "@typescript-eslint/parser": "^6.17.0",
38
- "bun-types": "^1.0.21",
36
+ "@typescript-eslint/eslint-plugin": "^6.18.1",
37
+ "@typescript-eslint/parser": "^6.18.1",
38
+ "bun-types": "^1.0.22",
39
39
  "eslint": "^8.56.0",
40
40
  "prettier": "^3.1.1"
41
41
  }
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require_relative File.join(__dir__, 'utils')
3
+ require_relative File.join(__dir__, './../utils/utils')
4
4
 
5
5
  module ServiceNow
6
6
  class Build
package/scripts/snts.ts CHANGED
@@ -7,56 +7,47 @@ import { readFileSync } from 'fs';
7
7
  import { fileURLToPath } from 'url';
8
8
  import { bold, cyan, gray, magenta, red } from 'colorette';
9
9
  import { intro, outro, spinner } from '@clack/prompts';
10
- import { Options } from './options.js';
11
- import { Workspace } from './workspace.js';
10
+ import { Options } from './types/options.js';
11
+ import { Workspace } from './types/workspace.js';
12
12
 
13
13
  async function doBuild() {
14
14
  const s = startPrompts('Installing configs', 'Build started');
15
- return await execFile(getFilePath('init.rb'), (stdout: unknown) => {
16
- stopPrompt(s, 'Configs installed');
17
- runSync();
18
- return stdout;
19
- });
15
+ return await execFile(
16
+ getFilePath('init.rb', 'scripts/build'),
17
+ (stdout: unknown) => {
18
+ stopPrompt(s, 'Configs installed');
19
+ runSync();
20
+ return stdout;
21
+ }
22
+ );
20
23
  }
21
24
 
22
25
  async function doCompile() {
23
26
  const s = startPrompts('Processing', 'Compile started');
24
- return await execFile(getFilePath('compile.rb'), (stdout: unknown) => {
25
- stopPrompt(s, 'Completed');
26
- return stdout;
27
- });
27
+ return await execFile(
28
+ getFilePath('compile.rb', 'scripts/build'),
29
+ (stdout: unknown) => {
30
+ stopPrompt(s, 'Completed');
31
+ return stdout;
32
+ }
33
+ );
28
34
  }
29
35
 
30
36
  function doOptions(program: Command, version: string) {
31
- program.parse(process.argv).opts();
32
- const option: string = Object.keys(program.opts()).toString();
33
- const optionKey = option as keyof Options;
34
- const options: Options = {
35
- build: () => {
36
- doBuild();
37
- },
38
- compile: () => {
39
- doCompile();
40
- },
41
- help: () => {
42
- showHelp(program);
43
- },
44
- sync: () => {
45
- doSync();
46
- },
47
- default: () => {
48
- showHelp(program);
49
- }
50
- };
51
- return handleOptions(program, options, optionKey, version);
37
+ const options = parseOptions(program);
38
+ const optionKey = options as keyof Options;
39
+ return handleOptions(program, getOptions(program), optionKey, version);
52
40
  }
53
41
 
54
42
  async function doSync() {
55
43
  const s = startPrompts('Processing', 'Sync started');
56
- return await execFile(getFilePath('sync.sh'), (stdout: unknown) => {
57
- stopPrompt(s, 'Completed');
58
- return stdout;
59
- });
44
+ return await execFile(
45
+ getFilePath('sync.sh', 'scripts/build'),
46
+ (stdout: unknown) => {
47
+ stopPrompt(s, 'Completed');
48
+ return stdout;
49
+ }
50
+ );
60
51
  }
61
52
 
62
53
  function getDescription(version: string) {
@@ -72,12 +63,32 @@ function getErrorMsg() {
72
63
  return console.error(bold(red(msg)));
73
64
  }
74
65
 
75
- function getFilePath(file: string, dir: string = 'scripts') {
66
+ function getFilePath(file: string, dir: string = 'scripts/build') {
76
67
  const fileName = fileURLToPath(import.meta.url);
77
68
  const dirName = path.dirname(fileName);
78
69
  return `${path.join(dirName, `../${dir}`)}/${file}`;
79
70
  }
80
71
 
72
+ function getOptions(program: Command): Options {
73
+ return {
74
+ build: () => {
75
+ doBuild();
76
+ },
77
+ compile: () => {
78
+ doCompile();
79
+ },
80
+ help: () => {
81
+ showHelp(program);
82
+ },
83
+ sync: () => {
84
+ doSync();
85
+ },
86
+ default: () => {
87
+ showHelp(program);
88
+ }
89
+ };
90
+ }
91
+
81
92
  async function getPackageInfo() {
82
93
  return JSON.parse(readFileSync(getFilePath('package.json', '.')).toString());
83
94
  }
@@ -147,13 +158,21 @@ function introPrompt(msg: string) {
147
158
  return intro(msg);
148
159
  }
149
160
 
161
+ function parseOptions(program: Command) {
162
+ const options = program.parse(process.argv).opts();
163
+ return options && Object.keys(program.opts()).toString();
164
+ }
165
+
150
166
  async function runSync() {
151
167
  const s = startPrompts('Syncing', null);
152
- return await execFile(getFilePath('sync.sh'), (stdout: unknown) => {
153
- stopPrompt(s, 'Sync completed');
154
- outro('Completed');
155
- return stdout;
156
- });
168
+ return await execFile(
169
+ getFilePath('sync.sh', 'scripts/build'),
170
+ (stdout: unknown) => {
171
+ stopPrompt(s, 'Sync completed');
172
+ outro('Completed');
173
+ return stdout;
174
+ }
175
+ );
157
176
  }
158
177
 
159
178
  function shouldShowHelp(program: Command, option: string) {
@@ -0,0 +1,8 @@
1
+ export interface Metadata {
2
+ readonly sys_id: string;
3
+ readonly sys_scope: string;
4
+ readonly package_type: string;
5
+ readonly PROJECT_STATE: string;
6
+ readonly INSTANCE_ID: string;
7
+ readonly BUILD_NAME: string;
8
+ }
@@ -0,0 +1,8 @@
1
+ import { Metadata } from './metadata.js';
2
+
3
+ export interface Workspace {
4
+ readonly ALL_APPLICATIONS: {
5
+ [appName: string]: Metadata;
6
+ };
7
+ readonly ACTIVE_APPLICATION: string;
8
+ }
@@ -1,4 +0,0 @@
1
- export interface Workspace {
2
- readonly ACTIVE_APPLICATION: string;
3
- readonly ALL_APPLICATIONS: string;
4
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes