webstudio 0.135.0 → 0.136.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/lib/cli.js CHANGED
@@ -364,12 +364,20 @@ var prebuild = async (options) => {
364
364
  Please check webstudio --help for more details`
365
365
  );
366
366
  }
367
- if (options.template !== "vanilla" && await isCliTemplate(options.template) === false && options.template.startsWith(".") === false) {
368
- throw Error(
369
- `
367
+ for (const template of options.template) {
368
+ if (template === "vanilla") {
369
+ continue;
370
+ }
371
+ if (template.startsWith(".")) {
372
+ continue;
373
+ }
374
+ if (await isCliTemplate(template) === false) {
375
+ throw Error(
376
+ `
370
377
  Template ${options.template} is not available
371
378
  Please check webstudio --help for more details`
372
- );
379
+ );
380
+ }
373
381
  }
374
382
  const spinner = ora2("Scaffolding the project files");
375
383
  spinner.start();
@@ -380,8 +388,11 @@ var prebuild = async (options) => {
380
388
  const routesDir = join4(appRoot, "routes");
381
389
  await rm(routesDir, { recursive: true, force: true });
382
390
  await copyTemplates();
383
- if (options.template !== "vanilla") {
384
- await copyTemplates(options.template);
391
+ for (const template of options.template) {
392
+ if (template === "vanilla") {
393
+ continue;
394
+ }
395
+ await copyTemplates(template);
385
396
  }
386
397
  const constants2 = await import(pathToFileURL(join4(cwd3(), "app/constants.mjs")).href);
387
398
  const { assetBaseUrl } = constants2;
@@ -733,8 +744,10 @@ ${utilsExport}
733
744
  for (const redirect of redirects) {
734
745
  const redirectPagePath = generateRemixRoute(redirect.old);
735
746
  const redirectFileName = `${redirectPagePath}.ts`;
736
- const content = `export const loader = () => {
737
- return Response.redirect("${redirect.new}", ${redirect.status ?? 301});
747
+ const content = `import { type LoaderArgs, redirect } from "@remix-run/server-runtime";
748
+
749
+ export const loader = (arg: LoaderArgs) => {
750
+ return redirect("${redirect.new}", ${redirect.status ?? 301});
738
751
  };
739
752
  `;
740
753
  await ensureFileInPath(join4(routesDir, redirectFileName), content);
@@ -755,7 +768,8 @@ var buildOptions = (yargs) => yargs.option("assets", {
755
768
  default: false,
756
769
  describe: "[Experimental] Use preview version of the project"
757
770
  }).option("template", {
758
- type: "string",
771
+ type: "array",
772
+ string: true,
759
773
  describe: `Template to use for the build [choices: ${PROJECT_TEMPALTES.join(
760
774
  ", "
761
775
  )}]`
@@ -870,7 +884,7 @@ var initFlow = async (options) => {
870
884
  }
871
885
  await build({
872
886
  ...options,
873
- ...projectTemplate && { template: projectTemplate }
887
+ ...projectTemplate && { template: [projectTemplate] }
874
888
  });
875
889
  if (shouldInstallDeps === true) {
876
890
  const spinner = ora3().start();
@@ -913,7 +927,7 @@ import makeCLI from "yargs";
913
927
  // package.json
914
928
  var package_default = {
915
929
  name: "webstudio",
916
- version: "0.135.0",
930
+ version: "0.136.0",
917
931
  description: "Webstudio CLI",
918
932
  author: "Webstudio <github@webstudio.is>",
919
933
  homepage: "https://webstudio.is",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webstudio",
3
- "version": "0.135.0",
3
+ "version": "0.136.0",
4
4
  "description": "Webstudio CLI",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -28,21 +28,21 @@
28
28
  "title-case": "^4.1.0",
29
29
  "yargs": "^17.7.2",
30
30
  "zod": "^3.21.4",
31
- "@webstudio-is/http-client": "0.135.0",
32
- "@webstudio-is/react-sdk": "0.135.0",
33
- "@webstudio-is/sdk": "0.135.0",
34
- "@webstudio-is/sdk-components-react-radix": "0.135.0",
35
- "@webstudio-is/sdk-components-react-remix": "0.135.0",
36
- "@webstudio-is/sdk-components-react": "0.135.0",
37
- "@webstudio-is/image": "0.135.0"
31
+ "@webstudio-is/http-client": "0.136.0",
32
+ "@webstudio-is/react-sdk": "0.136.0",
33
+ "@webstudio-is/image": "0.136.0",
34
+ "@webstudio-is/sdk": "0.136.0",
35
+ "@webstudio-is/sdk-components-react": "0.136.0",
36
+ "@webstudio-is/sdk-components-react-radix": "0.136.0",
37
+ "@webstudio-is/sdk-components-react-remix": "0.136.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/node": "^18.17.1",
41
41
  "@types/prompts": "^2.4.5",
42
42
  "tsx": "^3.12.8",
43
43
  "typescript": "5.2.2",
44
- "@webstudio-is/form-handlers": "0.135.0",
45
- "@webstudio-is/tsconfig": "1.0.7"
44
+ "@webstudio-is/tsconfig": "1.0.7",
45
+ "@webstudio-is/form-handlers": "0.136.0"
46
46
  },
47
47
  "scripts": {
48
48
  "typecheck": "tsc",
@@ -5,7 +5,9 @@ import {
5
5
  type LinkDescriptor,
6
6
  type ActionArgs,
7
7
  type LoaderArgs,
8
+ type HeadersArgs,
8
9
  json,
10
+ redirect,
9
11
  } from "@remix-run/server-runtime";
10
12
  import { useLoaderData } from "@remix-run/react";
11
13
  import type { ProjectMeta } from "@webstudio-is/sdk";
@@ -42,7 +44,7 @@ export const loader = async (arg: LoaderArgs) => {
42
44
  pageMeta.status === 301 || pageMeta.status === 302
43
45
  ? pageMeta.status
44
46
  : 302;
45
- return Response.redirect(pageMeta.redirect, status);
47
+ return redirect(pageMeta.redirect, status);
46
48
  }
47
49
 
48
50
  const host =
@@ -70,14 +72,18 @@ export const loader = async (arg: LoaderArgs) => {
70
72
  // In case of CRM Data, this should be set to 0
71
73
  {
72
74
  status: pageMeta.status,
73
- headers: { "Cache-Control": "public, max-age=600" },
75
+ headers: {
76
+ "Cache-Control": "public, max-age=600",
77
+ "x-ws-language": pageMeta.language ?? "en",
78
+ },
74
79
  }
75
80
  );
76
81
  };
77
82
 
78
- export const headers = () => {
83
+ export const headers = ({ loaderHeaders }: HeadersArgs) => {
79
84
  return {
80
85
  "Cache-Control": "public, max-age=0, must-revalidate",
86
+ "x-ws-language": loaderHeaders.get("x-ws-language"),
81
87
  };
82
88
  };
83
89
 
@@ -10,13 +10,13 @@
10
10
  "@remix-run/react": "^1.19.2",
11
11
  "@remix-run/server-runtime": "^1.19.2",
12
12
  "@remix-run/node": "^1.19.2",
13
- "@webstudio-is/react-sdk": "0.135.0",
14
- "@webstudio-is/sdk-components-react-radix": "0.135.0",
15
- "@webstudio-is/sdk-components-react-remix": "0.135.0",
16
- "@webstudio-is/sdk-components-react": "0.135.0",
17
- "@webstudio-is/form-handlers": "0.135.0",
18
- "@webstudio-is/image": "0.135.0",
19
- "@webstudio-is/sdk": "0.135.0",
13
+ "@webstudio-is/react-sdk": "0.136.0",
14
+ "@webstudio-is/sdk-components-react-radix": "0.136.0",
15
+ "@webstudio-is/sdk-components-react-remix": "0.136.0",
16
+ "@webstudio-is/sdk-components-react": "0.136.0",
17
+ "@webstudio-is/form-handlers": "0.136.0",
18
+ "@webstudio-is/image": "0.136.0",
19
+ "@webstudio-is/sdk": "0.136.0",
20
20
  "isbot": "^3.6.8",
21
21
  "react": "^18.2.0",
22
22
  "react-dom": "^18.2.0"