myoperator-ui 0.0.5 → 0.0.7

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 +22 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -354,7 +354,8 @@ var CSS_VARIABLES_V4 = `@import "tailwindcss";
354
354
  --ring: 212.7 26.8% 83.9%;
355
355
  }
356
356
  `;
357
- var CSS_VARIABLES_V4_PREFIXED = `@import "tailwindcss/utilities" layer(utilities);
357
+ var CSS_VARIABLES_V4_PREFIXED = `@import "tailwindcss/theme" layer(theme);
358
+ @import "tailwindcss/utilities" layer(utilities);
358
359
 
359
360
  @theme {
360
361
  --color-background: hsl(0 0% 100%);
@@ -592,6 +593,17 @@ async function init() {
592
593
  process.exit(0);
593
594
  }
594
595
  }
596
+ const packageJsonPath = path2.join(cwd, "package.json");
597
+ let hasBootstrap = false;
598
+ let isESM = false;
599
+ if (await fs2.pathExists(packageJsonPath)) {
600
+ const packageJson = await fs2.readJson(packageJsonPath);
601
+ hasBootstrap = !!(packageJson.dependencies?.bootstrap || packageJson.devDependencies?.bootstrap);
602
+ isESM = packageJson.type === "module";
603
+ if (hasBootstrap) {
604
+ console.log(chalk2.blue(" \u2139 Bootstrap detected - will configure Tailwind to avoid conflicts\n"));
605
+ }
606
+ }
595
607
  const response = await prompts2([
596
608
  {
597
609
  type: "select",
@@ -607,7 +619,8 @@ async function init() {
607
619
  type: "confirm",
608
620
  name: "usePrefix",
609
621
  message: "Use a prefix for Tailwind classes? (recommended if using Bootstrap/other CSS frameworks)",
610
- initial: false
622
+ initial: hasBootstrap
623
+ // Auto-set to true if Bootstrap detected
611
624
  },
612
625
  {
613
626
  type: (prev) => prev ? "text" : null,
@@ -676,7 +689,7 @@ export function cn(...inputs: ClassValue[]) {
676
689
  const globalCssPath = path2.join(cwd, response.globalCss);
677
690
  let cssContent;
678
691
  if (response.tailwindVersion === "v4") {
679
- cssContent = prefix ? CSS_VARIABLES_V4_PREFIXED : CSS_VARIABLES_V4;
692
+ cssContent = prefix || hasBootstrap ? CSS_VARIABLES_V4_PREFIXED : CSS_VARIABLES_V4;
680
693
  } else {
681
694
  cssContent = CSS_VARIABLES_V3;
682
695
  }
@@ -727,7 +740,12 @@ export function cn(...inputs: ClassValue[]) {
727
740
  }
728
741
  }
729
742
  const postcssConfigPath = path2.join(cwd, "postcss.config.js");
730
- const postcssConfigContent = `export default {
743
+ const postcssConfigContent = isESM ? `export default {
744
+ plugins: {
745
+ '@tailwindcss/postcss': {},
746
+ },
747
+ }
748
+ ` : `module.exports = {
731
749
  plugins: {
732
750
  '@tailwindcss/postcss': {},
733
751
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myoperator-ui",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "CLI for adding myOperator UI components to your project",
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",