@speedkit/cli 4.0.0 → 4.1.0

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,3 +1,10 @@
1
+ # [4.1.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.0.0...v4.1.0) (2026-05-06)
2
+
3
+
4
+ ### Features
5
+
6
+ * **wizard:** shopify ([f7686ce](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/f7686ce4c24fd2f4d9fa3158f465ab2454dc4959))
7
+
1
8
  # [4.0.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v3.43.2...v4.0.0) (2026-05-06)
2
9
 
3
10
 
package/README.md CHANGED
@@ -21,7 +21,7 @@ $ npm install -g @speedkit/cli
21
21
  $ sk COMMAND
22
22
  running command...
23
23
  $ sk (--version)
24
- @speedkit/cli/4.0.0 linux-x64 node-v22.22.2
24
+ @speedkit/cli/4.1.0 linux-x64 node-v22.22.2
25
25
  $ sk --help [COMMAND]
26
26
  USAGE
27
27
  $ sk COMMAND
@@ -109,13 +109,22 @@ const config = {
109
109
  wrapPreRenderedElementsWithCustomRootTags(document);
110
110
  addPolyFillAfterMainPreRenderTemplate(document);
111
111
  triggerShadowRendering(document);
112
+ {{#if isShopify}}
113
+ // Shopify specific: inject scripts into sk-html which set css variables (normally set to html element)
114
+ injectCSSVariableScripts(document);
115
+ {{/if}}
112
116
  {{#if addSSRInnerShadowDomSupport}}
113
117
 
114
118
  overrideCustomElementDefine(document);
115
119
  walkPreRenderedElements(document);
116
120
  {{/if}}
117
121
  {{else}}
118
- // do nothing
122
+ {{#if isShopify}}
123
+ // Shopify specific: inject script which sets css variables on the html element
124
+ injectCSSVariableScripts(document);
125
+ {{else}}
126
+ // do nothing
127
+ {{/if}}
119
128
  {{/if}}
120
129
  },
121
130
  {{#if isPlentymarkets}}
@@ -652,3 +661,81 @@ export const post = async (db, req, res) => {
652
661
  }
653
662
  {{/if}}
654
663
  {{/if}}
664
+ {{#if isShopify}}
665
+
666
+ /**
667
+ * Injects scripts into sk-html within each shadow root that set CSS custom
668
+ * properties (e.g. --window-height, --announcement-bar-height, --header-height)
669
+ * on sk-html instead of the document's html element.
670
+ *
671
+ * @param document
672
+ */
673
+ function injectCSSVariableScripts(document) {
674
+ {{#if addSSR}}
675
+ const customShadowRoots = getCustomShadowElements(document);
676
+ for (const customShadowRoot of customShadowRoots) {
677
+ const skHtml = customShadowRoot.querySelector("sk-html");
678
+ if (!skHtml) continue;
679
+
680
+ const script = document.createElement("script");
681
+ script.textContent = `(${setCSSVariablesOnSkHtml.toString()})();`;
682
+ // insert script before #main so styles are applied earlier
683
+ const main = skHtml.querySelector("#main");
684
+ if (main) {
685
+ main.before(script);
686
+ } else {
687
+ skHtml.appendChild(script);
688
+ }
689
+ }
690
+ {{else}}
691
+ const script = document.createElement("script");
692
+ script.textContent = `(${setCSSVariablesOnHtml.toString()})();`;
693
+ // insert script before #main so styles are applied earlier
694
+ const main = document.querySelector("#main");
695
+ if (!main) return;
696
+ main.before(script);
697
+ {{/if}}
698
+ }
699
+
700
+ /**
701
+ * Client-side script that sets CSS custom properties on {{#if addSSR}}sk-html{{else}}the html element{{/if}}
702
+ * (e.g. --window-height, --announcement-bar-height, --header-height).
703
+ * Injected via .toString() into the document.
704
+ *
705
+ * TODO: double check whether the set CSS variables are being used by the theme
706
+ * and that the queried selectors are correct for this Shopify store.
707
+ */
708
+ /* eslint-disable no-undef -- client-side function serialised via .toString() */
709
+ function {{#if addSSR}}setCSSVariablesOnSkHtml{{else}}setCSSVariablesOnHtml{{/if}}() {
710
+ {{#if addSSR}}
711
+ const host = document.querySelector("sk-shadow-app-root");
712
+ const root = host?.shadowRoot;
713
+ if (!root) return;
714
+ const skHtml = root.querySelector("sk-html");
715
+ if (!skHtml) return;
716
+ {{else}}
717
+ const html = document.querySelector("html");
718
+ if (!html) return;
719
+ {{/if}}
720
+
721
+ requestAnimationFrame(() => {
722
+ const viewportHeight = window.visualViewport ? window.visualViewport.height : document.documentElement.clientHeight;
723
+ {{#if addSSR}}skHtml{{else}}html{{/if}}.style.setProperty("--window-height", viewportHeight + "px");
724
+ });
725
+
726
+ const announcementBar = {{#if addSSR}}root{{else}}document{{/if}}.querySelector('[id^="shopify-section"][id$="announcement-bar"]');
727
+ if (announcementBar) {
728
+ {{#if addSSR}}skHtml{{else}}html{{/if}}.style.setProperty("--announcement-bar-height", announcementBar.clientHeight + "px");
729
+ }
730
+
731
+ const headerElement = {{#if addSSR}}root{{else}}document{{/if}}.querySelector('[id^="shopify-section"][id$="header"]');
732
+ if (headerElement) {
733
+ const headerHeight = headerElement.clientHeight;
734
+ const headerHeightWithoutBottomNav = headerElement.querySelector(".header__wrapper")?.clientHeight;
735
+ {{#if addSSR}}skHtml{{else}}html{{/if}}.style.setProperty("--header-height", headerHeight + "px");
736
+ if (headerHeightWithoutBottomNav != null) {
737
+ {{#if addSSR}}skHtml{{else}}html{{/if}}.style.setProperty("--header-height-without-bottom-nav", headerHeightWithoutBottomNav + "px");
738
+ }
739
+ }
740
+ }
741
+ {{/if}}
@@ -751,5 +751,5 @@
751
751
  ]
752
752
  }
753
753
  },
754
- "version": "4.0.0"
754
+ "version": "4.1.0"
755
755
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@speedkit/cli",
3
3
  "description": "Speed Kit CLI",
4
- "version": "4.0.0",
4
+ "version": "4.1.0",
5
5
  "author": {
6
6
  "name": "Baqend.com",
7
7
  "email": "info@baqend.com"
@@ -85,7 +85,7 @@
85
85
  "@aws-sdk/client-athena": "^3.529",
86
86
  "@eslint/eslintrc": "^3.3.5",
87
87
  "@eslint/js": "^10.0.1",
88
- "@inquirer/prompts": "^8.4.1",
88
+ "@inquirer/prompts": "^8.4.2",
89
89
  "@oclif/core": "^4.10.5",
90
90
  "@oclif/errors": "^1.3.6",
91
91
  "@oclif/plugin-autocomplete": "^3.2.45",
@@ -131,7 +131,7 @@
131
131
  "@types/uuid": "^9.0.8",
132
132
  "chai": "^4.4.1",
133
133
  "copyfiles": "^2.4.1",
134
- "eslint": "10.2.0",
134
+ "eslint": "10.2.1",
135
135
  "eslint-config-prettier": "^10.1.8",
136
136
  "eslint-plugin-prettier": "^5.5.5",
137
137
  "eslint-plugin-unicorn": "^64.0.0",
@@ -139,9 +139,9 @@
139
139
  "husky": "^8.0.3",
140
140
  "lint-staged": "^16.4.0",
141
141
  "memfs": "^4.8.0",
142
- "mocha": "^12.0.0-beta-3",
142
+ "mocha": "^12.0.0-beta-9.2",
143
143
  "mock-fs": "^5.5.0",
144
- "nock": "^14.0.12",
144
+ "nock": "^14.0.13",
145
145
  "nyc": "^18.0.0",
146
146
  "oclif": "^4.23.0",
147
147
  "shx": "^0.4.0",