@cometchat/skills-cli 2.0.1 → 2.0.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.
package/dist/index.js CHANGED
@@ -170,9 +170,24 @@ function detectReactjs(root, deps) {
170
170
  bundler: isVite ? "vite" : isCra ? "webpack" : "vite",
171
171
  // default to vite for ambiguous
172
172
  ssr_strategy: "spa-no-ssr",
173
- env_prefix: isVite ? "VITE_" : isCra ? "REACT_APP_" : "VITE_"
173
+ env_prefix: isVite ? "VITE_" : isCra ? "REACT_APP_" : "VITE_",
174
+ uses_jsx: detectUsesJsx(root)
174
175
  };
175
176
  }
177
+ function detectUsesJsx(root) {
178
+ const indexHtml = readFileOrNull(p(root, "index.html"));
179
+ if (indexHtml) {
180
+ if (/src=["']\/?src\/main\.jsx["']/.test(indexHtml)) return true;
181
+ if (/src=["']\/?src\/main\.tsx["']/.test(indexHtml)) return false;
182
+ }
183
+ const hasJsxMain = pathExists(p(root, "src/main.jsx"));
184
+ const hasTsxMain = pathExists(p(root, "src/main.tsx"));
185
+ if (hasJsxMain && !hasTsxMain) return true;
186
+ const hasTsconfig = pathExists(p(root, "tsconfig.json"));
187
+ const hasJsxApp = pathExists(p(root, "src/App.jsx"));
188
+ if (!hasTsconfig && hasJsxApp) return true;
189
+ return false;
190
+ }
176
191
  function detectFramework(root) {
177
192
  const pkg = readJsonOrNull(p(root, "package.json"));
178
193
  if (!pkg) return EMPTY;
@@ -500,6 +515,7 @@ async function runDetectors(root) {
500
515
  bundler: fw.bundler,
501
516
  ssr_strategy: fw.ssr_strategy,
502
517
  env_prefix: fw.env_prefix,
518
+ uses_jsx: fw.uses_jsx,
503
519
  package_manager,
504
520
  credentials,
505
521
  existing_integration,
@@ -536,6 +552,9 @@ function printHumanReadable(r) {
536
552
  if (r.ssr_strategy !== null) lines.push(` SSR strategy: ${r.ssr_strategy}`);
537
553
  if (r.env_prefix !== null) lines.push(` Env var prefix: ${r.env_prefix}`);
538
554
  if (r.package_manager !== null) lines.push(` Package manager: ${r.package_manager}`);
555
+ if (r.uses_jsx === true) {
556
+ lines.push(` Source language: JavaScript (.jsx) \u2014 \u26A0 apply will refuse, the v6 templates are TypeScript-only`);
557
+ }
539
558
  lines.push("");
540
559
  lines.push(" Credentials:");
541
560
  lines.push(` Source: ${r.credentials.source}`);
@@ -1648,6 +1667,7 @@ async function apply(args) {
1648
1667
  let frameworkVersion = null;
1649
1668
  let credentialsSource = "none";
1650
1669
  let detectedRouter = null;
1670
+ let usesJsx = false;
1651
1671
  if (!framework) {
1652
1672
  const detected = await runDetectors(root);
1653
1673
  if (detected.framework === null) {
@@ -1662,15 +1682,44 @@ async function apply(args) {
1662
1682
  frameworkVersion = detected.framework_version;
1663
1683
  credentialsSource = detected.credentials.source;
1664
1684
  detectedRouter = detected.router ?? null;
1685
+ usesJsx = detected.uses_jsx === true;
1665
1686
  } else if (framework === "nextjs") {
1666
1687
  const detected = await runDetectors(root);
1667
1688
  detectedRouter = detected.router ?? null;
1668
1689
  if (!frameworkVersion) frameworkVersion = detected.framework_version;
1669
1690
  if (credentialsSource === "none") credentialsSource = detected.credentials.source;
1691
+ } else if (framework === "reactjs") {
1692
+ const detected = await runDetectors(root);
1693
+ usesJsx = detected.uses_jsx === true;
1694
+ if (!frameworkVersion) frameworkVersion = detected.framework_version;
1695
+ if (credentialsSource === "none") credentialsSource = detected.credentials.source;
1670
1696
  }
1671
1697
  if (!envPrefix) {
1672
1698
  envPrefix = framework === "nextjs" ? "NEXT_PUBLIC_" : framework === "astro" ? "PUBLIC_" : "VITE_";
1673
1699
  }
1700
+ if (framework === "reactjs" && usesJsx) {
1701
+ return errorOut(
1702
+ args,
1703
+ [
1704
+ "Error: This project uses JavaScript (.jsx) entry files. The CometChat React UI Kit v6 templates are TypeScript-only.",
1705
+ "",
1706
+ "Detected: src/main.jsx (or index.html references /src/main.jsx) and no tsconfig.json.",
1707
+ "",
1708
+ "Options:",
1709
+ " 1. Recreate the project as TypeScript (recommended for new projects):",
1710
+ " npm create vite@latest my-react-app -- --template react-ts",
1711
+ " 2. Convert this project to TypeScript first:",
1712
+ " - Add a tsconfig.json (see https://vite.dev/guide/features#typescript)",
1713
+ " - Rename src/main.jsx \u2192 src/main.tsx",
1714
+ " - Rename src/App.jsx \u2192 src/App.tsx",
1715
+ " - Update index.html to reference /src/main.tsx",
1716
+ " Then re-run `cometchat init`.",
1717
+ "",
1718
+ "JSX template variants ship in a future release. Tracking: v2.1."
1719
+ ].join("\n"),
1720
+ 1
1721
+ );
1722
+ }
1674
1723
  let manifestKey = framework;
1675
1724
  if (framework === "nextjs" && detectedRouter === "pages") {
1676
1725
  manifestKey = "nextjs-pages";
@@ -10,6 +10,7 @@
10
10
  overflow: hidden;
11
11
  display: flex;
12
12
  flex-direction: column;
13
+ flex-shrink: 0;
13
14
  }
14
15
 
15
16
  .conversations-wrapper > .cometchat {
@@ -17,7 +18,8 @@
17
18
  }
18
19
 
19
20
  .messages-wrapper {
20
- width: calc(100% - 480px);
21
+ flex: 1;
22
+ min-width: 0;
21
23
  height: 100%;
22
24
  display: flex;
23
25
  flex-direction: column;
@@ -37,3 +39,5 @@
37
39
  .cometchat .cometchat-message-composer {
38
40
  border-radius: 0;
39
41
  }
42
+
43
+ .side-component-wrapper { display: flex; width: 30%; max-width: 420px; flex-direction: column; flex-shrink: 0; background: var(--cometchat-background-color-01, #FFF); border-left: 1px solid var(--cometchat-border-color-light, #F5F5F5); height: 100%; overflow: hidden; }
@@ -10,6 +10,7 @@
10
10
  overflow: hidden;
11
11
  display: flex;
12
12
  flex-direction: column;
13
+ flex-shrink: 0;
13
14
  }
14
15
 
15
16
  .conversations-wrapper > .cometchat {
@@ -17,7 +18,8 @@
17
18
  }
18
19
 
19
20
  .messages-wrapper {
20
- width: calc(100% - 480px);
21
+ flex: 1;
22
+ min-width: 0;
21
23
  height: 100%;
22
24
  display: flex;
23
25
  flex-direction: column;
@@ -37,3 +39,5 @@
37
39
  .cometchat .cometchat-message-composer {
38
40
  border-radius: 0;
39
41
  }
42
+
43
+ .side-component-wrapper { display: flex; width: 30%; max-width: 420px; flex-direction: column; flex-shrink: 0; background: var(--cometchat-background-color-01, #FFF); border-left: 1px solid var(--cometchat-border-color-light, #F5F5F5); height: 100%; overflow: hidden; }
@@ -10,6 +10,7 @@
10
10
  overflow: hidden;
11
11
  display: flex;
12
12
  flex-direction: column;
13
+ flex-shrink: 0;
13
14
  }
14
15
 
15
16
  .conversations-wrapper > .cometchat {
@@ -17,7 +18,8 @@
17
18
  }
18
19
 
19
20
  .messages-wrapper {
20
- width: calc(100% - 480px);
21
+ flex: 1;
22
+ min-width: 0;
21
23
  height: 100%;
22
24
  display: flex;
23
25
  flex-direction: column;
@@ -37,3 +39,5 @@
37
39
  .cometchat .cometchat-message-composer {
38
40
  border-radius: 0;
39
41
  }
42
+
43
+ .side-component-wrapper { display: flex; width: 30%; max-width: 420px; flex-direction: column; flex-shrink: 0; background: var(--cometchat-background-color-01, #FFF); border-left: 1px solid var(--cometchat-border-color-light, #F5F5F5); height: 100%; overflow: hidden; }
@@ -10,6 +10,7 @@
10
10
  overflow: hidden;
11
11
  display: flex;
12
12
  flex-direction: column;
13
+ flex-shrink: 0;
13
14
  }
14
15
 
15
16
  .conversations-wrapper > .cometchat {
@@ -17,7 +18,8 @@
17
18
  }
18
19
 
19
20
  .messages-wrapper {
20
- width: calc(100% - 480px);
21
+ flex: 1;
22
+ min-width: 0;
21
23
  height: 100%;
22
24
  display: flex;
23
25
  flex-direction: column;
@@ -37,3 +39,5 @@
37
39
  .cometchat .cometchat-message-composer {
38
40
  border-radius: 0;
39
41
  }
42
+
43
+ .side-component-wrapper { display: flex; width: 30%; max-width: 420px; flex-direction: column; flex-shrink: 0; background: var(--cometchat-background-color-01, #FFF); border-left: 1px solid var(--cometchat-border-color-light, #F5F5F5); height: 100%; overflow: hidden; }
@@ -11,8 +11,14 @@
11
11
  * - #root → 100vh / 100vw (anchor the whole layout in the viewport)
12
12
  * - .conversations-with-messages → height: 100% from #root
13
13
  * - .conversations-wrapper → height: 100vh (fixed left panel)
14
- * - .messages-wrapper → height: 100% (right panel inherits from the
15
- * flex parent which has 100vh)
14
+ * - .messages-wrapper → flex: 1 (right panel fills remaining space,
15
+ * shrinks when side panels like details/search/
16
+ * threads open alongside it)
17
+ *
18
+ * The layout is side-panel-ready: adding a details panel, search panel, or
19
+ * thread panel alongside the messages wrapper will work without any CSS changes.
20
+ * The messages-wrapper uses flex: 1 + min-width: 0 so it shrinks automatically
21
+ * when a sibling side panel is added to the flex container.
16
22
  *
17
23
  * If you customize this layout, every container in the chain from <html> down to
18
24
  * the message list MUST have a resolved height. If you switch to inline styles or
@@ -25,8 +31,10 @@
25
31
  */
26
32
  #root { width: 100vw; height: 100vh; }
27
33
  .conversations-with-messages { display: flex; height: 100%; width: 100%; }
28
- .conversations-wrapper { height: 100vh; width: 480px; overflow: hidden; display: flex; flex-direction: column; }
34
+ .conversations-wrapper { height: 100vh; width: 480px; overflow: hidden; display: flex; flex-direction: column; flex-shrink: 0; }
29
35
  .conversations-wrapper > .cometchat { overflow: hidden; }
30
- .messages-wrapper { width: 100%; height: 100%; display: flex; flex-direction: column; }
36
+ .messages-wrapper { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; }
31
37
  .empty-conversation { height: 100vh; width: 100%; display: flex; justify-content: center; align-items: center; background: var(--cometchat-background-color-03, #F5F5F5); color: var(--cometchat-text-color-secondary, #727272); font: var(--cometchat-font-body-regular, 400 14px Roboto); }
32
38
  .cometchat .cometchat-message-composer { border-radius: 0; }
39
+ /* Side panel — used by details, search, threaded messages. Ready to use in Phase B. */
40
+ .side-component-wrapper { display: flex; width: 30%; max-width: 420px; flex-direction: column; flex-shrink: 0; background: var(--cometchat-background-color-01, #FFF); border-left: 1px solid var(--cometchat-border-color-light, #F5F5F5); height: 100%; overflow: hidden; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cometchat/skills-cli",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "CLI for the CometChat skills v2 architecture — detect, view, apply, verify CometChat integrations in React projects.",
5
5
  "type": "module",
6
6
  "license": "MIT",