gtx-cli 2.1.7 → 2.1.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # gtx-cli
2
2
 
3
+ ## 2.1.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [#594](https://github.com/generaltranslation/gt/pull/594) [`3fa9c41`](https://github.com/generaltranslation/gt/commit/3fa9c41e2e37933b04e6c3d6c0f94271a07d0ff6) Thanks [@brian-lou](https://github.com/brian-lou)! - Fix <GTProvider> wizard scan behavior
8
+
3
9
  ## 2.1.7
4
10
 
5
11
  ### Patch Changes
@@ -61,8 +61,22 @@ export async function wrapContentNext(options, pkg, errors, warnings) {
61
61
  if (pkg === 'gt-next' &&
62
62
  options.addGTProvider &&
63
63
  isHtmlElement(path.node.openingElement)) {
64
- // Find the body element in the HTML children
65
- const bodyElement = path.node.children.find((child) => t.isJSXElement(child) && isBodyElement(child.openingElement));
64
+ // Find the body element recursively in the HTML tree
65
+ const findBodyElement = (children) => {
66
+ for (const child of children) {
67
+ if (t.isJSXElement(child) &&
68
+ isBodyElement(child.openingElement)) {
69
+ return child;
70
+ }
71
+ if (t.isJSXElement(child)) {
72
+ const bodyInChild = findBodyElement(child.children);
73
+ if (bodyInChild)
74
+ return bodyInChild;
75
+ }
76
+ }
77
+ return null;
78
+ };
79
+ const bodyElement = findBodyElement(path.node.children);
66
80
  if (!bodyElement) {
67
81
  warnings.push(`File ${file} has a <html> tag without a <body> tag. Skipping GTProvider insertion.`);
68
82
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gtx-cli",
3
- "version": "2.1.7",
3
+ "version": "2.1.8",
4
4
  "main": "dist/index.js",
5
5
  "bin": "dist/main.js",
6
6
  "files": [