create-czanix-app 1.0.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.
Files changed (2) hide show
  1. package/index.js +134 -0
  2. package/package.json +23 -0
package/index.js ADDED
@@ -0,0 +1,134 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { input, select, confirm } from '@inquirer/prompts';
4
+ import chalk from 'chalk';
5
+ import { Command } from 'commander';
6
+ import shell from 'shelljs';
7
+ import ora from 'ora';
8
+ import fs from 'fs';
9
+ import path from 'path';
10
+
11
+ const program = new Command();
12
+
13
+ const REPOS = {
14
+ backend: {
15
+ 'Node.js / Express': 'https://github.com/czanix/boilerplate-api-node.git',
16
+ 'Python / FastAPI': 'https://github.com/czanix/boilerplate-api-python.git',
17
+ 'C# / .NET 10': 'https://github.com/czanix/boilerplate-api-csharp.git',
18
+ 'Java / Spring Boot': 'https://github.com/czanix/boilerplate-api-java.git',
19
+ 'Go / Gin': 'https://github.com/czanix/boilerplate-api-go.git',
20
+ 'Rust / Axum': 'https://github.com/czanix/boilerplate-api-rust.git',
21
+ 'Elixir / Phoenix (Real-time/WebSockets) [Novo]': 'https://github.com/czanix/boilerplate-api-elixir.git'
22
+ },
23
+ frontend: {
24
+ 'React 19': 'https://github.com/czanix/boilerplate-frontend-react.git',
25
+ 'Next.js 15': 'https://github.com/czanix/boilerplate-frontend-nextjs.git',
26
+ 'Vue 3.5': 'https://github.com/czanix/boilerplate-frontend-vue.git',
27
+ 'Angular 19': 'https://github.com/czanix/boilerplate-frontend-angular.git',
28
+ 'SvelteKit (High-Performance SEO) [Novo]': 'https://github.com/czanix/boilerplate-frontend-svelte.git'
29
+ },
30
+ mobile: {
31
+ 'Flutter': 'https://github.com/czanix/boilerplate-flutter.git',
32
+ 'React Native / Expo [Novo]': 'https://github.com/czanix/boilerplate-expo.git'
33
+ },
34
+ data_ai: {
35
+ 'AI RAG Pipeline (Vertex/pgvector)': 'https://github.com/czanix/boilerplate-ai-rag.git',
36
+ 'Modern Data Stack (dbt + BigQuery) [Novo]': 'https://github.com/czanix/boilerplate-data-dbt.git'
37
+ }
38
+ };
39
+
40
+ async function run() {
41
+ console.log(chalk.bold.hex('#0070F3')(`
42
+ ██████╗███████╗ █████╗ ███╗ ██╗██╗██╗ ██╗
43
+ ██╔════╝╚══███╔╝██╔══██╗████╗ ██║██║╚██╗██╔╝
44
+ ██║ ███╔╝ ███████║██╔██╗ ██║██║ ╚███╔╝
45
+ ██║ ███╔╝ ██╔══██║██║╚██╗██║██║ ██╔██╗
46
+ ╚██████╗███████╗██║ ██║██║ ╚████║██║██╔╝ ██╗
47
+ ╚═════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝
48
+ `));
49
+ console.log(chalk.gray(' Engineering standards for the top 0.01%\n'));
50
+
51
+ // Ensure git is installed
52
+ if (!shell.which('git')) {
53
+ console.log(chalk.red('❌ Git is required to use this CLI.'));
54
+ process.exit(1);
55
+ }
56
+
57
+ // 1. Project Name
58
+ const projectName = await input({
59
+ message: 'What is your project named?',
60
+ default: 'czanix-app',
61
+ validate: (val) => val.trim().length > 0 ? true : 'Project name cannot be empty'
62
+ });
63
+
64
+ if (fs.existsSync(projectName)) {
65
+ console.log(chalk.red(`\n❌ Directory "${projectName}" already exists.`));
66
+ process.exit(1);
67
+ }
68
+
69
+ // 2. Project Type
70
+ const projectType = await select({
71
+ message: 'What do you want to build?',
72
+ choices: [
73
+ { name: 'Backend API', value: 'backend' },
74
+ { name: 'Frontend Web App', value: 'frontend' },
75
+ { name: 'Mobile App', value: 'mobile' },
76
+ { name: 'Data Engineering & AI', value: 'data_ai' }
77
+ ]
78
+ });
79
+
80
+ // 3. Framework Selection
81
+ const choices = Object.keys(REPOS[projectType]).map(k => ({ name: k, value: k }));
82
+ const framework = await select({
83
+ message: 'Which technology stack?',
84
+ choices: choices
85
+ });
86
+
87
+ const repoUrl = REPOS[projectType][framework];
88
+
89
+ // 4. Olympus Tier Check
90
+ const wantsOlympus = await confirm({
91
+ message: 'Include Olympus Tier? (DevContainers, K6 Load Tests, Jaeger Tracing)',
92
+ default: true
93
+ });
94
+
95
+ console.log('');
96
+ const spinner = ora('Scaffolding standard architecture...').start();
97
+
98
+ // Clone repository
99
+ const cloneResult = shell.exec(`git clone --depth 1 ${repoUrl} ${projectName}`, { silent: true });
100
+
101
+ if (cloneResult.code !== 0) {
102
+ spinner.fail(chalk.red('Failed to clone boilerplate.'));
103
+ console.error(cloneResult.stderr);
104
+ process.exit(1);
105
+ }
106
+
107
+ // Remove original .git directory to start fresh
108
+ shell.rm('-rf', path.join(projectName, '.git'));
109
+
110
+ // Initialize new git repo
111
+ shell.cd(projectName);
112
+ shell.exec('git init', { silent: true });
113
+ shell.exec('git add .', { silent: true });
114
+ shell.exec('git commit -m "Initial commit from create-czanix-app"', { silent: true });
115
+
116
+ spinner.succeed(chalk.green('Foundation cloned successfully.'));
117
+
118
+ // Show completion steps
119
+ console.log('\n' + chalk.bold.white('Next steps:'));
120
+ console.log(chalk.cyan(` cd ${projectName}`));
121
+
122
+ if (wantsOlympus) {
123
+ console.log(chalk.cyan(' code . ' + chalk.gray('# (VS Code will prompt to reopen in DevContainer)')));
124
+ } else {
125
+ console.log(chalk.cyan(' docker-compose up -d'));
126
+ }
127
+
128
+ console.log('\n' + chalk.bold.hex('#0070F3')('Welcome to the Top 0.01%.') + '\n');
129
+ }
130
+
131
+ run().catch((err) => {
132
+ console.error(chalk.red('\nAn error occurred:'), err);
133
+ process.exit(1);
134
+ });
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "create-czanix-app",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "MIT",
12
+ "type": "module",
13
+ "bin": {
14
+ "create-czanix-app": "index.js"
15
+ },
16
+ "dependencies": {
17
+ "@inquirer/prompts": "^8.4.3",
18
+ "chalk": "^5.6.2",
19
+ "commander": "^14.0.3",
20
+ "ora": "^9.4.0",
21
+ "shelljs": "^0.10.0"
22
+ }
23
+ }