@getpara/create-para-app 0.1.0 → 0.2.0

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.
@@ -1,196 +0,0 @@
1
- import chalk from 'chalk';
2
- import fs from 'fs-extra';
3
- import { promptInteractive } from '../prompts/interactive.js';
4
- import { scaffoldNextjs } from '../templates/nextjs.js';
5
- import { scaffoldViteReact } from '../templates/vite-react.js';
6
- import { runSDKSetup } from '../integrations/sdkSetup.js';
7
- import { logInfo, logError, logHeader, logSection, logSubsection } from '../utils/logger.js';
8
-
9
- interface ScaffoldOptions {
10
- projectName?: string;
11
- template?: string;
12
- useLatest?: boolean;
13
- noPrompt?: boolean;
14
- noGit?: boolean;
15
- packageManager?: string;
16
- skipDeps?: boolean;
17
- typescript?: boolean;
18
- eslint?: boolean;
19
- tailwind?: boolean;
20
- srcDir?: boolean;
21
- app?: boolean;
22
-
23
- networks?: string;
24
- evmSigner?: string;
25
- externalWallet?: boolean;
26
- apiKey?: string;
27
- }
28
-
29
- interface ScaffoldConfig {
30
- projectName: string;
31
- template: string;
32
- networks: string[];
33
- evmSigner?: string;
34
- apiKey: string;
35
- externalWalletSupport: boolean;
36
- useLatest: boolean;
37
- noGit: boolean;
38
- packageManager: string;
39
- skipDeps: boolean;
40
- typescript: boolean;
41
- eslint: boolean;
42
- tailwind: boolean;
43
- srcDir: boolean;
44
- app: boolean;
45
- }
46
-
47
- function validateOptions(options?: ScaffoldOptions) {
48
- if (options?.template && !['nextjs', 'vite-react'].includes(options.template)) {
49
- throw new Error(`Invalid template '${options.template}'. Valid templates: nextjs, vite-react.`);
50
- }
51
-
52
- if (options?.evmSigner && !['ethers', 'viem'].includes(options.evmSigner)) {
53
- throw new Error(`Invalid EVM signer '${options.evmSigner}'. Valid signers: ethers, viem.`);
54
- }
55
-
56
- if (options?.networks) {
57
- const nets = options.networks.split(',').map(n => n.trim());
58
- for (const network of nets) {
59
- if (!['evm', 'cosmos', 'solana'].includes(network)) {
60
- throw new Error(`Invalid network '${network}'. Valid options: evm, cosmos, solana.`);
61
- }
62
- }
63
- }
64
- }
65
-
66
- function cleanupProjectDirectory(projectName: string) {
67
- if (!projectName) return;
68
- try {
69
- if (fs.existsSync(projectName)) {
70
- fs.removeSync(projectName);
71
- }
72
- } catch {}
73
- }
74
-
75
- export default async function scaffold(positionalProjectName?: string, options?: ScaffoldOptions) {
76
- try {
77
- validateOptions(options);
78
-
79
- const {
80
- projectName: cliProjectName,
81
- template: cliTemplate,
82
- useLatest,
83
- noPrompt,
84
- noGit,
85
- packageManager,
86
- skipDeps,
87
- typescript = true,
88
- eslint = true,
89
- tailwind = true,
90
- srcDir = true,
91
- app = true,
92
- networks,
93
- evmSigner,
94
- externalWallet,
95
- apiKey,
96
- } = options || {};
97
-
98
- // For rollback reference
99
- const finalProjectName = cliProjectName || positionalProjectName;
100
-
101
- let config: ScaffoldConfig = {
102
- projectName: finalProjectName || '',
103
- template: cliTemplate || '',
104
- networks: [],
105
- evmSigner: '',
106
- apiKey: apiKey || '',
107
- externalWalletSupport: externalWallet,
108
- useLatest: !!useLatest,
109
- noGit: !!noGit,
110
- packageManager: packageManager || 'yarn',
111
- skipDeps: !!skipDeps,
112
- typescript,
113
- eslint,
114
- tailwind,
115
- srcDir,
116
- app,
117
- };
118
-
119
- // Populate networks if provided
120
- if (networks) {
121
- config.networks = networks.split(',').map(n => n.trim());
122
- }
123
- if (evmSigner) {
124
- config.evmSigner = evmSigner;
125
- }
126
-
127
- // We'll decide if we must prompt
128
- const needTemplate = !config.template;
129
- const needProjectName = !config.projectName;
130
- const needNetworks = !config.networks.length;
131
- const needEvmSigner = config.networks.includes('evm') && !config.evmSigner;
132
- const needApiKey = !config.apiKey;
133
-
134
- const shouldPrompt = !noPrompt && (needTemplate || needProjectName || needNetworks || needEvmSigner || needApiKey);
135
-
136
- if (shouldPrompt) {
137
- const answers = await promptInteractive(config);
138
-
139
- config.projectName = answers.projectName || `para-${answers.template}-template`;
140
- config.template = answers.template;
141
- config.networks = answers.networks;
142
- config.evmSigner = answers.evmSigner || (answers.networks.includes('evm') ? 'ethers' : '');
143
- config.apiKey = answers.apiKey;
144
- config.externalWalletSupport = answers.externalWalletSupport;
145
- } else {
146
- if (!config.projectName) {
147
- const t = cliTemplate || 'nextjs';
148
- config.projectName = `para-${t}-template`;
149
- }
150
- if (!config.template) {
151
- config.template = 'nextjs';
152
- }
153
- if (!config.networks.length) {
154
- config.networks = [];
155
- }
156
- if (!config.evmSigner && config.networks.includes('evm')) {
157
- config.evmSigner = 'ethers';
158
- }
159
- }
160
-
161
- if (fs.existsSync(config.projectName)) {
162
- throw new Error(`Project folder '${config.projectName}' already exists. Please remove or choose a different name.`);
163
- }
164
-
165
- logHeader(`🚀 Creating a new project named: ${config.projectName}`);
166
- logSection('🔧 Project Configuration:');
167
- logSubsection('Project Type', config.template);
168
- logSubsection('Supported Networks', config.networks.length > 0 ? config.networks.join(', ') : 'None');
169
- if (config.networks.includes('evm')) {
170
- logSubsection('EVM Signer', config.evmSigner);
171
- }
172
- logSubsection('API Key', config.apiKey);
173
- logSubsection('External Wallet Support', config.externalWalletSupport ? 'Enabled' : 'Disabled');
174
- logSubsection('TypeScript', config.typescript ? 'Enabled' : 'Disabled');
175
- logSubsection('ESLint', config.eslint ? 'Enabled' : 'Disabled');
176
- logSubsection('Tailwind', config.tailwind ? 'Enabled' : 'Disabled');
177
- logSubsection('src/ directory', config.srcDir ? 'Enabled' : 'Disabled');
178
- logSubsection('App Router', config.app ? 'Enabled' : 'Disabled');
179
-
180
- if (config.template === 'vite-react') {
181
- await scaffoldViteReact(config);
182
- } else {
183
- await scaffoldNextjs(config);
184
- }
185
-
186
- await runSDKSetup(config);
187
-
188
- logInfo(chalk.green('✅ Scaffolding complete!'));
189
- } catch (error: any) {
190
- logError(`Error: ${error.message || error}`);
191
-
192
- cleanupProjectDirectory(options?.projectName || positionalProjectName || '');
193
-
194
- process.exit(1);
195
- }
196
- }
package/src/index.ts DELETED
@@ -1,43 +0,0 @@
1
- import { program } from 'commander';
2
- import updateNotifier from 'update-notifier';
3
- import pkg from '../package.json' assert { type: 'json' };
4
- import scaffold from './commands/scaffold.js';
5
-
6
- updateNotifier({ pkg }).notify();
7
-
8
- program
9
- .name('create-para-app')
10
- .description('CLI tool for scaffolding new apps with Para SDKs')
11
- .version(pkg.version)
12
- .usage('[projectName] [options]')
13
- .helpOption('--help', 'Display help for command');
14
-
15
- program
16
- .argument('[projectName]')
17
- .description('Scaffold a new app with specified template and features')
18
- .option('--template <template>', 'Specify the template: nextjs or vite-react')
19
- .option('--use-latest', 'Use the latest version of the underlying framework')
20
- .option('--no-prompt', 'Skip interactive prompts')
21
- .option('--no-git', 'Disable git initialization')
22
- .option('--package-manager <pm>', 'Specify package manager: npm, yarn, bun, pnpm', 'yarn')
23
- .option('--skip-deps', 'Skip dependency installation')
24
- .option('--typescript', 'Enable TypeScript (default: enabled)', true)
25
- .option('--no-typescript', 'Disable TypeScript')
26
- .option('--eslint', 'Enable ESLint (default: enabled)', true)
27
- .option('--no-eslint', 'Disable ESLint')
28
- .option('--tailwind', 'Enable Tailwind CSS (default: enabled)', true)
29
- .option('--no-tailwind', 'Disable Tailwind CSS')
30
- .option('--src-dir', 'Use src/ directory (default: enabled)', true)
31
- .option('--no-src-dir', 'Disable src/ directory')
32
- .option('--app', 'Use the App Router (default: enabled)', true)
33
- .option('--no-app', 'Disable App Router')
34
- .option('--networks <list>', 'Comma separated networks: "evm,cosmos,solana"')
35
- .option('--evm-signer <signer>', 'Specify EVM signer: "ethers" or "viem"')
36
- .option('--external-wallet', 'Enable external wallet support (default: false)')
37
- .option('--api-key <key>', 'Provide your API key to skip prompt')
38
- .option('--project-name <name>', 'Explicitly set project name to skip name prompt')
39
- .action(async (projectName, options) => {
40
- await scaffold(projectName, options);
41
- });
42
-
43
- program.parse(process.argv);
@@ -1,71 +0,0 @@
1
- import fs from 'fs-extra';
2
- import path from 'path';
3
-
4
- const EVM_DEPS = ['@getpara/evm-wallet-connectors', '@tanstack/react-query', 'wagmi', '@getpara/react-sdk'];
5
- const SOLANA_DEPS = [
6
- '@getpara/react-sdk',
7
- '@getpara/solana-wallet-connectors',
8
- '@solana-mobile/wallet-adapter-mobile',
9
- '@solana/wallet-adapter-base',
10
- '@solana/wallet-adapter-react',
11
- '@solana/wallet-adapter-walletconnect',
12
- '@solana/web3.js',
13
- '@tanstack/react-query',
14
- ];
15
- const COSMOS_DEPS = [
16
- '@getpara/core-sdk',
17
- '@getpara/cosmos-wallet-connectors',
18
- '@getpara/graz',
19
- '@getpara/react-sdk',
20
- '@getpara/user-management-client',
21
- '@cosmjs/cosmwasm-stargate',
22
- '@cosmjs/launchpad',
23
- '@cosmjs/proto-signing',
24
- '@cosmjs/stargate',
25
- '@cosmjs/tendermint-rpc',
26
- '@leapwallet/cosmos-social-login-capsule-provider',
27
- 'long',
28
- 'starknet',
29
- ];
30
- const BASE_DEPS = ['@getpara/react-sdk'];
31
-
32
- export async function updatePackageJsonDependencies(
33
- projectName: string,
34
- networks: string[],
35
- externalWalletSupport: boolean,
36
- ) {
37
- const pkgPath = path.join(projectName, 'package.json');
38
- const exists = await fs.pathExists(pkgPath);
39
- if (!exists) {
40
- return;
41
- }
42
- const pkgData = await fs.readJSON(pkgPath);
43
- pkgData.dependencies = pkgData.dependencies || {};
44
- if (!externalWalletSupport) {
45
- BASE_DEPS.forEach(dep => {
46
- pkgData.dependencies[dep] = pkgData.dependencies[dep] || 'latest';
47
- });
48
- } else {
49
- if (networks.includes('evm')) {
50
- EVM_DEPS.forEach(dep => {
51
- pkgData.dependencies[dep] = pkgData.dependencies[dep] || 'latest';
52
- });
53
- }
54
- if (networks.includes('solana')) {
55
- SOLANA_DEPS.forEach(dep => {
56
- pkgData.dependencies[dep] = pkgData.dependencies[dep] || 'latest';
57
- });
58
- }
59
- if (networks.includes('cosmos')) {
60
- COSMOS_DEPS.forEach(dep => {
61
- pkgData.dependencies[dep] = pkgData.dependencies[dep] || 'latest';
62
- });
63
- }
64
- if (!networks.includes('evm') && !networks.includes('solana') && !networks.includes('cosmos')) {
65
- BASE_DEPS.forEach(dep => {
66
- pkgData.dependencies[dep] = pkgData.dependencies[dep] || 'latest';
67
- });
68
- }
69
- }
70
- await fs.writeJSON(pkgPath, pkgData, { spaces: 2 });
71
- }
@@ -1,13 +0,0 @@
1
- import { logInfo } from '../utils/logger.js';
2
- import { sdkSetupNextjs } from './sdkSetupNextjs.js';
3
- import { sdkSetupVite } from './sdkSetupVite.js';
4
-
5
- export async function runSDKSetup(config) {
6
- const { projectName, template } = config;
7
- logInfo(`🔌 Integrating Para SDK into project ${projectName}...`);
8
- if (template === 'vite-react') {
9
- await sdkSetupVite(config);
10
- } else {
11
- await sdkSetupNextjs(config);
12
- }
13
- }
@@ -1,122 +0,0 @@
1
- import fs from 'fs-extra';
2
- import path from 'path';
3
- import { logHeader, logSection, logSubsection, logStep } from '../utils/logger.js';
4
- import { formatWithPrettier } from '../utils/formatting.js';
5
- import { updatePackageJsonDependencies } from './packageJsonHelpers.js';
6
- import {
7
- getEnvFileContent,
8
- getParaClientCode,
9
- getWalletProviderCodeNextjs,
10
- getHelloParaFile,
11
- getHomeFile,
12
- getStylesNonTailwind,
13
- } from './codeGenerators.js';
14
-
15
- export async function sdkSetupNextjs(config) {
16
- const {
17
- projectName,
18
- networks,
19
- evmSigner,
20
- apiKey,
21
- noTypescript,
22
- noAppRouter,
23
- noSrcDir,
24
- externalWalletSupport,
25
- tailwind,
26
- app,
27
- } = config;
28
-
29
- const envContent = getEnvFileContent(apiKey, true);
30
- const envPath = path.join(projectName, '.env');
31
- await fs.outputFile(envPath, envContent);
32
-
33
- const clientDir = path.join(projectName, 'src', 'client');
34
- await fs.ensureDir(clientDir);
35
- const paraClient = getParaClientCode(true, !noTypescript);
36
- {
37
- const filePath = path.join(clientDir, `para.${noTypescript ? 'js' : 'ts'}`);
38
- const formatted = await formatWithPrettier(paraClient, filePath);
39
- await fs.outputFile(filePath, formatted);
40
- }
41
-
42
- if (externalWalletSupport) {
43
- const compDir = path.join(projectName, 'src', 'components');
44
- await fs.ensureDir(compDir);
45
- const results = getWalletProviderCodeNextjs(networks, noAppRouter);
46
- for (const r of results) {
47
- const fileExt = noTypescript ? 'jsx' : 'tsx';
48
- const filePath = path.join(compDir, `${r.fileName}.${fileExt}`);
49
- const formatted = await formatWithPrettier(r.code, filePath);
50
- await fs.outputFile(filePath, formatted);
51
- }
52
- }
53
-
54
- const componentsDir = path.join(projectName, 'src', 'components');
55
- await fs.ensureDir(componentsDir);
56
- const helloParaCode = getHelloParaFile(!!tailwind, !noTypescript, true);
57
- {
58
- const filePath = path.join(componentsDir, `HelloPara.${noTypescript ? 'jsx' : 'tsx'}`);
59
- const formatted = await formatWithPrettier(helloParaCode, filePath);
60
- await fs.outputFile(filePath, formatted);
61
- }
62
-
63
- const homeCode = getHomeFile(!!tailwind, !noTypescript, !!externalWalletSupport);
64
- let mainPath = '';
65
- if (noAppRouter) {
66
- if (noSrcDir) {
67
- mainPath = path.join(projectName, 'pages', `index.${noTypescript ? 'jsx' : 'tsx'}`);
68
- } else {
69
- mainPath = path.join(projectName, 'src', 'pages', `index.${noTypescript ? 'jsx' : 'tsx'}`);
70
- }
71
- } else {
72
- if (noSrcDir) {
73
- mainPath = path.join(projectName, 'app', `page.${noTypescript ? 'jsx' : 'tsx'}`);
74
- } else {
75
- mainPath = path.join(projectName, 'src', 'app', `page.${noTypescript ? 'jsx' : 'tsx'}`);
76
- }
77
- }
78
- const formattedHome = await formatWithPrettier(homeCode, mainPath);
79
- await fs.writeFile(mainPath, formattedHome);
80
-
81
- let cssFilePath = '';
82
- if (tailwind) {
83
- if (app) {
84
- cssFilePath = path.join(projectName, 'src', 'app', 'globals.css');
85
- } else {
86
- cssFilePath = path.join(projectName, 'styles', 'globals.css');
87
- }
88
- if (!(await fs.pathExists(cssFilePath))) {
89
- await fs.outputFile(cssFilePath, '');
90
- }
91
- } else {
92
- if (app) {
93
- cssFilePath = path.join(projectName, 'src', 'app', 'globals.css');
94
- } else {
95
- cssFilePath = path.join(projectName, 'src', 'global.css');
96
- }
97
- if (!(await fs.pathExists(cssFilePath))) {
98
- await fs.outputFile(cssFilePath, '');
99
- }
100
- const stylesContent = getStylesNonTailwind();
101
- const existing = await fs.readFile(cssFilePath, 'utf-8');
102
- const appended = `${existing.trim()}\n\n${stylesContent}`;
103
- const formattedStyles = await formatWithPrettier(appended, cssFilePath);
104
- await fs.writeFile(cssFilePath, formattedStyles);
105
- }
106
-
107
- await updatePackageJsonDependencies(projectName, networks, externalWalletSupport);
108
- logSection('🛠 Configuration Details:');
109
- logSubsection('Project Type', 'nextjs');
110
- logSubsection('Supported Networks', networks.join(', ') || 'None');
111
- if (networks.includes('evm')) {
112
- logSubsection('EVM Signer', evmSigner);
113
- }
114
- logSubsection('API Key', apiKey);
115
-
116
- logSection('➡️ Next Steps:');
117
- logStep(`1. cd ${projectName}`);
118
- logStep(`2. Install dependencies if skipped (e.g., "yarn install" or "npm install")`);
119
- logStep(`3. Refer to https://docs.getpara.com/integration-guides/create-para-app for further instructions.`);
120
-
121
- logHeader('✅ SDK integration complete with ParaModal usage.');
122
- }
@@ -1,87 +0,0 @@
1
- import fs from 'fs-extra';
2
- import path from 'path';
3
- import { logHeader, logSection, logSubsection, logStep, logInfo } from '../utils/logger.js';
4
- import { formatWithPrettier } from '../utils/formatting.js';
5
- import { updatePackageJsonDependencies } from './packageJsonHelpers.js';
6
- import {
7
- getEnvFileContent,
8
- getParaClientCode,
9
- getWalletProviderCodeVite,
10
- getHelloParaFile,
11
- getHomeFile,
12
- getStylesNonTailwind,
13
- } from './codeGenerators.js';
14
-
15
- export async function sdkSetupVite(config) {
16
- const { projectName, networks, evmSigner, apiKey, noTypescript, noSrcDir, externalWalletSupport, tailwind } = config;
17
-
18
- const envContent = getEnvFileContent(apiKey, false);
19
- const envPath = path.join(projectName, '.env');
20
- await fs.outputFile(envPath, envContent);
21
-
22
- const clientDir = path.join(projectName, 'src', 'client');
23
- await fs.ensureDir(clientDir);
24
- const paraClient = getParaClientCode(false, !noTypescript);
25
- {
26
- const filePath = path.join(clientDir, `para.${noTypescript ? 'js' : 'ts'}`);
27
- const formatted = await formatWithPrettier(paraClient, filePath);
28
- await fs.outputFile(filePath, formatted);
29
- }
30
-
31
- if (externalWalletSupport) {
32
- const compDir = path.join(projectName, 'src', 'components');
33
- await fs.ensureDir(compDir);
34
- const providerCode = getWalletProviderCodeVite(networks);
35
- const filePath = path.join(compDir, `ParaWalletsProvider.${noTypescript ? 'jsx' : 'tsx'}`);
36
- const formatted = await formatWithPrettier(providerCode, filePath);
37
- await fs.outputFile(filePath, formatted);
38
- }
39
-
40
- const compDir = path.join(projectName, 'src', 'components');
41
- await fs.ensureDir(compDir);
42
- const helloParaCode = getHelloParaFile(!!tailwind, !noTypescript, false);
43
- {
44
- const filePath = path.join(compDir, `HelloPara.${noTypescript ? 'jsx' : 'tsx'}`);
45
- const formatted = await formatWithPrettier(helloParaCode, filePath);
46
- await fs.outputFile(filePath, formatted);
47
- }
48
-
49
- const homeCode = getHomeFile(!!tailwind, !noTypescript, !!externalWalletSupport);
50
- const mainFileDir = noSrcDir ? projectName : path.join(projectName, 'src');
51
- const mainFilePath = path.join(mainFileDir, `App.${noTypescript ? 'jsx' : 'tsx'}`);
52
- const exists = await fs.pathExists(mainFilePath);
53
- if (!exists) {
54
- logInfo(`Could not find ${mainFilePath} to replace.`);
55
- } else {
56
- const formatted = await formatWithPrettier(homeCode, mainFilePath);
57
- await fs.writeFile(mainFilePath, formatted);
58
- }
59
-
60
- if (!tailwind) {
61
- const indexCssPath = path.join(projectName, 'src', 'index.css');
62
- const existsCss = await fs.pathExists(indexCssPath);
63
- if (!existsCss) {
64
- await fs.outputFile(indexCssPath, '');
65
- }
66
- const existing = await fs.readFile(indexCssPath, 'utf-8');
67
- const newStyles = `${existing.trim()}\n\n${getStylesNonTailwind()}`;
68
- const formattedStyles = await formatWithPrettier(newStyles, indexCssPath);
69
- await fs.writeFile(indexCssPath, formattedStyles);
70
- }
71
-
72
- await updatePackageJsonDependencies(projectName, networks, externalWalletSupport);
73
- logSection('🛠 Configuration Details:');
74
- logSubsection('Project Type', 'vite-react');
75
- logSubsection('Supported Networks', networks.join(', ') || 'None');
76
- if (networks.includes('evm')) {
77
- logSubsection('EVM Signer', evmSigner);
78
- }
79
- logSubsection('API Key', apiKey);
80
-
81
- logSection('➡️ Next Steps:');
82
- logStep(`1. cd ${projectName}`);
83
- logStep(`2. Install dependencies if skipped (e.g., "yarn install" or "npm install")`);
84
- logStep(`3. Refer to https://docs.getpara.com/integration-guides/create-para-app for further instructions.`);
85
-
86
- logHeader('✅ SDK integration complete with ParaModal usage.');
87
- }
@@ -1,113 +0,0 @@
1
- import inquirer, { DistinctQuestion } from 'inquirer';
2
-
3
- interface InteractiveAnswers {
4
- projectName: string;
5
- networks: string[];
6
- evmSigner?: string;
7
- externalWalletSupport: boolean;
8
- apiKey: string;
9
- template: string;
10
- }
11
-
12
- export async function promptInteractive(config: {
13
- projectName?: string;
14
- template?: string;
15
- networks?: string[];
16
- evmSigner?: string;
17
- externalWalletSupport?: boolean;
18
- apiKey?: string;
19
- }): Promise<InteractiveAnswers> {
20
- const template = config.template || 'nextjs';
21
- const defaultName = config.projectName || `para-${template}-template`;
22
-
23
- const questions: DistinctQuestion<InteractiveAnswers>[] = [];
24
-
25
- if (!config.template) {
26
- questions.push({
27
- type: 'list',
28
- name: 'template',
29
- message: 'Select a project type:',
30
- choices: ['nextjs', 'vite-react'],
31
- default: 'nextjs',
32
- });
33
- }
34
-
35
- if (!config.projectName) {
36
- questions.push({
37
- type: 'input',
38
- name: 'projectName',
39
- message: 'Enter your project name:',
40
- default: answers => {
41
- const selectedTemplate = answers.template || config.template || 'nextjs';
42
- return `para-${selectedTemplate}-template`;
43
- },
44
- });
45
- }
46
-
47
- if (!config.networks || !config.networks.length) {
48
- questions.push({
49
- type: 'checkbox',
50
- name: 'networks',
51
- message: 'Select supported networks:',
52
- choices: [
53
- { name: 'EVM', value: 'evm' },
54
- { name: 'Cosmos', value: 'cosmos' },
55
- { name: 'Solana', value: 'solana' },
56
- ],
57
- });
58
- }
59
-
60
- if (config.networks && config.networks.includes('evm') && !config.evmSigner) {
61
- questions.push({
62
- type: 'list',
63
- name: 'evmSigner',
64
- message: 'Select signer for EVM:',
65
- choices: ['ethers', 'viem'],
66
- default: 'ethers',
67
- });
68
- }
69
-
70
- if (config.externalWalletSupport === undefined) {
71
- questions.push({
72
- type: 'confirm',
73
- name: 'externalWalletSupport',
74
- message: 'Enable external wallet support?',
75
- default: false,
76
- when: answers => {
77
- const nets = answers.networks || config.networks;
78
- return Array.isArray(nets) && nets.length > 0;
79
- },
80
- });
81
- }
82
-
83
- if (!config.apiKey) {
84
- questions.push({
85
- type: 'input',
86
- name: 'apiKey',
87
- message: 'Enter your API key:',
88
- validate: input => (input ? true : 'API key cannot be empty'),
89
- });
90
- }
91
-
92
- if (!questions.length) {
93
- return {
94
- projectName: config.projectName || defaultName,
95
- template,
96
- networks: config.networks || [],
97
- evmSigner: config.evmSigner,
98
- externalWalletSupport: !!config.externalWalletSupport,
99
- apiKey: config.apiKey || '',
100
- };
101
- }
102
-
103
- const answers = await inquirer.prompt<InteractiveAnswers>(questions);
104
-
105
- return {
106
- template: answers.template || template,
107
- projectName: answers.projectName || config.projectName || defaultName,
108
- networks: answers.networks || config.networks || [],
109
- evmSigner: answers.evmSigner || config.evmSigner,
110
- externalWalletSupport: answers.externalWalletSupport ?? config.externalWalletSupport ?? false,
111
- apiKey: answers.apiKey || config.apiKey || '',
112
- };
113
- }