chore: Updated styles
41fc287e
4 file(s) · +31 −8
| 6 | 6 | ||
| 7 | 7 | # testing |
|
| 8 | 8 | coverage |
|
| 9 | + | tmp |
|
| 9 | 10 | ||
| 10 | 11 | # production |
|
| 11 | 12 | dist |
| 8 | 8 | "commander": "^11.1.0", |
|
| 9 | 9 | "degit": "^2.8.4", |
|
| 10 | 10 | "execa": "^7.1.1", |
|
| 11 | + | "figlet": "^1.8.1", |
|
| 11 | 12 | "fs-extra": "^11.2.0", |
|
| 12 | 13 | "ora": "^6.3.1", |
|
| 13 | 14 | "prompts": "^2.4.2", |
|
| 40 | 41 | "degit": ["degit@2.8.4", "", { "bin": { "degit": "degit" } }, "sha512-vqYuzmSA5I50J882jd+AbAhQtgK6bdKUJIex1JNfEUPENCgYsxugzKVZlFyMwV4i06MmnV47/Iqi5Io86zf3Ng=="], |
|
| 41 | 42 | ||
| 42 | 43 | "execa": ["execa@7.2.0", "", { "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.1", "human-signals": "^4.3.0", "is-stream": "^3.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^5.1.0", "onetime": "^6.0.0", "signal-exit": "^3.0.7", "strip-final-newline": "^3.0.0" } }, "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA=="], |
|
| 44 | + | ||
| 45 | + | "figlet": ["figlet@1.8.1", "", { "bin": { "figlet": "bin/index.js" } }, "sha512-kEC3Sme+YvA8Hkibv0NR1oClGcWia0VB2fC1SlMy027cwe795Xx40Xiv/nw/iFAwQLupymWh+uhAAErn/7hwPg=="], |
|
| 43 | 46 | ||
| 44 | 47 | "fs-extra": ["fs-extra@11.3.0", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew=="], |
|
| 45 | 48 | ||
| 9 | 9 | import ora from 'ora'; |
|
| 10 | 10 | import { execa } from 'execa'; |
|
| 11 | 11 | import degit from 'degit'; |
|
| 12 | + | import figlet from 'figlet'; // Add this import |
|
| 12 | 13 | ||
| 13 | 14 | const __filename = fileURLToPath(import.meta.url); |
|
| 14 | 15 | const __dirname = path.dirname(__filename); |
|
| 16 | 17 | // GitHub repository for the template |
|
| 17 | 18 | const DEFAULT_REPO = 'stevedylandev/bhvr'; // Replace with your actual repo |
|
| 18 | 19 | ||
| 20 | + | // Function to display a fun banner |
|
| 21 | + | function displayBanner() { |
|
| 22 | + | const text = figlet.textSync('bhvr', { |
|
| 23 | + | font: 'Big', |
|
| 24 | + | horizontalLayout: 'default', |
|
| 25 | + | verticalLayout: 'default', |
|
| 26 | + | width: 80, |
|
| 27 | + | whitespaceBreak: true |
|
| 28 | + | }); |
|
| 29 | + | ||
| 30 | + | console.log('\n'); |
|
| 31 | + | console.log(chalk.yellowBright(text)); |
|
| 32 | + | console.log(`\n${chalk.cyan('🦫 Lets build 🦫')}\n`); |
|
| 33 | + | console.log(`${chalk.blue('https://github.com/stevedylandev/bhvr')}\n`); |
|
| 34 | + | } |
|
| 35 | + | ||
| 19 | 36 | // Set up the CLI program |
|
| 20 | 37 | program |
|
| 21 | 38 | .name('create-bhvr') |
|
| 27 | 44 | .option('--branch <branch>', 'specify a branch to use from the repository', 'main') |
|
| 28 | 45 | .action(async (projectDirectory, options) => { |
|
| 29 | 46 | try { |
|
| 47 | + | displayBanner(); |
|
| 30 | 48 | const result = await createProject(projectDirectory, options); |
|
| 31 | 49 | if (result) { |
|
| 32 | - | console.log(chalk.green.bold('\n🎉 Project created successfully!')); |
|
| 50 | + | ||
| 51 | + | console.log(chalk.green.bold('🎉 Project created successfully!')); |
|
| 33 | 52 | console.log('\nNext steps:'); |
|
| 34 | 53 | ||
| 35 | 54 | if (!result.dependenciesInstalled) { |
|
| 41 | 60 | ||
| 42 | 61 | console.log(chalk.cyan(' bun run dev:client # Start the client')); |
|
| 43 | 62 | console.log(chalk.cyan(' bun run dev:server # Start the server in another terminal')); |
|
| 44 | - | return |
|
| 63 | + | console.log(chalk.cyan(' bun run dev # Start all')); |
|
| 64 | + | process.exit(0); |
|
| 45 | 65 | } |
|
| 46 | 66 | } catch (err) { |
|
| 47 | 67 | console.error(chalk.red('Error creating project:'), err); |
|
| 50 | 70 | }); |
|
| 51 | 71 | ||
| 52 | 72 | program.parse(); |
|
| 53 | - | ||
| 54 | 73 | async function createProject(projectDirectory, options) { |
|
| 55 | 74 | // If project directory not provided, prompt for it |
|
| 56 | 75 | let projectName = projectDirectory; |
|
| 127 | 146 | const pkgJson = await fs.readJson(pkgJsonPath); |
|
| 128 | 147 | pkgJson.name = projectName; |
|
| 129 | 148 | await fs.writeJson(pkgJsonPath, pkgJson, { spaces: 2 }); |
|
| 130 | - | console.log(chalk.blue('Updated package.json with project name')); |
|
| 131 | 149 | } |
|
| 132 | 150 | ||
| 133 | 151 | // Remove the .git directory if it exists |
|
| 1 | 1 | { |
|
| 2 | 2 | "name": "create-bhvr", |
|
| 3 | - | "version": "0.0.5", |
|
| 3 | + | "version": "0.1.0", |
|
| 4 | 4 | "description": "Create a new bhvr monorepo starter project", |
|
| 5 | 5 | "main": "index.js", |
|
| 6 | 6 | "type": "module", |
|
| 28 | 28 | "dependencies": { |
|
| 29 | 29 | "chalk": "^5.3.0", |
|
| 30 | 30 | "commander": "^11.1.0", |
|
| 31 | + | "degit": "^2.8.4", |
|
| 32 | + | "execa": "^7.1.1", |
|
| 33 | + | "figlet": "^1.8.1", |
|
| 31 | 34 | "fs-extra": "^11.2.0", |
|
| 32 | - | "prompts": "^2.4.2", |
|
| 33 | - | "degit": "^2.8.4", |
|
| 34 | 35 | "ora": "^6.3.1", |
|
| 35 | - | "execa": "^7.1.1" |
|
| 36 | + | "prompts": "^2.4.2" |
|
| 36 | 37 | }, |
|
| 37 | 38 | "engines": { |
|
| 38 | 39 | "node": ">=14.16" |
|