sn-typescript-util 1.2.1 → 1.2.2

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
@@ -31,7 +31,7 @@ async function doSync() {
31
31
  function getBuildName() {
32
32
  const defaultBuild = 'utah';
33
33
  try {
34
- const workspace = getWorkspaceFile();
34
+ const workspace = getWorkspace();
35
35
  const app = workspace.ACTIVE_APPLICATION;
36
36
  const build = workspace.ALL_APPLICATIONS[app].BUILD_NAME;
37
37
  return Object.entries(build).length !== 0
@@ -74,14 +74,14 @@ function getOption(program) {
74
74
  async function getPackageInfo() {
75
75
  return JSON.parse(readFileSync(getFilePath('package.json', '.')).toString());
76
76
  }
77
- function getWorkspaceFile() {
78
- return JSON.parse(readFileSync('./system/sn-workspace.json').toString())
79
- .ACTIVE_APPLICATION;
77
+ function getWorkspace() {
78
+ return JSON.parse(readFileSync('./system/sn-workspace.json').toString());
80
79
  }
81
80
  async function hasApplication() {
82
81
  try {
83
- const workspace = await getWorkspaceFile();
84
- return Object.entries(workspace).length === 0 ? getErrorMsg() : true;
82
+ const workspace = await getWorkspace();
83
+ var app = workspace.ACTIVE_APPLICATION;
84
+ return Object.entries(app).length === 0 ? getErrorMsg() : true;
85
85
  }
86
86
  catch (e) {
87
87
  getErrorMsg();
@@ -113,7 +113,9 @@ async function runInstall() {
113
113
  });
114
114
  }
115
115
  async function runSync() {
116
+ const s = startPrompts('Syncing', null);
116
117
  return await execFile(getFilePath('sync.sh'), (stdout) => {
118
+ stopPrompt(s, 'Sync completed');
117
119
  runInstall();
118
120
  return stdout;
119
121
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sn-typescript-util",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "A TypeScript utility for ServiceNow developers using VS Code",
5
5
  "bin": {
6
6
  "snts": "bin/snts.js"
package/src/snts.ts CHANGED
@@ -7,6 +7,7 @@ import { readFileSync } from 'fs';
7
7
  import { fileURLToPath } from 'url';
8
8
  import { bold, red } from 'colorette';
9
9
  import { intro, outro, spinner } from '@clack/prompts';
10
+ import { Workspace } from './workspace.js';
10
11
 
11
12
  async function doBuild() {
12
13
  const s = startPrompts('Installing configs', 'Build started');
@@ -36,7 +37,7 @@ async function doSync() {
36
37
  function getBuildName() {
37
38
  const defaultBuild: string = 'utah';
38
39
  try {
39
- const workspace = getWorkspaceFile();
40
+ const workspace: Workspace = getWorkspace();
40
41
  const app: string = workspace.ACTIVE_APPLICATION;
41
42
  const build: string = workspace.ALL_APPLICATIONS[app].BUILD_NAME;
42
43
  return Object.entries(build).length !== 0
@@ -83,15 +84,15 @@ async function getPackageInfo() {
83
84
  return JSON.parse(readFileSync(getFilePath('package.json', '.')).toString());
84
85
  }
85
86
 
86
- function getWorkspaceFile() {
87
- return JSON.parse(readFileSync('./system/sn-workspace.json').toString())
88
- .ACTIVE_APPLICATION;
87
+ function getWorkspace() {
88
+ return JSON.parse(readFileSync('./system/sn-workspace.json').toString());
89
89
  }
90
90
 
91
91
  async function hasApplication() {
92
92
  try {
93
- const workspace = await getWorkspaceFile();
94
- return Object.entries(workspace).length === 0 ? getErrorMsg() : true;
93
+ const workspace: Workspace = await getWorkspace();
94
+ var app: string = workspace.ACTIVE_APPLICATION;
95
+ return Object.entries(app).length === 0 ? getErrorMsg() : true;
95
96
  } catch (e) {
96
97
  getErrorMsg();
97
98
  return process.exit(1);
@@ -136,7 +137,9 @@ async function runInstall() {
136
137
  }
137
138
 
138
139
  async function runSync() {
140
+ const s = startPrompts('Syncing', null);
139
141
  return await execFile(getFilePath('sync.sh'), (stdout) => {
142
+ stopPrompt(s, 'Sync completed');
140
143
  runInstall();
141
144
  return stdout;
142
145
  });
@@ -0,0 +1,4 @@
1
+ export interface Workspace {
2
+ readonly ACTIVE_APPLICATION: string;
3
+ readonly ALL_APPLICATIONS: string;
4
+ }
package/tsconfig.json CHANGED
@@ -5,7 +5,6 @@
5
5
  "esModuleInterop": true,
6
6
  "outDir": "bin",
7
7
  "resolveJsonModule": true,
8
- "rootDir": "src",
9
8
  "skipLibCheck": true
10
9
  },
11
10
  "include": ["src"]