webstudio 0.127.0 → 0.129.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
|
@@ -260,7 +260,7 @@ import merge from "deepmerge";
|
|
|
260
260
|
import {
|
|
261
261
|
generateCss,
|
|
262
262
|
generateUtilsExport,
|
|
263
|
-
|
|
263
|
+
generateWebstudioComponent,
|
|
264
264
|
getIndexesWithinAncestors,
|
|
265
265
|
namespaceMeta,
|
|
266
266
|
normalizeProps,
|
|
@@ -334,18 +334,22 @@ var isCliTemplate = async (template) => {
|
|
|
334
334
|
}
|
|
335
335
|
return false;
|
|
336
336
|
};
|
|
337
|
-
var
|
|
337
|
+
var getTemplatePath = async (template) => {
|
|
338
338
|
const currentPath = fileURLToPath(new URL(import.meta.url));
|
|
339
|
-
const
|
|
340
|
-
|
|
339
|
+
const templatePath = await isCliTemplate(template) ? normalize(join4(dirname2(currentPath), "..", "templates", template)) : template;
|
|
340
|
+
return templatePath;
|
|
341
|
+
};
|
|
342
|
+
var copyTemplates = async (template = "defaults") => {
|
|
343
|
+
const templatePath = await getTemplatePath(template);
|
|
344
|
+
await cp(templatePath, cwd3(), {
|
|
341
345
|
recursive: true,
|
|
342
346
|
filter: (source) => {
|
|
343
347
|
return basename(source) !== "package.json";
|
|
344
348
|
}
|
|
345
349
|
});
|
|
346
|
-
if (await isFileExists(join4(
|
|
350
|
+
if (await isFileExists(join4(templatePath, "package.json")) === true) {
|
|
347
351
|
await mergeJsonFiles(
|
|
348
|
-
join4(
|
|
352
|
+
join4(templatePath, "package.json"),
|
|
349
353
|
join4(cwd3(), "package.json")
|
|
350
354
|
);
|
|
351
355
|
}
|
|
@@ -526,17 +530,11 @@ var prebuild = async (options) => {
|
|
|
526
530
|
);
|
|
527
531
|
await ensureFileInPath(join4(generatedDir, "index.css"), cssText);
|
|
528
532
|
spinner.text = "Generating routes and pages";
|
|
529
|
-
const
|
|
530
|
-
|
|
531
|
-
join4(
|
|
532
|
-
dirname2(fileURLToPath(new URL(import.meta.url))),
|
|
533
|
-
"..",
|
|
534
|
-
"templates",
|
|
535
|
-
"route-template.tsx"
|
|
536
|
-
)
|
|
537
|
-
),
|
|
538
|
-
"utf8"
|
|
533
|
+
const routeTemplatePath = normalize(
|
|
534
|
+
join4(cwd3(), "__templates__", "route-template.tsx")
|
|
539
535
|
);
|
|
536
|
+
const routeFileTemplate = await readFile4(routeTemplatePath, "utf8");
|
|
537
|
+
await rm(dirname2(routeTemplatePath), { recursive: true });
|
|
540
538
|
for (const [pageId, pageComponents] of Object.entries(componentsByPage)) {
|
|
541
539
|
const scope = createScope([
|
|
542
540
|
// manually maintained list of occupied identifiers
|
|
@@ -597,9 +595,27 @@ var prebuild = async (options) => {
|
|
|
597
595
|
pages: siteData.build.pages,
|
|
598
596
|
props
|
|
599
597
|
});
|
|
600
|
-
const
|
|
598
|
+
const pathVariableId = pageData.page.pathVariableId ?? "pathVariableId";
|
|
599
|
+
if (pageData.page.pathVariableId === void 0) {
|
|
600
|
+
dataSources.set(pathVariableId, {
|
|
601
|
+
id: pathVariableId,
|
|
602
|
+
name: "Page Params",
|
|
603
|
+
type: "parameter"
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
const pageComponent = generateWebstudioComponent({
|
|
601
607
|
scope,
|
|
602
|
-
|
|
608
|
+
name: "Page",
|
|
609
|
+
rootInstanceId: pageData.page.rootInstanceId,
|
|
610
|
+
parameters: [
|
|
611
|
+
{
|
|
612
|
+
id: `params`,
|
|
613
|
+
instanceId: "",
|
|
614
|
+
name: "params",
|
|
615
|
+
type: "parameter",
|
|
616
|
+
value: pathVariableId
|
|
617
|
+
}
|
|
618
|
+
],
|
|
603
619
|
instances,
|
|
604
620
|
props,
|
|
605
621
|
dataSources,
|
|
@@ -637,9 +653,12 @@ ${utilsExport}
|
|
|
637
653
|
const path = getPagePath(pageData.page.id, siteData.build.pages);
|
|
638
654
|
const remixRoute = generateRemixRoute(path);
|
|
639
655
|
const fileName = `${remixRoute}.tsx`;
|
|
640
|
-
const routeFileContent = routeFileTemplate.replace(
|
|
641
|
-
|
|
642
|
-
|
|
656
|
+
const routeFileContent = routeFileTemplate.replace(
|
|
657
|
+
/".*\/__generated__\/_index"/,
|
|
658
|
+
`"../__generated__/${remixRoute}"`
|
|
659
|
+
).replace(
|
|
660
|
+
/".*\/__generated__\/_index.server"/,
|
|
661
|
+
`"../__generated__/${remixRoute}.server"`
|
|
643
662
|
);
|
|
644
663
|
await ensureFileInPath(join4(routesDir, fileName), routeFileContent);
|
|
645
664
|
await ensureFileInPath(join4(generatedDir, fileName), pageExports);
|
|
@@ -841,7 +860,7 @@ import makeCLI from "yargs";
|
|
|
841
860
|
// package.json
|
|
842
861
|
var package_default = {
|
|
843
862
|
name: "webstudio",
|
|
844
|
-
version: "0.
|
|
863
|
+
version: "0.129.0",
|
|
845
864
|
description: "Webstudio CLI",
|
|
846
865
|
author: "Webstudio <github@webstudio.is>",
|
|
847
866
|
homepage: "https://webstudio.is",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webstudio",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.129.0",
|
|
4
4
|
"description": "Webstudio CLI",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -28,20 +28,20 @@
|
|
|
28
28
|
"title-case": "^4.1.0",
|
|
29
29
|
"yargs": "^17.7.2",
|
|
30
30
|
"zod": "^3.21.4",
|
|
31
|
-
"@webstudio-is/
|
|
32
|
-
"@webstudio-is/
|
|
33
|
-
"@webstudio-is/sdk": "0.
|
|
34
|
-
"@webstudio-is/
|
|
35
|
-
"@webstudio-is/sdk-components-react
|
|
36
|
-
"@webstudio-is/react-
|
|
37
|
-
"@webstudio-is/sdk-components-react-
|
|
31
|
+
"@webstudio-is/http-client": "0.129.0",
|
|
32
|
+
"@webstudio-is/react-sdk": "0.129.0",
|
|
33
|
+
"@webstudio-is/sdk": "0.129.0",
|
|
34
|
+
"@webstudio-is/image": "0.129.0",
|
|
35
|
+
"@webstudio-is/sdk-components-react": "0.129.0",
|
|
36
|
+
"@webstudio-is/sdk-components-react-remix": "0.129.0",
|
|
37
|
+
"@webstudio-is/sdk-components-react-radix": "0.129.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.
|
|
44
|
+
"@webstudio-is/form-handlers": "0.129.0",
|
|
45
45
|
"@webstudio-is/tsconfig": "1.0.7"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
@@ -21,8 +21,8 @@ import {
|
|
|
21
21
|
Page,
|
|
22
22
|
imageAssets,
|
|
23
23
|
getRemixParams,
|
|
24
|
-
} from "
|
|
25
|
-
import { loadResources } from "
|
|
24
|
+
} from "../../../__generated__/_index";
|
|
25
|
+
import { loadResources } from "../../../__generated__/_index.server";
|
|
26
26
|
import css from "../__generated__/index.css";
|
|
27
27
|
import { assetBaseUrl, imageBaseUrl, imageLoader } from "~/constants.mjs";
|
|
28
28
|
|
|
@@ -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.
|
|
14
|
-
"@webstudio-is/sdk-components-react-radix": "0.
|
|
15
|
-
"@webstudio-is/sdk-components-react-remix": "0.
|
|
16
|
-
"@webstudio-is/sdk-components-react": "0.
|
|
17
|
-
"@webstudio-is/form-handlers": "0.
|
|
18
|
-
"@webstudio-is/image": "0.
|
|
19
|
-
"@webstudio-is/sdk": "0.
|
|
13
|
+
"@webstudio-is/react-sdk": "0.129.0",
|
|
14
|
+
"@webstudio-is/sdk-components-react-radix": "0.129.0",
|
|
15
|
+
"@webstudio-is/sdk-components-react-remix": "0.129.0",
|
|
16
|
+
"@webstudio-is/sdk-components-react": "0.129.0",
|
|
17
|
+
"@webstudio-is/form-handlers": "0.129.0",
|
|
18
|
+
"@webstudio-is/image": "0.129.0",
|
|
19
|
+
"@webstudio-is/sdk": "0.129.0",
|
|
20
20
|
"isbot": "^3.6.8",
|
|
21
21
|
"react": "^18.2.0",
|
|
22
22
|
"react-dom": "^18.2.0"
|