sn-typescript-util 1.5.8 → 1.5.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/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://www.servicenow.com/docs/bundle/xanadu-application-development/page/build/applications/task/vscode-import-application.html) in VS Code
32
+ - An [imported application](https://www.servicenow.com/docs/bundle/yokohama-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
 
package/bin/snts.js CHANGED
@@ -17,7 +17,7 @@ async function addFile(sourcefile, sourceDir, targetFile, targetDir, message) {
17
17
  async function addInterfaceFile() {
18
18
  return await addFile(
19
19
  'base-table.ts',
20
- 'scripts/templates',
20
+ 'src/templates',
21
21
  'BaseTable.ts',
22
22
  'ts/Types',
23
23
  `Add a ${cyan('BaseTable.ts')} interface with global default fields?`
@@ -26,7 +26,7 @@ async function addInterfaceFile() {
26
26
  async function addPrettierFile() {
27
27
  return await addFile(
28
28
  '.prettierrc.json',
29
- 'scripts/templates',
29
+ 'src/templates',
30
30
  '.prettierrc.json',
31
31
  null,
32
32
  `Add a ${cyan('.prettierrc.json')} default config?`
@@ -54,7 +54,7 @@ async function doBuild() {
54
54
  await addPrettierFile();
55
55
  await initGitRepo();
56
56
  const s = startPrompts('Installing config(s)', null);
57
- const filePath = getFilePath('tsconfig.json', 'scripts/templates');
57
+ const filePath = getFilePath('tsconfig.json', 'src/templates');
58
58
  await createTemplate('tsconfig.json', filePath);
59
59
  const template = readFileSync('tsconfig.json', 'utf8');
60
60
  const data = template.replace(/@version/g, esVersion);
@@ -80,7 +80,7 @@ function doOptions(program) {
80
80
  }
81
81
  async function doSync() {
82
82
  const s = startPrompts('Processing', 'Sync started');
83
- return await execFile(getFilePath('sync.sh', 'scripts/build'), (stdout) => {
83
+ return await execFile(getFilePath('sync.sh', 'scripts'), (stdout) => {
84
84
  stopPrompt(s, 'Completed');
85
85
  return stdout;
86
86
  });
@@ -107,7 +107,7 @@ function getConstants() {
107
107
  Constants['errorMsg'] =
108
108
  'No active application detected. Please create a project with the ServiceNow Extension for VS Code.';
109
109
  Constants['docsUrl'] =
110
- 'https://docs.servicenow.com/bundle/washingtondc-application-development/page/build/applications/task/create-project.html';
110
+ 'https://www.servicenow.com/docs/bundle/yokohama-application-development/page/build/applications/task/create-project.html';
111
111
  Constants['buildOption'] =
112
112
  'Build project utility files & package dependencies';
113
113
  Constants['compileOption'] =
@@ -234,7 +234,7 @@ function parseOptions(program) {
234
234
  async function runSync() {
235
235
  const project = await getProject();
236
236
  const s = startPrompts('Syncing', null);
237
- return await execFile(getFilePath('sync.sh', 'scripts/build'), (stdout) => {
237
+ return await execFile(getFilePath('sync.sh', 'scripts'), (stdout) => {
238
238
  stopPrompt(
239
239
  s,
240
240
  `TypeScript files constructed in the ${cyan(project + '/ts')} directory.`
package/bun.lock CHANGED
@@ -7,7 +7,7 @@
7
7
  "@clack/prompts": "^0.10.1",
8
8
  "colorette": "^2.0.20",
9
9
  "commander": "^13.1.0",
10
- "execa": "^9.5.2",
10
+ "execa": "^9.5.3",
11
11
  "typescript": "^5.8.3",
12
12
  },
13
13
  "devDependencies": {
@@ -185,7 +185,7 @@
185
185
 
186
186
  "eventsource-parser": ["eventsource-parser@3.0.1", "", {}, "sha512-VARTJ9CYeuQYb0pZEPbzi740OWFgpHe7AYJ2WFZVnUDUQp5Dk2yJUgF36YsZ81cOyxT0QxmXD2EQpapAouzWVA=="],
187
187
 
188
- "execa": ["execa@9.5.2", "", { "dependencies": { "@sindresorhus/merge-streams": "^4.0.0", "cross-spawn": "^7.0.3", "figures": "^6.1.0", "get-stream": "^9.0.0", "human-signals": "^8.0.0", "is-plain-obj": "^4.1.0", "is-stream": "^4.0.1", "npm-run-path": "^6.0.0", "pretty-ms": "^9.0.0", "signal-exit": "^4.1.0", "strip-final-newline": "^4.0.0", "yoctocolors": "^2.0.0" } }, "sha512-EHlpxMCpHWSAh1dgS6bVeoLAXGnJNdR93aabr4QCGbzOM73o5XmRfM/e5FUqsw3aagP8S8XEWUWFAxnRBnAF0Q=="],
188
+ "execa": ["execa@9.5.3", "", { "dependencies": { "@sindresorhus/merge-streams": "^4.0.0", "cross-spawn": "^7.0.3", "figures": "^6.1.0", "get-stream": "^9.0.0", "human-signals": "^8.0.0", "is-plain-obj": "^4.1.0", "is-stream": "^4.0.1", "npm-run-path": "^6.0.0", "pretty-ms": "^9.0.0", "signal-exit": "^4.1.0", "strip-final-newline": "^4.0.0", "yoctocolors": "^2.0.0" } }, "sha512-QFNnTvU3UjgWFy8Ef9iDHvIdcgZ344ebkwYx4/KLbR+CKQA4xBaHzv+iRpp86QfMHP8faFQLh8iOc57215y4Rg=="],
189
189
 
190
190
  "express": ["express@5.1.0", "", { "dependencies": { "accepts": "^2.0.0", "body-parser": "^2.2.0", "content-disposition": "^1.0.0", "content-type": "^1.0.5", "cookie": "^0.7.1", "cookie-signature": "^1.2.1", "debug": "^4.4.0", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "etag": "^1.8.1", "finalhandler": "^2.1.0", "fresh": "^2.0.0", "http-errors": "^2.0.0", "merge-descriptors": "^2.0.0", "mime-types": "^3.0.0", "on-finished": "^2.4.1", "once": "^1.4.0", "parseurl": "^1.3.3", "proxy-addr": "^2.0.7", "qs": "^6.14.0", "range-parser": "^1.2.1", "router": "^2.2.0", "send": "^1.1.0", "serve-static": "^2.2.0", "statuses": "^2.0.1", "type-is": "^2.0.1", "vary": "^1.1.2" } }, "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA=="],
191
191
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sn-typescript-util",
3
- "version": "1.5.8",
3
+ "version": "1.5.10",
4
4
  "description": "A TypeScript utility for ServiceNow developers using VS Code",
5
5
  "bin": {
6
6
  "snts": "bin/snts.js"
@@ -17,9 +17,9 @@
17
17
  "url": "git+https://github.com/stevengregory/sn-typescript-util.git"
18
18
  },
19
19
  "scripts": {
20
- "format": "prettier --write ./bin/*.js ./scripts/*.ts",
20
+ "format": "prettier --write ./bin/*.js ./src/*.ts",
21
21
  "lint": "bun eslint .",
22
- "release": "bun ./scripts/utils/release.ts",
22
+ "release": "bun ./scripts/release.ts",
23
23
  "watch": "tsc --watch"
24
24
  },
25
25
  "type": "module",
@@ -27,7 +27,7 @@
27
27
  "@clack/prompts": "^0.10.1",
28
28
  "colorette": "^2.0.20",
29
29
  "commander": "^13.1.0",
30
- "execa": "^9.5.2",
30
+ "execa": "^9.5.3",
31
31
  "typescript": "^5.8.3"
32
32
  },
33
33
  "devDependencies": {
@@ -3,8 +3,8 @@ import path from 'path';
3
3
  import { readFileSync } from 'fs';
4
4
  import { fileURLToPath } from 'url';
5
5
  import { cancel, confirm, intro, outro, select, spinner } from '@clack/prompts';
6
- import { Version, VersionType } from './../types/version.js';
7
- import { Metadata } from './../types/metadata.js';
6
+ import type { Version, VersionType } from '../src/types/version.js';
7
+ import type { Metadata } from '../src/types/metadata.js';
8
8
 
9
9
  async function bumpVersion(releaseType: VersionType) {
10
10
  return await $`npm version ${releaseType} --no-git-tag-version`;
@@ -50,7 +50,8 @@ async function doPublish() {
50
50
  function getFilePath(file: string, dir: string): string {
51
51
  const fileName = fileURLToPath(import.meta.url);
52
52
  const dirName = path.dirname(fileName);
53
- return `${path.join(dirName, `./../../${dir}`)}/${file}`;
53
+ const projectRoot = path.join(dirName, '..');
54
+ return path.join(projectRoot, dir, file);
54
55
  }
55
56
 
56
57
  async function getPackageInfo(): Promise<Metadata & { version: string }> {
@@ -8,15 +8,15 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
8
8
  import { fileURLToPath } from 'url';
9
9
  import { bold, cyan, gray, green, magenta, red } from 'colorette';
10
10
  import { confirm, intro, outro, select, spinner } from '@clack/prompts';
11
- import { Options } from './types/options.js';
12
- import { Workspace } from './types/workspace.js';
13
- import { ConfigTarget } from './types/config.js';
11
+ import type { Options } from './types/options.js';
12
+ import type { Workspace } from './types/workspace.js';
13
+ import type { ConfigTarget } from './types/config.js';
14
14
 
15
15
  async function addFile(
16
16
  sourcefile: string,
17
17
  sourceDir: string,
18
18
  targetFile: string,
19
- targetDir: string | any,
19
+ targetDir: string | null,
20
20
  message: string
21
21
  ) {
22
22
  if (await confirmFile(message)) {
@@ -29,7 +29,7 @@ async function addFile(
29
29
  async function addInterfaceFile() {
30
30
  return await addFile(
31
31
  'base-table.ts',
32
- 'scripts/templates',
32
+ 'src/templates',
33
33
  'BaseTable.ts',
34
34
  'ts/Types',
35
35
  `Add a ${cyan('BaseTable.ts')} interface with global default fields?`
@@ -39,7 +39,7 @@ async function addInterfaceFile() {
39
39
  async function addPrettierFile() {
40
40
  return await addFile(
41
41
  '.prettierrc.json',
42
- 'scripts/templates',
42
+ 'src/templates',
43
43
  '.prettierrc.json',
44
44
  null,
45
45
  `Add a ${cyan('.prettierrc.json')} default config?`
@@ -66,15 +66,15 @@ async function createTemplate(file: string, path: string): Promise<void> {
66
66
 
67
67
  async function doBuild() {
68
68
  introPrompt(`${bold(magenta(getConstants().projectName))}: Build`);
69
- const esVersion: any = await getConfigTypes();
69
+ const esVersion = await getConfigTypes();
70
70
  await addInterfaceFile();
71
71
  await addPrettierFile();
72
72
  await initGitRepo();
73
73
  const s = startPrompts('Installing config(s)', null);
74
- const filePath = getFilePath('tsconfig.json', 'scripts/templates');
74
+ const filePath = getFilePath('tsconfig.json', 'src/templates');
75
75
  await createTemplate('tsconfig.json', filePath);
76
76
  const template = readFileSync('tsconfig.json', 'utf8');
77
- const data = template.replace(/@version/g, esVersion);
77
+ const data = template.replace(/@version/g, esVersion as string);
78
78
  await writeFile('tsconfig.json', data);
79
79
  stopPrompt(s, `The ${cyan('tsconfig.json')} file was bootstrapped.`);
80
80
  runSync();
@@ -102,7 +102,7 @@ function doOptions(program: Command) {
102
102
  async function doSync() {
103
103
  const s = startPrompts('Processing', 'Sync started');
104
104
  return await execFile(
105
- getFilePath('sync.sh', 'scripts/build'),
105
+ getFilePath('sync.sh', 'scripts'),
106
106
  (stdout: unknown) => {
107
107
  stopPrompt(s, 'Completed');
108
108
  return stdout;
@@ -130,7 +130,7 @@ function getConstants() {
130
130
  projectName = 'SN TypeScript Util',
131
131
  projectDescription = 'is a TS utility for ServiceNow developers using VS Code.',
132
132
  errorMsg = 'No active application detected. Please create a project with the ServiceNow Extension for VS Code.',
133
- docsUrl = 'https://docs.servicenow.com/bundle/washingtondc-application-development/page/build/applications/task/create-project.html',
133
+ docsUrl = 'https://www.servicenow.com/docs/bundle/yokohama-application-development/page/build/applications/task/create-project.html',
134
134
  buildOption = 'Build project utility files & package dependencies',
135
135
  compileOption = 'Compile TypeScript files to JavaScript & move to src',
136
136
  helpOption = 'Display help for command',
@@ -192,7 +192,7 @@ async function getProject(): Promise<string> {
192
192
  return workspace.ACTIVE_APPLICATION;
193
193
  }
194
194
 
195
- async function getTargetPath(file: string, dir: string) {
195
+ async function getTargetPath(file: string, dir: string | null) {
196
196
  const project = await getProject();
197
197
  const path = dir ? `${project}/${dir}/` : '.';
198
198
  if (dir && !existsSync(path)) {
@@ -277,7 +277,7 @@ async function runSync() {
277
277
  const project = await getProject();
278
278
  const s = startPrompts('Syncing', null);
279
279
  return await execFile(
280
- getFilePath('sync.sh', 'scripts/build'),
280
+ getFilePath('sync.sh', 'scripts'),
281
281
  (stdout: unknown) => {
282
282
  stopPrompt(
283
283
  s,
@@ -306,7 +306,7 @@ function startPrompts(start: string, intro: string | null) {
306
306
  return s;
307
307
  }
308
308
 
309
- function stopPrompt(spinner: any, msg: string) {
309
+ function stopPrompt(spinner: { stop: (msg: string) => void }, msg: string) {
310
310
  return spinner.stop(msg);
311
311
  }
312
312
 
@@ -1,4 +1,4 @@
1
- import { Metadata } from './metadata.js';
1
+ import type { Metadata } from './metadata.js';
2
2
 
3
3
  export interface Workspace {
4
4
  readonly ALL_APPLICATIONS: {
package/tsconfig.json CHANGED
@@ -8,7 +8,10 @@
8
8
  "skipLibCheck": true,
9
9
  "strict": true,
10
10
  "target": "ESNext",
11
- "types": ["bun-types"]
11
+ "types": ["bun-types"],
12
+ "declaration": false,
13
+ "noEmit": false
12
14
  },
13
- "include": ["scripts"]
15
+ "include": ["src/snts.ts"],
16
+ "exclude": ["scripts"]
14
17
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes