vite-shadcn-ui-cli 1.0.4 → 1.0.5

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.
@@ -1,14 +1,18 @@
1
1
  #!/usr/bin/env node
2
- const { execSync } = require('child_process');
3
- const { Command } = require('commander');
4
- const simpleGit = require('simple-git');
5
-
6
- const chalk = require('chalk');
7
- const ora = require('ora');
8
- const path = require('path');
9
- const fs = require('fs');
2
+ import { execSync } from 'child_process';
3
+ import simpleGit from 'simple-git';
4
+ import { Command } from 'commander';
5
+ import chalk from 'chalk';
6
+ import ora from 'ora';
7
+ import path from 'path';
8
+ import fs from 'fs';
9
+ import { createRequire } from 'module';
10
+
11
+ // 因为 ES 模块中无法直接使用 require,使用 createRequire 读取 package.json
12
+ const require = createRequire(import.meta.url);
10
13
  const { version } = require('./package.json');
11
14
 
15
+ // 初始化 Commander
12
16
  const program = new Command();
13
17
  const git = simpleGit();
14
18
 
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "vite-shadcn-ui-cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "A CLI tool to bootstrap Vite projects with shadcn UI components",
5
- "main": "index.cjs",
5
+ "main": "index.js",
6
6
  "bin": {
7
- "create-vite-shadcn-ui": "./index.cjs"
7
+ "create-vite-shadcn-ui": "./index.js"
8
8
  },
9
+ "type":"module",
9
10
  "scripts": {
10
11
  "dev": "vite",
11
12
  "build": "tsc -b && vite build",