@curenorway/kode-cli 1.16.2 → 1.17.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.
@@ -388,10 +388,10 @@ Cure Kode is an **internal CDN tool by Cure** for managing JavaScript/CSS on Web
388
388
  Add this script tag to your Webflow site's **Custom Code** (Project Settings \u2192 Custom Code \u2192 Body Code, before \`</body>\`):
389
389
 
390
390
  \`\`\`html
391
- <script defer src="https://app.cure.no/api/cdn/${slug}/init.js"></script>
391
+ <script src="https://app.cure.no/api/cdn/${slug}/init.js"></script>
392
392
  \`\`\`
393
393
 
394
- **Important**: Use \`defer\` to ensure DOM is ready before scripts run. The init.js automatically loads all your scripts.
394
+ **Important**: Load synchronously (no \`defer\`) to work correctly with the cookie SDK. The init.js automatically loads all your scripts.
395
395
 
396
396
  ## Commands
397
397
 
@@ -1201,7 +1201,7 @@ Option C: Full rollback
1201
1201
  }
1202
1202
 
1203
1203
  // src/version.ts
1204
- var CLI_VERSION = "1.16.2";
1204
+ var CLI_VERSION = "1.17.0";
1205
1205
 
1206
1206
  // src/commands/init.ts
1207
1207
  import chalk from "chalk";
@@ -1247,7 +1247,7 @@ This project uses **Cure Kode** CDN for JavaScript/CSS delivery to Webflow.
1247
1247
  Add this to Webflow \u2192 Project Settings \u2192 Custom Code \u2192 Head:
1248
1248
 
1249
1249
  \`\`\`html
1250
- <script defer src="https://app.cure.no/api/cdn/${siteSlug}/init.js"></script>
1250
+ <script src="https://app.cure.no/api/cdn/${siteSlug}/init.js"></script>
1251
1251
  \`\`\`
1252
1252
 
1253
1253
  ---
@@ -1524,7 +1524,7 @@ Use these patterns when writing scripts for Webflow sites via Cure Kode.
1524
1524
 
1525
1525
  ## DOM ready pattern
1526
1526
 
1527
- Cure Kode's init.js loads with \`defer\`, so the DOM is ready when your scripts execute.
1527
+ Cure Kode's init.js loads synchronously. Use DOMContentLoaded or Webflow.push() if you need the DOM to be ready.
1528
1528
  For code that depends on Webflow's JS (interactions, tabs, sliders):
1529
1529
 
1530
1530
  \`\`\`javascript
@@ -1719,9 +1719,8 @@ document.querySelectorAll('[data-animate]').forEach(el => observer.observe(el));
1719
1719
 
1720
1720
  ### Execution order
1721
1721
 
1722
- 1. Browser parses HTML, encounters init.js with \`defer\`
1723
- 2. DOM is fully parsed
1724
- 3. init.js executes:
1722
+ 1. Browser encounters init.js (synchronous, no defer)
1723
+ 2. init.js executes:
1725
1724
  a. Global + autoLoad scripts are injected (in order of creation)
1726
1725
  b. Page-specific scripts are matched against current URL
1727
1726
  c. CSS scripts injected as \`<style>\` tags in \`<head>\`
@@ -2053,37 +2052,23 @@ config.json
2053
2052
  console.log(chalk.dim(` \u2514\u2500\u2500 ${DEFAULT_SCRIPTS_DIR}/`));
2054
2053
  console.log(chalk.dim(" \u2514\u2500\u2500 (skriptene dine her)"));
2055
2054
  console.log();
2056
- spinner.start("Legger til init.js i Webflow...");
2057
2055
  let webflowInjected = false;
2058
2056
  try {
2059
- const injectResponse = await fetch(`https://app.cure.no/api/cdn/sites/${site.id}/webflow/custom-code`, {
2060
- method: "POST",
2061
- headers: {
2062
- "Content-Type": "application/json",
2063
- "X-API-Key": apiKey
2064
- },
2065
- body: JSON.stringify({ location: "header" })
2057
+ const statusResponse = await fetch(`https://app.cure.no/api/cdn/sites/${site.id}/webflow/custom-code`, {
2058
+ headers: { "X-API-Key": apiKey }
2066
2059
  });
2067
- if (injectResponse.ok) {
2068
- spinner.succeed("init.js lagt til i Webflow <head>");
2069
- webflowInjected = true;
2070
- } else {
2071
- const errData = await injectResponse.json().catch(() => ({}));
2072
- spinner.warn("Kunne ikke legge til init.js automatisk");
2073
- console.log(chalk.dim(` ${errData.error || "Ukjent feil"}`));
2060
+ if (statusResponse.ok) {
2061
+ const status = await statusResponse.json();
2062
+ webflowInjected = status.injected === true;
2074
2063
  }
2075
2064
  } catch {
2076
- spinner.warn("Kunne ikke koble til Webflow API");
2077
2065
  }
2078
2066
  if (webflowInjected) {
2079
- console.log(chalk.yellow(" OBS: Publiser Webflow-nettstedet for at skriptet skal vises."));
2067
+ console.log(chalk.green(" \u2713 init.js er allerede lagt til i Webflow"));
2080
2068
  console.log();
2081
2069
  } else {
2082
- console.log(chalk.dim(" Legg til dette i Webflow <head> manuelt:"));
2083
- console.log();
2084
- console.log(chalk.cyan(` <script defer src="https://app.cure.no/api/cdn/${site.slug}/init.js"></script>`));
2085
- console.log();
2086
- console.log(chalk.dim(" Eller kjor ") + chalk.cyan("kode webflow inject") + chalk.dim(" nar du er klar."));
2070
+ console.log(chalk.yellow(" \u26A0\uFE0F init.js er ikke i Webflow enn\xE5."));
2071
+ console.log(chalk.dim(" Kj\xF8r ") + chalk.cyan("kode webflow inject") + chalk.dim(" for \xE5 legge den til."));
2087
2072
  console.log();
2088
2073
  }
2089
2074
  console.log(chalk.bold(" Neste steg:"));
@@ -3722,7 +3707,7 @@ async function statusCommand(options) {
3722
3707
  console.log(chalk7.cyan(` https://app.cure.no/api/cdn/${config.siteSlug}/init.js`));
3723
3708
  console.log();
3724
3709
  console.log(chalk7.dim(" Add to Webflow \u2192 Project Settings \u2192 Custom Code \u2192 Body (before </body>):"));
3725
- console.log(chalk7.dim(` <script defer src="https://app.cure.no/api/cdn/${config.siteSlug}/init.js"></script>`));
3710
+ console.log(chalk7.dim(` <script src="https://app.cure.no/api/cdn/${config.siteSlug}/init.js"></script>`));
3726
3711
  console.log();
3727
3712
  const spinner = ora6("Fetching status...").start();
3728
3713
  try {
package/dist/cli.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  updateClaudeMd,
24
24
  updateKodeDocs,
25
25
  watchCommand
26
- } from "./chunk-T5JI74PJ.js";
26
+ } from "./chunk-TDEFNKQQ.js";
27
27
 
28
28
  // src/cli.ts
29
29
  import { Command } from "commander";
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  updateScriptPurpose,
29
29
  watchCommand,
30
30
  writeContext
31
- } from "./chunk-T5JI74PJ.js";
31
+ } from "./chunk-TDEFNKQQ.js";
32
32
  export {
33
33
  KodeApiClient,
34
34
  KodeApiError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curenorway/kode-cli",
3
- "version": "1.16.2",
3
+ "version": "1.17.0",
4
4
  "description": "CLI for Cure Kode CDN - manage, deploy, and sync JS/CSS scripts for Webflow sites with AI agent support",
5
5
  "type": "module",
6
6
  "bin": {