vite-shadcn-ui-cli 1.0.0 → 1.0.2
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/README.md +24 -43
- package/index.js +45 -0
- package/package.json +1 -1
package/README.md
CHANGED
@@ -1,52 +1,33 @@
|
|
1
|
-
#
|
1
|
+
# vite-shadcn-ui-cli
|
2
2
|
|
3
|
-
|
3
|
+
A CLI tool to bootstrap Vite projects with ShadCN UI components.
|
4
4
|
|
5
|
-
|
5
|
+
## Installation
|
6
6
|
|
7
|
-
|
8
|
-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
7
|
+
You can install the CLI globally using npm:
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
```sh
|
10
|
+
npm install -g vite-shadcn-ui-cli
|
11
|
+
vite-shadcn-ui my-project
|
12
|
+
```
|
13
13
|
|
14
|
-
|
14
|
+
## Example:
|
15
15
|
|
16
|
-
```
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
parserOptions: {
|
21
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
22
|
-
tsconfigRootDir: import.meta.dirname,
|
23
|
-
},
|
24
|
-
},
|
25
|
-
})
|
16
|
+
```sh
|
17
|
+
vite-shadcn-ui my-app
|
18
|
+
cd my-app
|
19
|
+
npm run dev
|
26
20
|
```
|
27
21
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
settings: { react: { version: '18.3' } },
|
39
|
-
plugins: {
|
40
|
-
// Add the react plugin
|
41
|
-
react,
|
42
|
-
},
|
43
|
-
rules: {
|
44
|
-
// other rules...
|
45
|
-
// Enable its recommended rules
|
46
|
-
...react.configs.recommended.rules,
|
47
|
-
...react.configs['jsx-runtime'].rules,
|
48
|
-
},
|
49
|
-
})
|
50
|
-
```
|
22
|
+
This will create a new Vite project with ShadCN UI components installed.
|
23
|
+
|
24
|
+
# Features
|
25
|
+
|
26
|
+
- Vite
|
27
|
+
- ShadCN UI
|
28
|
+
- TypeScript
|
29
|
+
- Tailwind CSS
|
30
|
+
|
31
|
+
# License
|
51
32
|
|
52
|
-
|
33
|
+
MIT © KYRIE668
|
package/index.js
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
|
3
|
+
const { Command } = require('commander');
|
4
|
+
const simpleGit = require('simple-git');
|
5
|
+
const chalk = require('chalk');
|
6
|
+
const ora = require('ora');
|
7
|
+
const path = require('path');
|
8
|
+
const fs = require('fs');
|
9
|
+
|
10
|
+
const program = new Command();
|
11
|
+
const git = simpleGit();
|
12
|
+
|
13
|
+
program
|
14
|
+
.name('vite-shadcn-ui')
|
15
|
+
.description('Bootstrap a Vite project with shadcn UI components')
|
16
|
+
.version('1.0.0');
|
17
|
+
|
18
|
+
program
|
19
|
+
.argument('<project-directory>', 'Directory to create your new project')
|
20
|
+
.action(async (dir) => {
|
21
|
+
const repoUrl = 'https://github.com/kyrie668/vite-shadcn-ui.git';
|
22
|
+
const projectPath = path.resolve(process.cwd(), dir);
|
23
|
+
|
24
|
+
if (fs.existsSync(projectPath)) {
|
25
|
+
console.log(chalk.red(`Error: Directory "${dir}" already exists.`));
|
26
|
+
process.exit(1);
|
27
|
+
}
|
28
|
+
|
29
|
+
const spinner = ora(`Cloning ${repoUrl} into ${dir}`).start();
|
30
|
+
|
31
|
+
try {
|
32
|
+
await git.clone(repoUrl, projectPath);
|
33
|
+
spinner.succeed(`Project cloned successfully into ${dir}`);
|
34
|
+
|
35
|
+
console.log(chalk.green(`\nNext steps:`));
|
36
|
+
console.log(` cd ${dir}`);
|
37
|
+
console.log(` npm install`);
|
38
|
+
console.log(` npm run dev\n`);
|
39
|
+
} catch (error) {
|
40
|
+
spinner.fail('Failed to clone the repository.');
|
41
|
+
console.error(chalk.red(error));
|
42
|
+
}
|
43
|
+
});
|
44
|
+
|
45
|
+
program.parse();
|