Skip to content

Commit 22cd3de

Browse files
authored
Merge pull request #486 from proto-kit/refactor/adapt-wizard
Refactor/adapt wizard
2 parents bcdc6fd + 47b41e1 commit 22cd3de

9 files changed

Lines changed: 820 additions & 1272 deletions

File tree

packages/cli/src/commands/wizard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const wizardCommand: CommandModule<{}> = {
77
handler: async () => {
88
try {
99
const { default: createEnvironment } =
10-
await import("../scripts/env/create-environment");
10+
await import("../scripts/wizard/generate");
1111
await createEnvironment();
1212
process.exit(0);
1313
} catch (error) {

packages/cli/src/scripts/env/create-environment.ts renamed to packages/cli/src/scripts/wizard/generate.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
generateWorkerConfig,
1313
icons,
1414
promptUser,
15-
} from "../../utils/create-environment";
15+
} from "../../utils/wizard";
1616
import { resolveChainPath } from "../../utils/pathResolver";
1717

1818
export default async function () {
@@ -46,24 +46,22 @@ export default async function () {
4646
fs.writeFileSync(chainConfigPath, chainConfig);
4747

4848
if (answers.includeIndexer) {
49-
const indexerConfig = generateIndexerConfig(answers);
49+
const indexerConfig = generateIndexerConfig();
5050
if (indexerConfig) {
5151
fs.writeFileSync(indexerConfigPath, indexerConfig);
5252
}
5353
}
5454

55-
if (answers.includeProcessor && answers.includeIndexer) {
56-
const processorConfig = generateProcessorConfig(answers);
55+
if (answers.includeProcessor) {
56+
const processorConfig = generateProcessorConfig();
5757
if (processorConfig) {
5858
fs.writeFileSync(processorConfigPath, processorConfig);
5959
}
6060
}
6161

62-
if (answers.preset !== "inmemory") {
63-
const workerConfig = generateWorkerConfig(answers);
64-
if (workerConfig) {
65-
fs.writeFileSync(workerConfigPath, workerConfig);
66-
}
62+
const workerConfig = generateWorkerConfig(answers);
63+
if (workerConfig) {
64+
fs.writeFileSync(workerConfigPath, workerConfig);
6765
}
6866

6967
console.log(
@@ -89,7 +87,7 @@ export default async function () {
8987
if (answers.includeProcessor && answers.includeIndexer) {
9088
console.log(` ${green(icons.checkmark)} processor.config.ts`);
9189
}
92-
if (answers.preset !== "inmemory") {
90+
if (workerConfig) {
9391
console.log(` ${green(icons.checkmark)} worker.config.ts`);
9492
}
9593

0 commit comments

Comments
 (0)