create-react-folder-structure 1.0.0 → 1.0.1

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 (3) hide show
  1. package/README.md +1 -0
  2. package/bin/cli.js +15 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -39,6 +39,7 @@ src/
39
39
  ├── components/
40
40
  │ ├── shared/ # Business-specific shared components
41
41
  │ └── ui/ # Where shadcn places button.tsx, dialog.tsx, etc.
42
+ ├── config/ # App configuration, theme tokens, environment setup
42
43
  ├── layouts/ # Layout containers (Sidebar, Header, MainLayout)
43
44
  ├── pages/ # Clean, empty pages folder
44
45
  ├── routes/ # Routing configs
package/bin/cli.js CHANGED
@@ -72,11 +72,10 @@ const nonFlagArgs = rawArgs.filter((arg) => !arg.startsWith('-'));
72
72
  const projectName = nonFlagArgs[0];
73
73
 
74
74
  let targetProjectDir = cwd;
75
+ let runCwd = cwd;
76
+
75
77
  if (projectName && projectName !== '.') {
76
78
  targetProjectDir = path.resolve(cwd, projectName);
77
- if (!fs.existsSync(targetProjectDir)) {
78
- fs.mkdirSync(targetProjectDir, { recursive: true });
79
- }
80
79
  }
81
80
 
82
81
  const hasPackageJson = fs.existsSync(path.join(targetProjectDir, 'package.json'));
@@ -97,8 +96,18 @@ if (shouldInitShadcn) {
97
96
 
98
97
  const shadcnArgs = ['-y', 'shadcn@latest', 'init', '--preset', 'b0', '--template', 'vite', '-y'];
99
98
 
99
+ if (projectName && projectName !== '.') {
100
+ // Pass --name directly so shadcn creates the folder without asking for project name
101
+ shadcnArgs.push('--name', projectName);
102
+ runCwd = cwd;
103
+ } else {
104
+ // Use current directory directly without creating nested folders
105
+ shadcnArgs.push('--cwd', '.');
106
+ runCwd = targetProjectDir;
107
+ }
108
+
100
109
  const initResult = spawnSync('npx', shadcnArgs, {
101
- cwd: targetProjectDir,
110
+ cwd: runCwd,
102
111
  stdio: 'inherit',
103
112
  shell: true,
104
113
  });
@@ -130,6 +139,7 @@ if (fs.existsSync(srcDir)) {
130
139
 
131
140
  const standardFolders = [
132
141
  'components/shared',
142
+ 'config',
133
143
  'layouts',
134
144
  'pages',
135
145
  'routes',
@@ -144,6 +154,7 @@ const standardFolders = [
144
154
 
145
155
  const minimalFolders = [
146
156
  'components',
157
+ 'config',
147
158
  'pages',
148
159
  'hooks',
149
160
  'services',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-react-folder-structure",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "CLI to scaffold a clean, production-ready React folder structure with zero component clutter",
5
5
  "main": "bin/cli.js",
6
6
  "type": "module",