bunkit-cli 1.1.1 → 1.1.3

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 (2) hide show
  1. package/dist/index.js +89 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -25024,8 +25024,7 @@ async function setupVSCodeDebug(projectPath, context, preset = "api") {
25024
25024
  const extensions = {
25025
25025
  recommendations: [
25026
25026
  "oven.bun-vscode",
25027
- "biomejs.biome",
25028
- "dbaeumer.vscode-eslint"
25027
+ "biomejs.biome"
25029
25028
  ]
25030
25029
  };
25031
25030
  await writeFile(join(vscodePath, "extensions.json"), JSON.stringify(extensions, null, 2));
@@ -26323,7 +26322,9 @@ var themes = {
26323
26322
  function generateThemeCSS(theme, customRadius) {
26324
26323
  const radius = customRadius || theme.light.radius;
26325
26324
  return `@import "tailwindcss";
26326
- @import "tw-animate-css";
26325
+ @source "../../../apps/**/*.{ts,tsx}";
26326
+ @source "../../../components/**/*.{ts,tsx}";
26327
+ @source "../**/*.{ts,tsx}";
26327
26328
 
26328
26329
  :root {
26329
26330
  --radius: ${radius};
@@ -26958,7 +26959,8 @@ async function setupShadcnMonorepo(projectPath, context) {
26958
26959
  "./components/*": "./src/components/ui/*/index.ts",
26959
26960
  "./lib/utils": "./src/lib/utils.ts",
26960
26961
  "./hooks": "./src/hooks/index.ts",
26961
- "./styles": "./src/styles/globals.css",
26962
+ "./globals.css": "./src/styles/globals.css",
26963
+ "./postcss.config": "./postcss.config.mjs",
26962
26964
  "./components/ui/*": "./src/components/ui/*/index.ts"
26963
26965
  },
26964
26966
  dependencies: {
@@ -26966,7 +26968,9 @@ async function setupShadcnMonorepo(projectPath, context) {
26966
26968
  "class-variance-authority": "catalog:",
26967
26969
  clsx: "catalog:",
26968
26970
  "tailwind-merge": "catalog:",
26969
- "lucide-react": "catalog:"
26971
+ "lucide-react": "catalog:",
26972
+ tailwindcss: "catalog:",
26973
+ "@tailwindcss/postcss": "catalog:"
26970
26974
  },
26971
26975
  devDependencies: {
26972
26976
  "@types/react": "catalog:",
@@ -27032,6 +27036,16 @@ export * from './hooks';
27032
27036
  const theme = themes[baseColor] || themes.zinc;
27033
27037
  const uiGlobalsCss = generateThemeCSS(theme, radius);
27034
27038
  await writeFile(join(projectPath, "packages/ui/src/styles/globals.css"), uiGlobalsCss);
27039
+ const uiPostcssConfig = `/** @type {import('postcss-load-config').Config} */
27040
+ const config = {
27041
+ plugins: {
27042
+ '@tailwindcss/postcss': {},
27043
+ },
27044
+ };
27045
+
27046
+ export default config;
27047
+ `;
27048
+ await writeFile(join(projectPath, "packages/ui/postcss.config.mjs"), uiPostcssConfig);
27035
27049
  const uiTsconfig = {
27036
27050
  compilerOptions: {
27037
27051
  target: "ES2017",
@@ -27083,10 +27097,77 @@ export * from './hooks';
27083
27097
  }
27084
27098
  };
27085
27099
  await writeFile(join(appPath, "components.json"), JSON.stringify(appComponentsJson, null, 2));
27086
- const globalsCssPath = join(appPath, "src/app/globals.css");
27087
- const globalsCss = `@import "../../../packages/ui/src/styles/globals.css";
27100
+ const layoutPath = join(appPath, "src/app/layout.tsx");
27101
+ if (await fileExists(layoutPath)) {
27102
+ let layoutContent = await Bun.file(layoutPath).text();
27103
+ layoutContent = layoutContent.replace(/import\s+['"]\.\/globals\.css['"];?\s*\n?/g, "");
27104
+ if (!layoutContent.includes(`${uiPackageName}/globals.css`) && !layoutContent.includes("@workspace/ui/globals.css")) {
27105
+ const importMatch = layoutContent.match(/^(import\s+.*?from\s+['"].*?['"];?\s*\n)/m);
27106
+ if (importMatch) {
27107
+ layoutContent = layoutContent.replace(/^(import\s+.*?from\s+['"].*?['"];?\s*\n)/m, `$1import '${uiPackageName}/globals.css'
27108
+ `);
27109
+ } else {
27110
+ layoutContent = `import '${uiPackageName}/globals.css'
27111
+ ${layoutContent}`;
27112
+ }
27113
+ await writeFile(layoutPath, layoutContent);
27114
+ }
27115
+ } else {
27116
+ const layoutContent = `import type { Metadata } from 'next'
27117
+ import '${uiPackageName}/globals.css'
27118
+
27119
+ export const metadata: Metadata = {
27120
+ title: '${appName}',
27121
+ description: 'Built with bunkit',
27122
+ }
27123
+
27124
+ export default function RootLayout({
27125
+ children,
27126
+ }: {
27127
+ children: React.ReactNode
27128
+ }) {
27129
+ return (
27130
+ <html lang="en">
27131
+ <body>{children}</body>
27132
+ </html>
27133
+ )
27134
+ }
27088
27135
  `;
27089
- await writeFile(globalsCssPath, globalsCss);
27136
+ await writeFile(layoutPath, layoutContent);
27137
+ }
27138
+ const postcssConfigPath = join(appPath, "postcss.config.mjs");
27139
+ const postcssConfig = `export { default } from '${uiPackageName}/postcss.config';
27140
+ `;
27141
+ await writeFile(postcssConfigPath, postcssConfig);
27142
+ const nextConfigPath = join(appPath, "next.config.ts");
27143
+ let nextConfigContent = "";
27144
+ if (await fileExists(nextConfigPath)) {
27145
+ nextConfigContent = await Bun.file(nextConfigPath).text();
27146
+ } else {
27147
+ nextConfigContent = `import type { NextConfig } from 'next';
27148
+
27149
+ const nextConfig: NextConfig = {
27150
+ /* config options here */
27151
+ };
27152
+
27153
+ export default nextConfig;
27154
+ `;
27155
+ }
27156
+ if (!nextConfigContent.includes("transpilePackages")) {
27157
+ if (nextConfigPath.endsWith(".ts")) {
27158
+ nextConfigContent = nextConfigContent.replace(/(const nextConfig: NextConfig = \{)/, `$1
27159
+ transpilePackages: ['${uiPackageName}'],`);
27160
+ } else {
27161
+ nextConfigContent = nextConfigContent.replace(/(const nextConfig = \{)/, `$1
27162
+ transpilePackages: ['${uiPackageName}'],`);
27163
+ }
27164
+ await writeFile(nextConfigPath, nextConfigContent);
27165
+ }
27166
+ const localGlobalsCssPath = join(appPath, "src/app/globals.css");
27167
+ if (await fileExists(localGlobalsCssPath)) {
27168
+ const { unlink } = await import("fs/promises");
27169
+ await unlink(localGlobalsCssPath);
27170
+ }
27090
27171
  const packageJsonPath = join(appPath, "package.json");
27091
27172
  let packageJson = {};
27092
27173
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunkit-cli",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Beautiful CLI for creating production-ready Bun projects",
5
5
  "type": "module",
6
6
  "bin": {