sn-typescript-util 1.5.6 → 1.5.7
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 +1 -1
- package/scripts/utils/release.ts +15 -7
package/package.json
CHANGED
package/scripts/utils/release.ts
CHANGED
|
@@ -12,7 +12,7 @@ async function bumpVersion(releaseType: VersionType) {
|
|
|
12
12
|
async function cancelOperation() {
|
|
13
13
|
cancel('Operation cancelled.');
|
|
14
14
|
await $`git checkout package.json`;
|
|
15
|
-
process.exit(
|
|
15
|
+
process.exit(0);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
async function confirmVersion(version: string) {
|
|
@@ -30,7 +30,7 @@ async function doGitOperation(version: string) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
async function doOperation(shouldContinue: boolean | symbol, version: string) {
|
|
33
|
-
if (shouldContinue) {
|
|
33
|
+
if (shouldContinue && isNotSymbol(shouldContinue)) {
|
|
34
34
|
const s = spinner();
|
|
35
35
|
s.start('Start release');
|
|
36
36
|
await doGitOperation(version);
|
|
@@ -56,12 +56,11 @@ async function getPackageInfo() {
|
|
|
56
56
|
return JSON.parse(readFileSync(getFilePath('package.json', '.')).toString());
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
async function getReleaseTypes()
|
|
60
|
-
|
|
59
|
+
async function getReleaseTypes() {
|
|
60
|
+
return select({
|
|
61
61
|
message: 'Please pick a release type.',
|
|
62
62
|
options: getOptions()
|
|
63
63
|
});
|
|
64
|
-
return result as VersionType;
|
|
65
64
|
}
|
|
66
65
|
|
|
67
66
|
function getOptions(): Version[] {
|
|
@@ -77,11 +76,20 @@ async function getVersion() {
|
|
|
77
76
|
return `v${file.version}`;
|
|
78
77
|
}
|
|
79
78
|
|
|
79
|
+
function isNotSymbol(value: unknown): value is boolean {
|
|
80
|
+
return typeof value !== 'symbol';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function isVersionType(value: unknown): value is VersionType {
|
|
84
|
+
return value === 'patch' || value === 'minor' || value === 'major';
|
|
85
|
+
}
|
|
86
|
+
|
|
80
87
|
(async function init() {
|
|
81
88
|
intro('Release Utils');
|
|
82
89
|
const releaseType = await getReleaseTypes();
|
|
83
|
-
if (
|
|
84
|
-
|
|
90
|
+
if (!isVersionType(releaseType)) {
|
|
91
|
+
cancelOperation();
|
|
92
|
+
return;
|
|
85
93
|
}
|
|
86
94
|
const version = (await bumpVersion(releaseType)) && (await getVersion());
|
|
87
95
|
const shouldContinue = await confirmVersion(version);
|