@yusr_systems/cli 2.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.
- package/CHANGELOG.md +7 -0
- package/index.js +85 -0
- package/package.json +32 -0
package/CHANGELOG.md
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { program } = require('commander');
|
|
4
|
+
const execa = require('execa');
|
|
5
|
+
const fs = require('fs-extra');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const chalk = require('chalk');
|
|
8
|
+
const inquirer = require('inquirer');
|
|
9
|
+
|
|
10
|
+
program
|
|
11
|
+
.version('1.0.0')
|
|
12
|
+
.description('Yusr Systems Project Initializer');
|
|
13
|
+
|
|
14
|
+
program
|
|
15
|
+
.command('create')
|
|
16
|
+
.description('Create a new project with Yusr Systems')
|
|
17
|
+
.action(async () => {
|
|
18
|
+
try {
|
|
19
|
+
const answers = await inquirer.prompt([
|
|
20
|
+
{
|
|
21
|
+
type: 'input',
|
|
22
|
+
name: 'projectName',
|
|
23
|
+
message: 'What is your project name?',
|
|
24
|
+
default: 'my-yusr-app',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'list',
|
|
28
|
+
name: 'framework',
|
|
29
|
+
message: 'Which framework would you like to use?',
|
|
30
|
+
choices: ['Next.js', 'Vite (React)'],
|
|
31
|
+
},
|
|
32
|
+
]);
|
|
33
|
+
|
|
34
|
+
const { projectName, framework } = answers;
|
|
35
|
+
const projectPath = path.join(process.cwd(), projectName);
|
|
36
|
+
|
|
37
|
+
console.log(chalk.blue.bold(`\n🚀 Creating ${framework} project: ${projectName}...`));
|
|
38
|
+
|
|
39
|
+
if (framework === 'Next.js') {
|
|
40
|
+
console.log(chalk.yellow('📦 Bootstrapping Next.js...'));
|
|
41
|
+
await execa('npx', ['create-next-app@latest', projectName, '--ts', '--tailwind', '--eslint', '--app', '--src-dir', 'false', '--import-alias', '@/*'], { stdio: 'inherit' });
|
|
42
|
+
} else {
|
|
43
|
+
console.log(chalk.yellow('📦 Bootstrapping Vite...'));
|
|
44
|
+
await execa('npm', ['create', 'vite@latest', projectName, '--', '--template', 'react-ts'], { stdio: 'inherit' });
|
|
45
|
+
|
|
46
|
+
console.log(chalk.yellow('📦 Installing base Vite dependencies...'));
|
|
47
|
+
await execa('npm', ['install'], { cwd: projectPath, stdio: 'inherit' });
|
|
48
|
+
|
|
49
|
+
// Vite needs Tailwind installed manually because it doesn't come built-in like Next.js
|
|
50
|
+
console.log(chalk.yellow('📦 Adding Tailwind CSS to Vite...'));
|
|
51
|
+
await execa('npm', ['install', '-D', 'tailwindcss', 'postcss', 'autoprefixer'], { cwd: projectPath, stdio: 'inherit' });
|
|
52
|
+
await execa('npx', ['tailwindcss', 'init', '-p'], { cwd: projectPath, stdio: 'inherit' });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
console.log(chalk.yellow('\n📦 Installing @yusr_systems packages...'));
|
|
56
|
+
await execa('npm', ['install', '@yusr_systems/ui', '@yusr_systems/core'], { cwd: projectPath, stdio: 'inherit' });
|
|
57
|
+
|
|
58
|
+
console.log(chalk.yellow('\n🎨 Setting up shadcn/ui...'));
|
|
59
|
+
await execa('npx', ['shadcn-ui@latest', 'init', '-y'], { cwd: projectPath, stdio: 'inherit' });
|
|
60
|
+
|
|
61
|
+
console.log(chalk.yellow('\n🛠️ Applying Yusr Custom Styles...'));
|
|
62
|
+
const customCss = `
|
|
63
|
+
@tailwind base;
|
|
64
|
+
@tailwind components;
|
|
65
|
+
@tailwind utilities;
|
|
66
|
+
:root { --yusr-primary: 200 100% 50%; }
|
|
67
|
+
body { background: white; color: black; }
|
|
68
|
+
`;
|
|
69
|
+
|
|
70
|
+
const cssPath = framework === 'Next.js'
|
|
71
|
+
? path.join(projectPath, 'app/globals.css')
|
|
72
|
+
: path.join(projectPath, 'src/index.css');
|
|
73
|
+
|
|
74
|
+
await fs.writeFile(cssPath, customCss);
|
|
75
|
+
|
|
76
|
+
console.log(chalk.green.bold(`\n✨ Success! Your ${framework} project is ready.`));
|
|
77
|
+
console.log(chalk.cyan(`\nRun these commands to start:\n cd ${projectName}\n npm run dev`));
|
|
78
|
+
|
|
79
|
+
} catch (error) {
|
|
80
|
+
console.error(chalk.red('\n❌ Error:'), error.message);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
program.parse(process.argv);
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@yusr_systems/cli",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "CLI to initialize Yusr Systems environment",
|
|
5
|
+
"private": false,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public",
|
|
9
|
+
"registry": "https://registry.npmjs.org/"
|
|
10
|
+
},
|
|
11
|
+
"main": "index.js",
|
|
12
|
+
"bin": {
|
|
13
|
+
"yusr-init": "./index.js"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"yusr",
|
|
20
|
+
"ui",
|
|
21
|
+
"cli"
|
|
22
|
+
],
|
|
23
|
+
"author": "Your Name",
|
|
24
|
+
"license": "ISC",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"chalk": "^4.1.2",
|
|
27
|
+
"commander": "^11.0.0",
|
|
28
|
+
"execa": "^5.1.1",
|
|
29
|
+
"fs-extra": "^11.1.1",
|
|
30
|
+
"inquirer": "^8.2.7"
|
|
31
|
+
}
|
|
32
|
+
}
|