storyloco 1.9.0 → 1.9.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storyloco",
3
- "version": "1.9.0",
3
+ "version": "1.9.2",
4
4
  "description": "A collection of slick Storyblok field plugins built with Svelte 5, TypeScript, and Tailwind CSS",
5
5
  "keywords": [
6
6
  "storyblok",
@@ -1 +1 @@
1
- export { default as storyblok_schema } from './schema.plugin.js';
1
+ export { default as storyblok_schema } from "./schema.plugin.js";
@@ -1,2 +1,2 @@
1
1
  // Reexport your entry components here
2
- export { default as storyblok_schema } from './schema.plugin.js';
2
+ export { default as storyblok_schema } from "./schema.plugin.js";
@@ -85,13 +85,13 @@ export default function storyblok_schema({ output_path, interval_ms, storyblok_p
85
85
  const env = loadEnv(server.config.mode, process.cwd(), "");
86
86
  const x = await exec();
87
87
  interval_ms = interval_ms ?? 60000; // 1 minute
88
- // ensure output_path ends with a slash
89
- output_path = output_path?.replace(/\/?$/, "/") ?? "src/lib";
88
+ // ensure output_path does not end with a slash
89
+ output_path = output_path?.replace(/\/?$/, "") ?? "src/lib";
90
90
  storyblok_personal_access_token =
91
91
  storyblok_personal_access_token ?? env.STORYBLOK_PERSONAL_ACCESS_TOKEN;
92
92
  storyblok_space_id = storyblok_space_id ?? env.STORYBLOK_SPACE_ID;
93
93
  const components_file = path.join(".svelte-kit/storyblok/components", storyblok_space_id, "components.json");
94
- const schema_ts_file = path.join("src/lib", filename ?? "components.schema.ts");
94
+ const schema_ts_file = path.join(output_path, filename ?? "components.schema.ts");
95
95
  const seconds = interval_ms / 1000;
96
96
  logger.info(`Regenerating Storyblok component types every ${seconds} ${seconds === 1 ? "second" : "seconds"}`);
97
97
  generate();
@@ -126,10 +126,11 @@ export default function storyblok_schema({ output_path, interval_ms, storyblok_p
126
126
  await mkdir(path.dirname(components_file), { recursive: true });
127
127
  // Write the data to the components file
128
128
  await writeFile(components_file, JSON.stringify(new_components, null, 2));
129
+ const here = (str) => path.join("node_modules/storyloco/packages/vite/src/lib", str);
129
130
  // Generate types
130
131
  logger.start("Generating TypeScript definitions...");
131
132
  await $ `chmod u+w ${schema_ts_file}`.quiet().nothrow();
132
- await $ `${x} storyblok ts generate -s ${storyblok_space_id} -p .svelte-kit/storyblok --compiler-options ./src/lib/compiler_options.js --custom-fields-parser ./src/lib/parser.js --strict`.quiet();
133
+ await $ `${x} storyblok@4.2.0 ts generate -s ${storyblok_space_id} -p .svelte-kit/storyblok --compiler-options ${here("compiler_options.js")} --custom-fields-parser ${here("custom_fields_parser.js")} --strict`;
133
134
  logger.succeed("TypeScript definitions generated.");
134
135
  // Get generated files
135
136
  const component_types = await readFile(`.svelte-kit/storyblok/types/${storyblok_space_id}/storyblok-components.d.ts`, "utf-8");