|
1 | | -import { readFileSync, writeFileSync, mkdirSync, readdirSync, statSync } from 'fs'; |
| 1 | +import { readFileSync, writeFileSync, mkdirSync, readdirSync, statSync, existsSync } from 'fs'; |
2 | 2 | import { join } from 'path'; |
3 | 3 | import chalk from 'chalk'; |
4 | 4 | import * as yaml from 'js-yaml'; |
@@ -295,27 +295,35 @@ export default { |
295 | 295 |
|
296 | 296 | writeFileSync(join(tmpDir, 'postcss.config.js'), postcssConfig); |
297 | 297 |
|
| 298 | + const cwd = process.cwd(); |
| 299 | + const isMonorepo = existsSync(join(cwd, 'pnpm-workspace.yaml')); |
| 300 | + |
298 | 301 | // Create package.json |
| 302 | + const baseDependencies = { |
| 303 | + react: '^18.3.1', |
| 304 | + 'react-dom': '^18.3.1', |
| 305 | + '@object-ui/react': '^0.1.0', |
| 306 | + '@object-ui/components': '^0.1.0', |
| 307 | + }; |
| 308 | + |
| 309 | + const baseDevDependencies = { |
| 310 | + '@types/react': '^18.3.12', |
| 311 | + '@types/react-dom': '^18.3.1', |
| 312 | + '@vitejs/plugin-react': '^4.2.1', |
| 313 | + autoprefixer: '^10.4.23', |
| 314 | + postcss: '^8.5.6', |
| 315 | + tailwindcss: '^3.4.19', |
| 316 | + typescript: '~5.7.3', |
| 317 | + vite: '^5.0.0', |
| 318 | + }; |
| 319 | + |
299 | 320 | const packageJson = { |
300 | 321 | name: 'objectui-temp-app', |
301 | 322 | private: true, |
302 | 323 | type: 'module', |
303 | | - dependencies: { |
304 | | - react: '^18.3.1', |
305 | | - 'react-dom': '^18.3.1', |
306 | | - '@object-ui/react': '^0.1.0', |
307 | | - '@object-ui/components': '^0.1.0', |
308 | | - }, |
309 | | - devDependencies: { |
310 | | - '@types/react': '^18.3.12', |
311 | | - '@types/react-dom': '^18.3.1', |
312 | | - '@vitejs/plugin-react': '^4.2.1', |
313 | | - autoprefixer: '^10.4.23', |
314 | | - postcss: '^8.5.6', |
315 | | - tailwindcss: '^3.4.19', |
316 | | - typescript: '~5.7.3', |
317 | | - vite: '^5.0.0', |
318 | | - }, |
| 324 | + // In monorepo, we use root node_modules, so we don't need dependencies here |
| 325 | + dependencies: isMonorepo ? {} : baseDependencies, |
| 326 | + devDependencies: isMonorepo ? {} : baseDevDependencies, |
319 | 327 | }; |
320 | 328 |
|
321 | 329 | writeFileSync(join(tmpDir, 'package.json'), JSON.stringify(packageJson, null, 2)); |
|
0 commit comments