UNPKG

@dumbdevs/scaffold-move

Version:

Scaffold generator for Movement Labs DApps in TypeScript

114 lines (113 loc) 4.69 kB
#!/usr/bin/env node "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const commander_1 = require("commander"); const inquirer_1 = __importDefault(require("inquirer")); const chalk_1 = __importDefault(require("chalk")); const index_js_1 = __importDefault(require("../index.js")); // ASCII art for "Scaffold Move" const displayIntro = () => { console.log(chalk_1.default.cyan('--------------------------------------------------')); console.log(chalk_1.default.cyan('| |')); console.log(chalk_1.default.cyan('| /\\ /\\ /\\ /\\ /\\ /\\ /\\ |')); console.log(chalk_1.default.cyan('| / \\ / \\ / \\ / \\ / \\ / \\ / \\ |')); console.log(chalk_1.default.cyan('| /____\\/____\\/____\\/____\\/____\\/____\\/____\\ |')); console.log(chalk_1.default.cyan('| | Scaffold Move - Movement Labs DApp Tool | |')); console.log(chalk_1.default.cyan('| \\____/\\____/\\____/\\____/\\____/\\____/\\____/ |')); console.log(chalk_1.default.cyan('| \\ / \\ / \\ / \\ / \\ / \\ / \\ / |')); console.log(chalk_1.default.cyan('| \\/ \\/ \\/ \\/ \\/ \\/ \\/ |')); console.log(chalk_1.default.cyan('| |')); console.log(chalk_1.default.cyan('--------------------------------------------------')); console.log(chalk_1.default.cyan('Welcome to Scaffold Move - Build DApps with Ease!\n')); }; commander_1.program .version('1.0.0') .command('init') .description('Initialize a new Movement Labs DApp project') .action(async () => { // Display intro displayIntro(); // Step 1: Prompt for language const languageAnswer = await inquirer_1.default.prompt([ { type: 'list', name: 'language', message: 'Select your preferred language:', choices: ['JavaScript', 'TypeScript'], }, ]); // Step 2: Prompt for framework based on language const frameworkChoices = languageAnswer.language === 'JavaScript' ? ['Vite (JavaScript)', 'Create React App'] : ['Next.js (TypeScript)', 'Vite (TypeScript)']; const frameworkAnswer = await inquirer_1.default.prompt([ { type: 'list', name: 'framework', message: 'Select your framework/template:', choices: frameworkChoices, }, ]); // Step 3: Prompt for project name and type const baseAnswers = await inquirer_1.default.prompt([ { type: 'input', name: 'projectName', message: 'Enter your project name:', default: 'my-move-dapp', }, { type: 'list', name: 'projectType', message: 'Select project type:', choices: ['Plain', 'DeFi', 'DAO'], }, ]); // Step 4: Prompt for integrations const integrationAnswers = await inquirer_1.default.prompt([ { type: 'checkbox', name: 'integrations', message: 'Select integrations:', choices: [ 'Pyth (Price Feeds)', 'GraphQL', 'IPFS/Arweave (Storage)', 'Supabase (Backend)', 'Custom (Add your own)', ], }, { type: 'confirm', name: 'addMoreIntegrations', message: 'Would you like to add more custom integrations?', default: false, }, ]); let integrations = integrationAnswers.integrations; if (integrationAnswers.addMoreIntegrations) { const customAnswers = await inquirer_1.default.prompt([ { type: 'input', name: 'customIntegration', message: 'Enter the name of your custom integration (e.g., Chainlink):', }, ]); integrations.push(customAnswers.customIntegration); } // Combine all answers into a single config object const config = { ...languageAnswer, ...frameworkAnswer, ...baseAnswers, integrations, addMoreIntegrations: integrationAnswers.addMoreIntegrations, }; console.log(chalk_1.default.green('Generating your Movement Labs DApp...')); await (0, index_js_1.default)(config); console.log(chalk_1.default.green('Project scaffolded successfully!')); }); commander_1.program.parse(process.argv);