webstudio 0.179.0 → 0.181.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
@@ -130,7 +130,7 @@ import { readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises
130
130
  import { cancel, isCancel, log, text } from "@clack/prompts";
131
131
  import { parseBuilderUrl } from "@webstudio-is/http-client";
132
132
  var parseShareLink = (value) => {
133
- const url = new URL(value);
133
+ const url = new URL(value.replaceAll("'", ""));
134
134
  const token = url.searchParams.get("authToken");
135
135
  let { projectId, sourceOrigin } = parseBuilderUrl(url.href);
136
136
  if (projectId === void 0) {
@@ -272,7 +272,7 @@ var sync = async (options) => {
272
272
  });
273
273
  } catch (error) {
274
274
  syncing.stop(error.message, 2);
275
- return;
275
+ throw error;
276
276
  }
277
277
  }
278
278
  project;
@@ -1112,6 +1112,24 @@ Please check webstudio --help for more details`
1112
1112
  log2.step("Build finished");
1113
1113
  };
1114
1114
 
1115
+ // src/build-utils.ts
1116
+ var mapToTemplatesFromOptions = (values) => {
1117
+ const templates = [];
1118
+ for (const value of values) {
1119
+ const template = PROJECT_TEMPLATES.find((item) => item.value === value) ?? INTERNAL_TEMPLATES.find((item) => item.value === value);
1120
+ if (template == null) {
1121
+ templates.push(value);
1122
+ continue;
1123
+ }
1124
+ if ("expand" in template && template.expand != null) {
1125
+ templates.push(...template.expand);
1126
+ continue;
1127
+ }
1128
+ templates.push(value);
1129
+ }
1130
+ return templates;
1131
+ };
1132
+
1115
1133
  // src/commands/build.ts
1116
1134
  var buildOptions = (yargs) => yargs.option("assets", {
1117
1135
  type: "boolean",
@@ -1125,22 +1143,7 @@ var buildOptions = (yargs) => yargs.option("assets", {
1125
1143
  type: "array",
1126
1144
  string: true,
1127
1145
  default: [],
1128
- coerce: (values) => {
1129
- const templates = [];
1130
- for (const value of values) {
1131
- const template = PROJECT_TEMPLATES.find((item) => item.value === value) ?? INTERNAL_TEMPLATES.find((item) => item.value === value);
1132
- if (template == null) {
1133
- templates.push(value);
1134
- continue;
1135
- }
1136
- if ("expand" in template && template.expand != null) {
1137
- templates.push(...template.expand);
1138
- continue;
1139
- }
1140
- templates.push(value);
1141
- }
1142
- return templates;
1143
- },
1146
+ coerce: mapToTemplatesFromOptions,
1144
1147
  describe: `Template to use for the build [choices: ${PROJECT_TEMPLATES.map(
1145
1148
  (item) => item.value
1146
1149
  ).join(", ")}]`
@@ -1238,7 +1241,9 @@ var initFlow = async (options) => {
1238
1241
  await sync({ buildId: void 0, origin: void 0, authToken: void 0 });
1239
1242
  await build({
1240
1243
  ...options,
1241
- ...projectTemplate && { template: [projectTemplate] }
1244
+ ...projectTemplate && {
1245
+ template: mapToTemplatesFromOptions([projectTemplate])
1246
+ }
1242
1247
  });
1243
1248
  if (shouldInstallDeps === true) {
1244
1249
  const install = spinner3();
@@ -1281,7 +1286,7 @@ import makeCLI from "yargs";
1281
1286
  // package.json
1282
1287
  var package_default = {
1283
1288
  name: "webstudio",
1284
- version: "0.179.0",
1289
+ version: "0.181.0",
1285
1290
  description: "Webstudio CLI",
1286
1291
  author: "Webstudio <github@webstudio.is>",
1287
1292
  homepage: "https://webstudio.is",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webstudio",
3
- "version": "0.179.0",
3
+ "version": "0.181.0",
4
4
  "description": "Webstudio CLI",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -37,13 +37,13 @@
37
37
  "strip-indent": "^4.0.0",
38
38
  "yargs": "^17.7.2",
39
39
  "zod": "^3.22.4",
40
- "@webstudio-is/http-client": "0.179.0",
41
- "@webstudio-is/image": "0.179.0",
42
- "@webstudio-is/sdk": "0.179.0",
43
- "@webstudio-is/sdk-components-react": "0.179.0",
44
- "@webstudio-is/react-sdk": "0.179.0",
45
- "@webstudio-is/sdk-components-react-radix": "0.179.0",
46
- "@webstudio-is/sdk-components-react-remix": "0.179.0"
40
+ "@webstudio-is/http-client": "0.181.0",
41
+ "@webstudio-is/image": "0.181.0",
42
+ "@webstudio-is/sdk": "0.181.0",
43
+ "@webstudio-is/sdk-components-react": "0.181.0",
44
+ "@webstudio-is/react-sdk": "0.181.0",
45
+ "@webstudio-is/sdk-components-react-radix": "0.181.0",
46
+ "@webstudio-is/sdk-components-react-remix": "0.181.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@jest/globals": "^29.7.0",
@@ -11,12 +11,12 @@
11
11
  "@remix-run/node": "2.11.0",
12
12
  "@remix-run/react": "2.11.0",
13
13
  "@remix-run/server-runtime": "2.11.0",
14
- "@webstudio-is/react-sdk": "0.179.0",
15
- "@webstudio-is/sdk-components-react-radix": "0.179.0",
16
- "@webstudio-is/sdk-components-react-remix": "0.179.0",
17
- "@webstudio-is/sdk-components-react": "0.179.0",
18
- "@webstudio-is/image": "0.179.0",
19
- "@webstudio-is/sdk": "0.179.0",
14
+ "@webstudio-is/react-sdk": "0.181.0",
15
+ "@webstudio-is/sdk-components-react-radix": "0.181.0",
16
+ "@webstudio-is/sdk-components-react-remix": "0.181.0",
17
+ "@webstudio-is/sdk-components-react": "0.181.0",
18
+ "@webstudio-is/image": "0.181.0",
19
+ "@webstudio-is/sdk": "0.181.0",
20
20
  "isbot": "^5.1.17",
21
21
  "react": "18.3.0-canary-14898b6a9-20240318",
22
22
  "react-dom": "18.3.0-canary-14898b6a9-20240318"
@@ -2,6 +2,8 @@
2
2
  * We use mjs extension as constants in this file is shared with the build script
3
3
  * and we use `node --eval` to extract the constants.
4
4
  */
5
+ import { UrlCanParse } from "@webstudio-is/image";
6
+
5
7
  export const assetBaseUrl = "/assets/";
6
8
  export const imageBaseUrl = "/assets/";
7
9
 
@@ -9,7 +11,7 @@ export const imageBaseUrl = "/assets/";
9
11
  * @type {import("@webstudio-is/image").ImageLoader}
10
12
  */
11
13
  export const imageLoader = ({ src }) => {
12
- if (URL.canParse(src)) {
14
+ if (UrlCanParse(src)) {
13
15
  return src;
14
16
  }
15
17
 
@@ -8,11 +8,11 @@
8
8
  "typecheck": "tsc"
9
9
  },
10
10
  "dependencies": {
11
- "@webstudio-is/react-sdk": "0.179.0",
12
- "@webstudio-is/sdk-components-react-radix": "0.179.0",
13
- "@webstudio-is/sdk-components-react": "0.179.0",
14
- "@webstudio-is/image": "0.179.0",
15
- "@webstudio-is/sdk": "0.179.0",
11
+ "@webstudio-is/react-sdk": "0.181.0",
12
+ "@webstudio-is/sdk-components-react-radix": "0.181.0",
13
+ "@webstudio-is/sdk-components-react": "0.181.0",
14
+ "@webstudio-is/image": "0.181.0",
15
+ "@webstudio-is/sdk": "0.181.0",
16
16
  "react": "18.3.0-canary-14898b6a9-20240318",
17
17
  "react-dom": "18.3.0-canary-14898b6a9-20240318",
18
18
  "vike": "^0.4.182"
@@ -2,6 +2,8 @@
2
2
  * We use mjs extension as constants in this file is shared with the build script
3
3
  * and we use `node --eval` to extract the constants.
4
4
  */
5
+ import { UrlCanParse } from "@webstudio-is/image";
6
+
5
7
  export const assetBaseUrl = "/assets/";
6
8
  export const imageBaseUrl = "/assets/";
7
9
 
@@ -9,7 +11,7 @@ export const imageBaseUrl = "/assets/";
9
11
  * @type {import("@webstudio-is/image").ImageLoader}
10
12
  */
11
13
  export const imageLoader = (props) => {
12
- if (URL.canParse(props.src)) {
14
+ if (UrlCanParse(props.src)) {
13
15
  return props.src;
14
16
  }
15
17
 
@@ -2,6 +2,8 @@
2
2
  * We use mjs extension as constants in this file is shared with the build script
3
3
  * and we use `node --eval` to extract the constants.
4
4
  */
5
+ import { UrlCanParse } from "@webstudio-is/image";
6
+
5
7
  export const assetBaseUrl = "/assets/";
6
8
  export const imageBaseUrl = "/assets/";
7
9
 
@@ -9,7 +11,7 @@ export const imageBaseUrl = "/assets/";
9
11
  * @type {import("@webstudio-is/image").ImageLoader}
10
12
  */
11
13
  export const imageLoader = (props) => {
12
- if (URL.canParse(props.src)) {
14
+ if (UrlCanParse(props.src)) {
13
15
  return props.src;
14
16
  }
15
17