@farm.js/create-app 0.1.0-beta.29 → 0.1.0-beta.31
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/bin/create-farm-app.js +4 -1
- package/dist/index.js +22 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/templates/_renderers/preact/farm.config.ts +12 -0
- package/templates/_renderers/preact/package.json +27 -0
- package/templates/_renderers/preact/src/app/api/greeting/route.ts +15 -0
- package/templates/_renderers/preact/src/app/layout.tsx +16 -0
- package/templates/_renderers/preact/src/app/page.tsx +66 -0
- package/templates/_renderers/preact/src/app/preact.css +26 -0
- package/templates/_renderers/preact/src/components/resource-links.tsx +71 -0
- package/templates/_renderers/preact/src/lib/api-client.ts +4 -0
- package/templates/_renderers/preact/src/lib/api.generated.ts +7 -0
- package/templates/_renderers/preact/tsconfig.json +25 -0
- package/templates/_renderers/solid/package.json +2 -2
- package/templates/_renderers/svelte/farm.config.ts +9 -0
- package/templates/_renderers/svelte/package.json +28 -0
- package/templates/_renderers/svelte/src/app/api/greeting/route.ts +15 -0
- package/templates/_renderers/svelte/src/app/layout.svelte +21 -0
- package/templates/_renderers/svelte/src/app/page.svelte +64 -0
- package/templates/_renderers/svelte/src/app/svelte.css +26 -0
- package/templates/_renderers/svelte/src/components/resource-links.svelte +31 -0
- package/templates/_renderers/svelte/src/lib/api-client.ts +4 -0
- package/templates/_renderers/svelte/src/lib/api.generated.ts +7 -0
- package/templates/_renderers/svelte/tsconfig.json +23 -0
- package/templates/_renderers/vue/package.json +2 -2
- package/templates/auth/package.json +3 -3
- package/templates/basic/package.json +2 -2
- package/templates/better-auth/package.json +3 -3
package/bin/create-farm-app.js
CHANGED
|
@@ -10,7 +10,10 @@ program
|
|
|
10
10
|
.version(version)
|
|
11
11
|
.argument("[project-name]", "Name of the project")
|
|
12
12
|
.option("-t, --template <template>", "Template to use")
|
|
13
|
-
.option(
|
|
13
|
+
.option(
|
|
14
|
+
"-r, --renderer <renderer>",
|
|
15
|
+
"Rendering library to use (react, preact, solid, vue, or svelte)",
|
|
16
|
+
)
|
|
14
17
|
.option("--list-templates", "List all available starter templates")
|
|
15
18
|
.option("--typescript", "Use TypeScript template")
|
|
16
19
|
.option("--skip-install", "Skip installing dependencies")
|
package/dist/index.js
CHANGED
|
@@ -2722,8 +2722,8 @@ async function createApp(projectName, options = {}) {
|
|
|
2722
2722
|
process.exit(1);
|
|
2723
2723
|
}
|
|
2724
2724
|
let renderer = options.renderer?.toLowerCase();
|
|
2725
|
-
if (renderer && renderer !== "react" && renderer !== "solid" && renderer !== "vue") {
|
|
2726
|
-
require_utils.logger.error(`Unknown renderer "${options.renderer}". Available: "react", "solid", "vue".`);
|
|
2725
|
+
if (renderer && renderer !== "react" && renderer !== "preact" && renderer !== "solid" && renderer !== "vue" && renderer !== "svelte") {
|
|
2726
|
+
require_utils.logger.error(`Unknown renderer "${options.renderer}". Available: "react", "preact", "solid", "vue", "svelte".`);
|
|
2727
2727
|
process.exit(1);
|
|
2728
2728
|
}
|
|
2729
2729
|
if (!renderer && !options.template && template === "basic") {
|
|
@@ -2737,6 +2737,11 @@ async function createApp(projectName, options = {}) {
|
|
|
2737
2737
|
value: "react",
|
|
2738
2738
|
description: "The default FARMJS renderer"
|
|
2739
2739
|
},
|
|
2740
|
+
{
|
|
2741
|
+
title: "Preact",
|
|
2742
|
+
value: "preact",
|
|
2743
|
+
description: "Small React-compatible runtime with SSR and hydration"
|
|
2744
|
+
},
|
|
2740
2745
|
{
|
|
2741
2746
|
title: "Solid",
|
|
2742
2747
|
value: "solid",
|
|
@@ -2746,6 +2751,11 @@ async function createApp(projectName, options = {}) {
|
|
|
2746
2751
|
title: "Vue",
|
|
2747
2752
|
value: "vue",
|
|
2748
2753
|
description: "Vue SFCs with server rendering and hydration"
|
|
2754
|
+
},
|
|
2755
|
+
{
|
|
2756
|
+
title: "Svelte",
|
|
2757
|
+
value: "svelte",
|
|
2758
|
+
description: "Svelte components with server rendering and hydration"
|
|
2749
2759
|
}
|
|
2750
2760
|
],
|
|
2751
2761
|
initial: 0
|
|
@@ -2820,6 +2830,7 @@ async function copyTemplate(template, projectPath, useTypeScript, renderer) {
|
|
|
2820
2830
|
if (await dirExists(tsTemplatePath)) await copyDir(tsTemplatePath, projectPath);
|
|
2821
2831
|
}
|
|
2822
2832
|
if (renderer === "solid") await copyDir(path.default.join(__dirname, "..", "templates", "_renderers", "solid"), projectPath);
|
|
2833
|
+
if (renderer === "preact") await copyDir(path.default.join(__dirname, "..", "templates", "_renderers", "preact"), projectPath);
|
|
2823
2834
|
if (renderer === "vue") {
|
|
2824
2835
|
const rendererTemplatePath = path.default.join(__dirname, "..", "templates", "_renderers", "vue");
|
|
2825
2836
|
await Promise.all([
|
|
@@ -2829,6 +2840,15 @@ async function copyTemplate(template, projectPath, useTypeScript, renderer) {
|
|
|
2829
2840
|
]);
|
|
2830
2841
|
await copyDir(rendererTemplatePath, projectPath);
|
|
2831
2842
|
}
|
|
2843
|
+
if (renderer === "svelte") {
|
|
2844
|
+
const rendererTemplatePath = path.default.join(__dirname, "..", "templates", "_renderers", "svelte");
|
|
2845
|
+
await Promise.all([
|
|
2846
|
+
fs_promises.default.rm(path.default.join(projectPath, "src", "app", "page.tsx"), { force: true }),
|
|
2847
|
+
fs_promises.default.rm(path.default.join(projectPath, "src", "app", "layout.tsx"), { force: true }),
|
|
2848
|
+
fs_promises.default.rm(path.default.join(projectPath, "src", "components", "resource-links.tsx"), { force: true })
|
|
2849
|
+
]);
|
|
2850
|
+
await copyDir(rendererTemplatePath, projectPath);
|
|
2851
|
+
}
|
|
2832
2852
|
if (!details?.integration) return;
|
|
2833
2853
|
const result = await addFarmIntegration({
|
|
2834
2854
|
root: projectPath,
|