@git.zone/cli 8.1.0 → 8.2.1
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/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/helpers.prompts.d.ts +23 -0
- package/dist_ts/helpers.prompts.js +30 -0
- package/dist_ts/mod_commit/index.js +30 -41
- package/dist_ts/mod_commit/mod.plugins.d.ts +1 -2
- package/dist_ts/mod_commit/mod.plugins.js +2 -3
- package/dist_ts/mod_config/index.js +45 -61
- package/dist_ts/mod_deprecate/helpers.deprecation.d.ts +14 -4
- package/dist_ts/mod_deprecate/helpers.deprecation.js +34 -15
- package/dist_ts/mod_deprecate/index.js +38 -18
- package/dist_ts/mod_deprecate/mod.plugins.d.ts +1 -2
- package/dist_ts/mod_deprecate/mod.plugins.js +2 -3
- package/dist_ts/mod_docker/index.js +4 -4
- package/dist_ts/mod_format/formatters/smartconfig.formatter.js +10 -16
- package/dist_ts/mod_format/index.js +6 -6
- package/dist_ts/mod_format/mod.plugins.d.ts +1 -2
- package/dist_ts/mod_format/mod.plugins.js +2 -3
- package/dist_ts/mod_meta/meta.classes.meta.js +5 -4
- package/dist_ts/mod_meta/meta.plugins.d.ts +1 -2
- package/dist_ts/mod_meta/meta.plugins.js +2 -3
- package/dist_ts/mod_release/index.js +5 -4
- package/dist_ts/mod_services/classes.servicemanager.js +9 -13
- package/dist_ts/mod_services/index.js +10 -17
- package/dist_ts/mod_services/mod.plugins.d.ts +1 -2
- package/dist_ts/mod_services/mod.plugins.js +2 -3
- package/dist_ts/mod_standard/index.js +3 -4
- package/dist_ts/mod_template/index.js +5 -6
- package/dist_ts/mod_template/mod.plugins.d.ts +1 -2
- package/dist_ts/mod_template/mod.plugins.js +2 -3
- package/dist_ts/mod_tools/index.js +5 -10
- package/dist_ts/plugins.d.ts +2 -3
- package/dist_ts/plugins.js +3 -4
- package/package.json +3 -4
- package/readme.md +10 -2
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/helpers.prompts.ts +70 -0
- package/ts/mod_commit/index.ts +37 -48
- package/ts/mod_commit/mod.plugins.ts +1 -2
- package/ts/mod_config/index.ts +44 -63
- package/ts/mod_deprecate/helpers.deprecation.ts +54 -22
- package/ts/mod_deprecate/index.ts +43 -17
- package/ts/mod_deprecate/mod.plugins.ts +1 -2
- package/ts/mod_docker/index.ts +3 -3
- package/ts/mod_format/formatters/smartconfig.formatter.ts +15 -22
- package/ts/mod_format/index.ts +9 -5
- package/ts/mod_format/mod.plugins.ts +0 -2
- package/ts/mod_meta/meta.classes.meta.ts +7 -3
- package/ts/mod_meta/meta.plugins.ts +1 -2
- package/ts/mod_release/index.ts +4 -3
- package/ts/mod_services/classes.servicemanager.ts +8 -14
- package/ts/mod_services/index.ts +17 -24
- package/ts/mod_services/mod.plugins.ts +1 -2
- package/ts/mod_standard/index.ts +2 -4
- package/ts/mod_template/index.ts +4 -5
- package/ts/mod_template/mod.plugins.ts +1 -2
- package/ts/mod_tools/index.ts +4 -10
- package/ts/plugins.ts +2 -4
|
@@ -3,6 +3,10 @@ import type { IPlannedChange } from "../interfaces.format.js";
|
|
|
3
3
|
import * as plugins from "../mod.plugins.js";
|
|
4
4
|
import { logger, logVerbose } from "../../gitzone.logging.js";
|
|
5
5
|
import { migrateSmartconfigData } from "../../helpers.smartconfigmigrations.js";
|
|
6
|
+
import {
|
|
7
|
+
answerDefaultsWithoutTerminal,
|
|
8
|
+
withPrompts,
|
|
9
|
+
} from "../../helpers.prompts.js";
|
|
6
10
|
|
|
7
11
|
const CONFIG_FILE = ".smartconfig.json";
|
|
8
12
|
|
|
@@ -68,7 +72,6 @@ export class SmartconfigFormatter extends BaseFormatter {
|
|
|
68
72
|
"module.license",
|
|
69
73
|
];
|
|
70
74
|
|
|
71
|
-
const interactInstance = new plugins.smartinteract.SmartInteract();
|
|
72
75
|
const missingRepoInformation = expectedRepoInformation.filter(
|
|
73
76
|
(expectedRepoInformationItem) => {
|
|
74
77
|
return !plugins.smartobject.smartGet(
|
|
@@ -84,29 +87,19 @@ export class SmartconfigFormatter extends BaseFormatter {
|
|
|
84
87
|
);
|
|
85
88
|
}
|
|
86
89
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
)
|
|
94
|
-
interactInstance.addQuestions([
|
|
95
|
-
{
|
|
96
|
-
message: `What is the value of ${expectedRepoInformationItem}`,
|
|
97
|
-
name: expectedRepoInformationItem,
|
|
98
|
-
type: "input",
|
|
99
|
-
default: "undefined variable",
|
|
100
|
-
},
|
|
101
|
-
]);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
90
|
+
const missingRepoQuestions: plugins.smartconsole.IInputQuestion[] =
|
|
91
|
+
missingRepoInformation.map((missingRepoInformationItem) => ({
|
|
92
|
+
message: `What is the value of ${missingRepoInformationItem}`,
|
|
93
|
+
name: missingRepoInformationItem,
|
|
94
|
+
type: "input",
|
|
95
|
+
default: "undefined variable",
|
|
96
|
+
}));
|
|
104
97
|
|
|
105
|
-
const
|
|
98
|
+
const answers = await withPrompts((prompts) =>
|
|
99
|
+
prompts.add(missingRepoQuestions).runQueue(answerDefaultsWithoutTerminal),
|
|
100
|
+
);
|
|
106
101
|
for (const expectedRepoInformationItem of expectedRepoInformation) {
|
|
107
|
-
const cliProvidedValue =
|
|
108
|
-
expectedRepoInformationItem,
|
|
109
|
-
);
|
|
102
|
+
const cliProvidedValue = answers[expectedRepoInformationItem];
|
|
110
103
|
if (cliProvidedValue) {
|
|
111
104
|
plugins.smartobject.smartAdd(
|
|
112
105
|
smartconfigJson["@git.zone/cli"],
|
package/ts/mod_format/index.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import * as plugins from "./mod.plugins.js";
|
|
2
2
|
import { Project } from "../classes.project.js";
|
|
3
3
|
import { FormatContext } from "./classes.formatcontext.js";
|
|
4
|
+
import {
|
|
5
|
+
answerDefaultsWithoutTerminal,
|
|
6
|
+
ask,
|
|
7
|
+
confirm,
|
|
8
|
+
} from "../helpers.prompts.js";
|
|
4
9
|
import { FormatPlanner } from "./classes.formatplanner.js";
|
|
5
10
|
import { BaseFormatter } from "./classes.baseformatter.js";
|
|
6
11
|
import { logger, setVerboseMode } from "../gitzone.logging.js";
|
|
@@ -297,7 +302,7 @@ const handleFormatFix = async (
|
|
|
297
302
|
"Format fix requires an interactive terminal or `-y` to run non-interactively.",
|
|
298
303
|
);
|
|
299
304
|
}
|
|
300
|
-
const confirmed = await
|
|
305
|
+
const confirmed = await confirm(
|
|
301
306
|
`Run format fixes? (${plan.summary.totalFiles} planned change(s), ${status.errorCount} error warning(s))`,
|
|
302
307
|
true,
|
|
303
308
|
);
|
|
@@ -549,15 +554,14 @@ export let run = async (
|
|
|
549
554
|
|
|
550
555
|
// Interactive confirmation
|
|
551
556
|
if (interactive && !autoApprove) {
|
|
552
|
-
const
|
|
553
|
-
const response = await interactInstance.askQuestion({
|
|
557
|
+
const proceed = await ask({
|
|
554
558
|
type: "confirm",
|
|
555
559
|
name: "proceed",
|
|
556
560
|
message: "Proceed with formatting?",
|
|
557
561
|
default: true,
|
|
558
|
-
});
|
|
562
|
+
}, answerDefaultsWithoutTerminal);
|
|
559
563
|
|
|
560
|
-
if (!
|
|
564
|
+
if (!proceed) {
|
|
561
565
|
logger.log("info", "Format operation cancelled by user");
|
|
562
566
|
return;
|
|
563
567
|
}
|
|
@@ -2,7 +2,6 @@ export * from '../plugins.js';
|
|
|
2
2
|
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
import * as smartfile from '@push.rocks/smartfile';
|
|
5
|
-
import * as smartinteract from '@push.rocks/smartinteract';
|
|
6
5
|
import * as smartlegal from '@push.rocks/smartlegal';
|
|
7
6
|
import * as smartobject from '@push.rocks/smartobject';
|
|
8
7
|
import * as smartconfig from '@push.rocks/smartconfig';
|
|
@@ -12,7 +11,6 @@ import * as smartscaf from '@push.rocks/smartscaf';
|
|
|
12
11
|
export {
|
|
13
12
|
path,
|
|
14
13
|
smartfile,
|
|
15
|
-
smartinteract,
|
|
16
14
|
smartlegal,
|
|
17
15
|
smartobject,
|
|
18
16
|
smartconfig,
|
|
@@ -3,6 +3,7 @@ import * as paths from '../paths.js';
|
|
|
3
3
|
import * as interfaces from './meta.interfaces.js';
|
|
4
4
|
|
|
5
5
|
import { logger } from '../gitzone.logging.js';
|
|
6
|
+
import { answerDefaultsWithoutTerminal, confirm } from '../helpers.prompts.js';
|
|
6
7
|
|
|
7
8
|
export class Meta {
|
|
8
9
|
public cwd: string;
|
|
@@ -143,9 +144,10 @@ export class Meta {
|
|
|
143
144
|
}
|
|
144
145
|
|
|
145
146
|
const shouldClean =
|
|
146
|
-
await
|
|
147
|
+
await confirm(
|
|
147
148
|
'Delete these untracked paths?',
|
|
148
149
|
false,
|
|
150
|
+
answerDefaultsWithoutTerminal,
|
|
149
151
|
);
|
|
150
152
|
if (!shouldClean) {
|
|
151
153
|
logger.log('note', 'keeping untracked paths');
|
|
@@ -188,9 +190,10 @@ export class Meta {
|
|
|
188
190
|
)
|
|
189
191
|
) {
|
|
190
192
|
const response =
|
|
191
|
-
await
|
|
193
|
+
await confirm(
|
|
192
194
|
`Do you want to delete superfluous directory >>${preExistingFolderArg}<< ?`,
|
|
193
195
|
true,
|
|
196
|
+
answerDefaultsWithoutTerminal,
|
|
194
197
|
);
|
|
195
198
|
if (response) {
|
|
196
199
|
logger.log('warn', `Deleting >>${preExistingFolderArg}<<!`);
|
|
@@ -365,9 +368,10 @@ export class Meta {
|
|
|
365
368
|
const targetExists = await plugins.smartfs.directory(targetDirectory).exists();
|
|
366
369
|
if (targetExists) {
|
|
367
370
|
const shouldContinue =
|
|
368
|
-
await
|
|
371
|
+
await confirm(
|
|
369
372
|
`Delete directory ${targetDirectory} and everything in it?`,
|
|
370
373
|
false,
|
|
374
|
+
answerDefaultsWithoutTerminal,
|
|
371
375
|
);
|
|
372
376
|
if (!shouldContinue) {
|
|
373
377
|
logger.log('note', 'Cancelled — nothing was removed');
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export * from '../plugins.js';
|
|
2
2
|
|
|
3
3
|
import * as smartfile from '@push.rocks/smartfile';
|
|
4
|
-
import * as smartinteraction from '@push.rocks/smartinteract';
|
|
5
4
|
import * as smartjson from '@push.rocks/smartjson';
|
|
6
5
|
import * as smartshell from '@push.rocks/smartshell';
|
|
7
6
|
|
|
8
|
-
export { smartfile,
|
|
7
|
+
export { smartfile, smartjson, smartshell };
|
package/ts/mod_release/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import * as paths from "../paths.js";
|
|
|
3
3
|
import { logger } from "../gitzone.logging.js";
|
|
4
4
|
import type { ICliMode } from "../helpers.climode.js";
|
|
5
5
|
import { getCliMode, printJson } from "../helpers.climode.js";
|
|
6
|
+
import { confirm } from "../helpers.prompts.js";
|
|
6
7
|
import {
|
|
7
8
|
movePendingToVersion,
|
|
8
9
|
readPendingChangelog,
|
|
@@ -284,7 +285,7 @@ const runInternal = async (argvArg: any): Promise<void> => {
|
|
|
284
285
|
);
|
|
285
286
|
}
|
|
286
287
|
const confirmed =
|
|
287
|
-
await
|
|
288
|
+
await confirm(
|
|
288
289
|
`Release v${newVersion} now?`,
|
|
289
290
|
true,
|
|
290
291
|
);
|
|
@@ -1305,7 +1306,7 @@ const runReleaseRecover = async (
|
|
|
1305
1306
|
"Release recovery requires an interactive terminal or -y.",
|
|
1306
1307
|
);
|
|
1307
1308
|
if (
|
|
1308
|
-
!(await
|
|
1309
|
+
!(await confirm(
|
|
1309
1310
|
`Recover and publish existing v${version}?`,
|
|
1310
1311
|
false,
|
|
1311
1312
|
))
|
|
@@ -1632,7 +1633,7 @@ const confirmReleaseResume = async (
|
|
|
1632
1633
|
throw new Error("Release resume requires an interactive terminal or -y.");
|
|
1633
1634
|
}
|
|
1634
1635
|
const confirmed =
|
|
1635
|
-
await
|
|
1636
|
+
await confirm(
|
|
1636
1637
|
questionArg,
|
|
1637
1638
|
true,
|
|
1638
1639
|
);
|
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
type TServiceMigrationScope,
|
|
40
40
|
} from '../../ts_migration/index.js';
|
|
41
41
|
import { logger } from '../gitzone.logging.js';
|
|
42
|
+
import { answerDefaultsWithoutTerminal, ask } from '../helpers.prompts.js';
|
|
42
43
|
import {
|
|
43
44
|
readSmartconfigFile,
|
|
44
45
|
setCliConfigValueInData,
|
|
@@ -755,8 +756,7 @@ export class ServiceManager {
|
|
|
755
756
|
// Check if services array exists
|
|
756
757
|
if (persistedServices.length === 0) {
|
|
757
758
|
// Prompt user to select services
|
|
758
|
-
const
|
|
759
|
-
const response = await smartinteract.askQuestion({
|
|
759
|
+
const enabledServices = await ask<string>({
|
|
760
760
|
name: 'services',
|
|
761
761
|
type: 'checkbox',
|
|
762
762
|
message: 'Which services do you want to enable for this project?',
|
|
@@ -766,9 +766,7 @@ export class ServiceManager {
|
|
|
766
766
|
{ name: 'Elasticsearch', value: 'elasticsearch' }
|
|
767
767
|
],
|
|
768
768
|
default: ['mongodb', 'objectstorage', 'elasticsearch']
|
|
769
|
-
});
|
|
770
|
-
|
|
771
|
-
const enabledServices = response.value || ['mongodb', 'objectstorage', 'elasticsearch'];
|
|
769
|
+
}, answerDefaultsWithoutTerminal);
|
|
772
770
|
this.enabledServices = enabledServices;
|
|
773
771
|
|
|
774
772
|
// Save to .smartconfig.json
|
|
@@ -3042,8 +3040,7 @@ export class ServiceManager {
|
|
|
3042
3040
|
|
|
3043
3041
|
const currentServices = this.enabledServices || ['mongodb', 'objectstorage', 'elasticsearch'];
|
|
3044
3042
|
|
|
3045
|
-
const
|
|
3046
|
-
const response = await smartinteract.askQuestion({
|
|
3043
|
+
const enabledServices = await ask<string>({
|
|
3047
3044
|
name: 'services',
|
|
3048
3045
|
type: 'checkbox',
|
|
3049
3046
|
message: 'Which services do you want to enable?',
|
|
@@ -3053,9 +3050,7 @@ export class ServiceManager {
|
|
|
3053
3050
|
{ name: 'Elasticsearch', value: 'elasticsearch' }
|
|
3054
3051
|
],
|
|
3055
3052
|
default: currentServices
|
|
3056
|
-
});
|
|
3057
|
-
|
|
3058
|
-
const enabledServices = response.value || ['mongodb', 'objectstorage', 'elasticsearch'];
|
|
3053
|
+
}, answerDefaultsWithoutTerminal);
|
|
3059
3054
|
this.enabledServices = enabledServices;
|
|
3060
3055
|
|
|
3061
3056
|
// Save to .smartconfig.json
|
|
@@ -3073,15 +3068,14 @@ export class ServiceManager {
|
|
|
3073
3068
|
|
|
3074
3069
|
// Ask if user wants to restart services after releasing the reconfiguration
|
|
3075
3070
|
// locks; startAll acquires the same locks one service at a time.
|
|
3076
|
-
const
|
|
3077
|
-
const response = await smartinteract.askQuestion({
|
|
3071
|
+
const restart = await ask({
|
|
3078
3072
|
name: 'restart',
|
|
3079
3073
|
type: 'confirm',
|
|
3080
3074
|
message: 'Do you want to start services with new ports?',
|
|
3081
3075
|
default: true
|
|
3082
|
-
});
|
|
3076
|
+
}, answerDefaultsWithoutTerminal);
|
|
3083
3077
|
|
|
3084
|
-
if (
|
|
3078
|
+
if (restart) {
|
|
3085
3079
|
console.log();
|
|
3086
3080
|
await this.startAll();
|
|
3087
3081
|
await this.registerWithGlobalRegistry();
|
package/ts/mod_services/index.ts
CHANGED
|
@@ -17,6 +17,11 @@ import {
|
|
|
17
17
|
type IServicePrunePlan,
|
|
18
18
|
} from "./classes.servicepruner.js";
|
|
19
19
|
import { logger } from "../gitzone.logging.js";
|
|
20
|
+
import {
|
|
21
|
+
answerDefaultsWithoutTerminal,
|
|
22
|
+
ask,
|
|
23
|
+
confirm,
|
|
24
|
+
} from "../helpers.prompts.js";
|
|
20
25
|
import type { ICliMode } from "../helpers.climode.js";
|
|
21
26
|
import {
|
|
22
27
|
getCliMode,
|
|
@@ -569,14 +574,8 @@ async function handleMigrate(
|
|
|
569
574
|
"`services migrate` stops and replaces the legacy database container. Re-run with --yes to confirm non-interactively.",
|
|
570
575
|
);
|
|
571
576
|
}
|
|
572
|
-
const
|
|
573
|
-
|
|
574
|
-
name: "confirm",
|
|
575
|
-
type: "confirm",
|
|
576
|
-
message: "Migrate now?",
|
|
577
|
-
default: false,
|
|
578
|
-
});
|
|
579
|
-
if (!confirmAnswer.value) {
|
|
577
|
+
const migrateNow = await confirm("Migrate now?", false);
|
|
578
|
+
if (!migrateNow) {
|
|
580
579
|
logger.log("note", "Cancelled");
|
|
581
580
|
return;
|
|
582
581
|
}
|
|
@@ -595,11 +594,7 @@ async function handleRemove(serviceManager: ServiceManager, mode: ICliMode) {
|
|
|
595
594
|
"`services remove` needs confirmation. Re-run with --yes to remove containers non-interactively.",
|
|
596
595
|
);
|
|
597
596
|
}
|
|
598
|
-
const shouldContinue =
|
|
599
|
-
await plugins.smartinteract.SmartInteract.getCliConfirmation(
|
|
600
|
-
"Continue?",
|
|
601
|
-
false,
|
|
602
|
-
);
|
|
597
|
+
const shouldContinue = await confirm("Continue?", false);
|
|
603
598
|
if (!shouldContinue) {
|
|
604
599
|
logger.log("note", "Cancelled");
|
|
605
600
|
return;
|
|
@@ -622,14 +617,13 @@ async function handleClean(serviceManager: ServiceManager, mode: ICliMode) {
|
|
|
622
617
|
"`services clean` destroys data and needs explicit intent. Re-run with --yes to confirm non-interactively.",
|
|
623
618
|
);
|
|
624
619
|
}
|
|
625
|
-
const
|
|
626
|
-
const confirmAnswer = await smartinteraction.askQuestion({
|
|
620
|
+
const confirmAnswer = await ask({
|
|
627
621
|
name: "confirm",
|
|
628
622
|
type: "input",
|
|
629
623
|
message: 'Type "yes" to confirm:',
|
|
630
624
|
default: "no",
|
|
631
625
|
});
|
|
632
|
-
if (confirmAnswer
|
|
626
|
+
if (confirmAnswer !== "yes") {
|
|
633
627
|
logger.log("note", "Cancelled");
|
|
634
628
|
return;
|
|
635
629
|
}
|
|
@@ -731,14 +725,13 @@ async function handlePrune(argvArg: any, mode: ICliMode) {
|
|
|
731
725
|
"`services prune --apply` would delete data directories. Re-run with --yes to confirm non-interactively.",
|
|
732
726
|
);
|
|
733
727
|
}
|
|
734
|
-
const
|
|
735
|
-
const confirmAnswer = await smartinteraction.askQuestion({
|
|
728
|
+
const confirmAnswer = await ask({
|
|
736
729
|
name: "confirm",
|
|
737
730
|
type: "input",
|
|
738
731
|
message: `Type "yes" to permanently delete ${plan.dataDirsToRemove.length} data directory/ies:`,
|
|
739
732
|
default: "no",
|
|
740
733
|
});
|
|
741
|
-
return confirmAnswer
|
|
734
|
+
return confirmAnswer === "yes";
|
|
742
735
|
};
|
|
743
736
|
|
|
744
737
|
if (mode.json) {
|
|
@@ -1232,11 +1225,11 @@ async function handleGlobalStop(globalRegistry: GlobalRegistry) {
|
|
|
1232
1225
|
}
|
|
1233
1226
|
|
|
1234
1227
|
console.log();
|
|
1235
|
-
const shouldContinue =
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1228
|
+
const shouldContinue = await confirm(
|
|
1229
|
+
"Stop all containers?",
|
|
1230
|
+
false,
|
|
1231
|
+
answerDefaultsWithoutTerminal,
|
|
1232
|
+
);
|
|
1240
1233
|
|
|
1241
1234
|
if (!shouldContinue) {
|
|
1242
1235
|
logger.log("note", "Cancelled");
|
|
@@ -2,11 +2,10 @@ export * from '../plugins.js';
|
|
|
2
2
|
|
|
3
3
|
import * as smartshell from '@push.rocks/smartshell';
|
|
4
4
|
import * as smartfile from '@push.rocks/smartfile';
|
|
5
|
-
import * as smartinteract from '@push.rocks/smartinteract';
|
|
6
5
|
import * as smartnetwork from '@push.rocks/smartnetwork';
|
|
7
6
|
import * as smartdelay from '@push.rocks/smartdelay';
|
|
8
7
|
|
|
9
8
|
// @lossless.org scope
|
|
10
9
|
import * as nosqldb from '@lossless.org/client/nosqldb';
|
|
11
10
|
|
|
12
|
-
export { smartshell, smartfile,
|
|
11
|
+
export { smartshell, smartfile, smartnetwork, smartdelay, nosqldb };
|
package/ts/mod_standard/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import * as plugins from "./mod.plugins.js";
|
|
|
5
5
|
import * as paths from "../paths.js";
|
|
6
6
|
import type { ICliMode } from "../helpers.climode.js";
|
|
7
7
|
import { getCliMode, printJson } from "../helpers.climode.js";
|
|
8
|
+
import { ask } from "../helpers.prompts.js";
|
|
8
9
|
|
|
9
10
|
import { logger } from "../gitzone.logging.js";
|
|
10
11
|
|
|
@@ -67,8 +68,7 @@ export let run = async (argvArg: any = {}) => {
|
|
|
67
68
|
);
|
|
68
69
|
console.log("");
|
|
69
70
|
|
|
70
|
-
const
|
|
71
|
-
const response = await interactInstance.askQuestion({
|
|
71
|
+
const action = await ask({
|
|
72
72
|
type: "list",
|
|
73
73
|
name: "action",
|
|
74
74
|
message: "What would you like to do?",
|
|
@@ -86,8 +86,6 @@ export let run = async (argvArg: any = {}) => {
|
|
|
86
86
|
],
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
-
const action = (response as any).value;
|
|
90
|
-
|
|
91
89
|
switch (action) {
|
|
92
90
|
case "commit": {
|
|
93
91
|
const modCommit = await import("../mod_commit/index.js");
|
package/ts/mod_template/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as plugins from './mod.plugins.js';
|
|
|
2
2
|
import * as paths from '../paths.js';
|
|
3
3
|
|
|
4
4
|
import { logger } from '../gitzone.logging.js';
|
|
5
|
+
import { answerDefaultsWithoutTerminal, ask, stringChoices } from '../helpers.prompts.js';
|
|
5
6
|
|
|
6
7
|
export const getTemplatePath = (templateNameArg: string) => {
|
|
7
8
|
return plugins.path.join(paths.templatesDir, templateNameArg);
|
|
@@ -30,16 +31,14 @@ export const run = async (argvArg: any) => {
|
|
|
30
31
|
let chosenTemplate: string = argvArg._[1];
|
|
31
32
|
|
|
32
33
|
if (!chosenTemplate) {
|
|
33
|
-
|
|
34
|
-
const answerBucket = await smartinteract.askQuestion({
|
|
34
|
+
chosenTemplate = await ask({
|
|
35
35
|
type: 'list',
|
|
36
36
|
default: 'npm',
|
|
37
37
|
message:
|
|
38
38
|
'What template do you want to scaffold? (Only showing mpost common options)',
|
|
39
39
|
name: 'templateName',
|
|
40
|
-
choices: ['npm', 'service', 'wcc', 'website'],
|
|
41
|
-
});
|
|
42
|
-
chosenTemplate = answerBucket.value;
|
|
40
|
+
choices: stringChoices(['npm', 'service', 'wcc', 'website']),
|
|
41
|
+
}, answerDefaultsWithoutTerminal);
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
if (await isTemplate(chosenTemplate)) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from '../plugins.js';
|
|
2
2
|
|
|
3
3
|
import * as smartfile from '@push.rocks/smartfile';
|
|
4
|
-
import * as smartinteract from '@push.rocks/smartinteract';
|
|
5
4
|
import * as smartscaf from '@push.rocks/smartscaf';
|
|
6
5
|
|
|
7
|
-
export { smartfile,
|
|
6
|
+
export { smartfile, smartscaf };
|
package/ts/mod_tools/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as plugins from "./mod.plugins.js";
|
|
|
2
2
|
import { commitinfo } from "../00_commitinfo_data.js";
|
|
3
3
|
import type { ICliMode } from "../helpers.climode.js";
|
|
4
4
|
import { getCliMode, printJson } from "../helpers.climode.js";
|
|
5
|
+
import { ask } from "../helpers.prompts.js";
|
|
5
6
|
import {
|
|
6
7
|
PackageManagerUtil,
|
|
7
8
|
type IInstalledPackage,
|
|
@@ -177,14 +178,12 @@ async function runUpdate(argvArg: any, mode: ICliMode): Promise<void> {
|
|
|
177
178
|
|
|
178
179
|
let shouldUpdate = mode.yes;
|
|
179
180
|
if (!shouldUpdate) {
|
|
180
|
-
|
|
181
|
-
const answer = await interactInstance.askQuestion({
|
|
181
|
+
shouldUpdate = await ask({
|
|
182
182
|
type: "confirm",
|
|
183
183
|
name: "confirmUpdate",
|
|
184
184
|
message: "Do you want to update, migrate, and cleanup these tools?",
|
|
185
185
|
default: true,
|
|
186
186
|
});
|
|
187
|
-
shouldUpdate = answer.value === true;
|
|
188
187
|
}
|
|
189
188
|
|
|
190
189
|
if (!shouldUpdate) {
|
|
@@ -279,16 +278,13 @@ async function runInstall(argvArg: any, mode: ICliMode): Promise<void> {
|
|
|
279
278
|
});
|
|
280
279
|
}
|
|
281
280
|
|
|
282
|
-
|
|
283
|
-
const answer = await interactInstance.askQuestion({
|
|
281
|
+
selectedPackages = await ask({
|
|
284
282
|
type: "checkbox",
|
|
285
283
|
name: "packages",
|
|
286
284
|
message: "Select packages to install:",
|
|
287
285
|
default: missingPackages,
|
|
288
286
|
choices: choicesWithVersions,
|
|
289
287
|
});
|
|
290
|
-
|
|
291
|
-
selectedPackages = answer.value as string[];
|
|
292
288
|
if (selectedPackages.length === 0) {
|
|
293
289
|
console.log("No packages selected. Nothing to install.");
|
|
294
290
|
return;
|
|
@@ -322,14 +318,12 @@ async function handleSelfUpdate(
|
|
|
322
318
|
|
|
323
319
|
let shouldUpdate = mode.yes;
|
|
324
320
|
if (!shouldUpdate) {
|
|
325
|
-
|
|
326
|
-
const answer = await interactInstance.askQuestion({
|
|
321
|
+
shouldUpdate = await ask({
|
|
327
322
|
type: "confirm",
|
|
328
323
|
name: "confirmSelfUpdate",
|
|
329
324
|
message: "Do you want to update gitzone itself first?",
|
|
330
325
|
default: true,
|
|
331
326
|
});
|
|
332
|
-
shouldUpdate = answer.value === true;
|
|
333
327
|
}
|
|
334
328
|
|
|
335
329
|
if (!shouldUpdate) {
|
package/ts/plugins.ts
CHANGED
|
@@ -10,7 +10,7 @@ import * as fsSync from 'node:fs';
|
|
|
10
10
|
import * as childProcess from 'node:child_process';
|
|
11
11
|
import * as tty from 'node:tty';
|
|
12
12
|
import * as projectinfo from '@push.rocks/projectinfo';
|
|
13
|
-
import * as
|
|
13
|
+
import * as smartconsole from '@push.rocks/smartconsole';
|
|
14
14
|
import * as smartpath from '@push.rocks/smartpath';
|
|
15
15
|
import * as smartpromise from '@push.rocks/smartpromise';
|
|
16
16
|
import * as smartupdate from '@push.rocks/smartupdate';
|
|
@@ -18,7 +18,6 @@ import * as smartshell from '@push.rocks/smartshell';
|
|
|
18
18
|
import * as smartnetwork from '@push.rocks/smartnetwork';
|
|
19
19
|
import * as smartfile from '@push.rocks/smartfile';
|
|
20
20
|
import { SmartFs, SmartFsProviderNode } from '@push.rocks/smartfs';
|
|
21
|
-
import * as smartinteract from '@push.rocks/smartinteract';
|
|
22
21
|
import * as smartdelay from '@push.rocks/smartdelay';
|
|
23
22
|
|
|
24
23
|
// @lossless.org scope
|
|
@@ -62,14 +61,13 @@ export {
|
|
|
62
61
|
childProcess,
|
|
63
62
|
tty,
|
|
64
63
|
projectinfo,
|
|
65
|
-
|
|
64
|
+
smartconsole,
|
|
66
65
|
smartpath,
|
|
67
66
|
smartpromise,
|
|
68
67
|
smartupdate,
|
|
69
68
|
smartshell,
|
|
70
69
|
smartnetwork,
|
|
71
70
|
smartfile,
|
|
72
|
-
smartinteract,
|
|
73
71
|
smartdelay,
|
|
74
72
|
objectstorage,
|
|
75
73
|
s3,
|