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 +8 -6
- package/package.json +1 -1
- package/src/snts.ts +9 -6
- package/src/workspace.ts +4 -0
- package/tsconfig.json +0 -1
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 =
|
|
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
|
|
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
|
|
84
|
-
|
|
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
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 =
|
|
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
|
|
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
|
|
94
|
-
|
|
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
|
});
|
package/src/workspace.ts
ADDED