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