sn-typescript-util 1.5.4 → 1.5.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sn-typescript-util",
3
- "version": "1.5.4",
3
+ "version": "1.5.5",
4
4
  "description": "A TypeScript utility for ServiceNow developers using VS Code",
5
5
  "bin": {
6
6
  "snts": "bin/snts.js"
@@ -1,4 +1,4 @@
1
- type VersionType = 'patch' | 'minor' | 'major';
1
+ export type VersionType = 'patch' | 'minor' | 'major';
2
2
 
3
3
  export interface Version {
4
4
  value: VersionType;
@@ -3,15 +3,16 @@ 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 } from './../types/version.js';
6
+ import { Version, VersionType } from './../types/version.js';
7
7
 
8
- async function bumpVersion(releaseType) {
8
+ async function bumpVersion(releaseType: VersionType) {
9
9
  return await $`npm version ${releaseType} --no-git-tag-version`;
10
10
  }
11
11
 
12
12
  async function cancelOperation() {
13
13
  cancel('Operation cancelled.');
14
14
  await $`git checkout package.json`;
15
+ process.exit(1);
15
16
  }
16
17
 
17
18
  async function confirmVersion(version: string) {
@@ -55,11 +56,15 @@ async function getPackageInfo() {
55
56
  return JSON.parse(readFileSync(getFilePath('package.json', '.')).toString());
56
57
  }
57
58
 
58
- async function getReleaseTypes() {
59
- return select({
59
+ async function getReleaseTypes(): Promise<VersionType> {
60
+ const result = await select({
60
61
  message: 'Please pick a release type.',
61
62
  options: getOptions()
62
63
  });
64
+ if (typeof result === 'symbol') {
65
+ await cancelOperation();
66
+ }
67
+ return result as VersionType;
63
68
  }
64
69
 
65
70
  function getOptions(): Version[] {