@farm.js/create-app 0.1.0-beta.4 → 0.1.0-beta.6

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": "@farm.js/create-app",
3
- "version": "0.1.0-beta.4",
3
+ "version": "0.1.0-beta.6",
4
4
  "description": "Create a new Farm.js application",
5
5
  "keywords": [
6
6
  "@farm.js/create-app",
@@ -10,12 +10,12 @@
10
10
  "type-check": "tsc --noEmit"
11
11
  },
12
12
  "dependencies": {
13
- "@farm.js/core": "0.1.0-beta.4",
13
+ "@farm.js/core": "0.1.0-beta.6",
14
14
  "react": "^19.0.0",
15
15
  "react-dom": "^19.0.0"
16
16
  },
17
17
  "devDependencies": {
18
- "@farm.js/cli": "0.1.0-beta.4",
18
+ "@farm.js/cli": "0.1.0-beta.6",
19
19
  "@types/react": "^19.0.0",
20
20
  "@types/react-dom": "^19.0.0",
21
21
  "tailwindcss": "^4.0.0",
@@ -0,0 +1,13 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512" fill="none" role="img" aria-labelledby="title desc">
2
+ <title id="title">Farming Labs</title>
3
+ <desc id="desc">The three-tone Farming Labs mark on a dark square.</desc>
4
+ <rect width="512" height="512" fill="#0A0A0A"/>
5
+ <svg x="135.25" y="142" width="241.5" height="228" viewBox="125 68 161 152">
6
+ <path d="M157 68H133C128.582 68 125 71.5817 125 76V100C125 104.418 128.582 108 133 108H157C161.418 108 165 104.418 165 100V76C165 71.5817 161.418 68 157 68Z" fill="#F5F5F4"/>
7
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M182.383 68H280.617C282.045 68 283.414 68.8429 284.423 70.3431C285.433 71.8434 286 73.8783 286 76V100C286 102.122 285.433 104.157 284.423 105.657C283.414 107.157 282.045 108 280.617 108H182.383C180.955 108 179.586 107.157 178.577 105.657C177.567 104.157 177 102.122 177 100V76C177 73.8783 177.567 71.8434 178.577 70.3431C179.586 68.8429 180.955 68 182.383 68ZM271.852 81C270.747 81 269.852 81.8954 269.852 83V93C269.852 94.1046 270.747 95 271.852 95H277.272C278.376 95 279.272 94.1046 279.272 93V83C279.272 81.8954 278.376 81 277.272 81H271.852Z" fill="#F5F5F4"/>
8
+ <path d="M157 124H133C128.582 124 125 127.582 125 132V156C125 160.418 128.582 164 133 164H157C161.418 164 165 160.418 165 156V132C165 127.582 161.418 124 157 124Z" fill="#A3A3A3"/>
9
+ <path d="M280.334 124H182.666C179.537 124 177 127.582 177 132V156C177 160.418 179.537 164 182.666 164H280.334C283.463 164 286 160.418 286 156V132C286 127.582 283.463 124 280.334 124Z" fill="#A3A3A3"/>
10
+ <path d="M157 180H133C128.582 180 125 183.582 125 188V212C125 216.418 128.582 220 133 220H157C161.418 220 165 216.418 165 212V188C165 183.582 161.418 180 157 180Z" fill="#595959"/>
11
+ <path d="M230.189 180H182.811C179.602 180 177 183.582 177 188V212C177 216.418 179.602 220 182.811 220H230.189C233.398 220 236 216.418 236 212V188C236 183.582 233.398 180 230.189 180Z" fill="#595959"/>
12
+ </svg>
13
+ </svg>
@@ -4,6 +4,9 @@ import "./globals.css";
4
4
  export const metadata: Metadata = {
5
5
  title: "Farm.js App",
6
6
  description: "A modern React meta-framework built on Vite",
7
+ icons: {
8
+ icon: [{ url: "/favicon.svg", type: "image/svg+xml", sizes: "any" }],
9
+ },
7
10
  };
8
11
 
9
12
  export default function RootLayout({ children }: LayoutProps) {
package/dist/index.js DELETED
@@ -1,163 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.js");
3
- const require_utils = require("./utils.js");
4
- let prompts = require("prompts");
5
- prompts = require_rolldown_runtime.__toESM(prompts);
6
- let path = require("path");
7
- path = require_rolldown_runtime.__toESM(path);
8
- let fs_promises = require("fs/promises");
9
- fs_promises = require_rolldown_runtime.__toESM(fs_promises);
10
- //#region src/index.ts
11
- async function createApp(projectName, options = {}) {
12
- require_utils.showBanner();
13
- const templates = await getAvailableTemplates();
14
- if (templates.length === 0) {
15
- require_utils.logger.error("No templates are available in this package.");
16
- process.exit(1);
17
- }
18
- if (!projectName) {
19
- const response = await (0, prompts.default)({
20
- type: "text",
21
- name: "projectName",
22
- message: "What is your project named?",
23
- initial: "my-farm-app",
24
- validate: validateProjectName
25
- });
26
- if (!response.projectName) {
27
- require_utils.logger.error("Operation cancelled.");
28
- process.exit(1);
29
- }
30
- projectName = response.projectName;
31
- } else {
32
- const validation = validateProjectPathArg(projectName);
33
- if (validation !== true) {
34
- require_utils.logger.error(validation);
35
- process.exit(1);
36
- }
37
- }
38
- let template = options.template;
39
- if (!template) {
40
- const response = await (0, prompts.default)({
41
- type: "select",
42
- name: "template",
43
- message: "Which template would you like to use?",
44
- choices: templates.map((name) => ({
45
- title: prettifyTemplateName(name),
46
- value: name,
47
- description: name === "basic" ? "A simple Farm.js app with built-in Tailwind support" : void 0
48
- })),
49
- initial: 0
50
- });
51
- if (!response.template) {
52
- require_utils.logger.error("Operation cancelled.");
53
- process.exit(1);
54
- }
55
- template = response.template;
56
- } else if (!templates.includes(template)) {
57
- require_utils.logger.error(`Unknown template "${template}". Available: ${templates.map((t) => `"${t}"`).join(", ")}`);
58
- process.exit(1);
59
- }
60
- let useTypeScript = options.typescript;
61
- if (useTypeScript === void 0) {
62
- const response = await (0, prompts.default)({
63
- type: "confirm",
64
- name: "typescript",
65
- message: "Would you like to use TypeScript?",
66
- initial: true
67
- });
68
- if (response.typescript === void 0) {
69
- require_utils.logger.error("Operation cancelled.");
70
- process.exit(1);
71
- }
72
- useTypeScript = response.typescript;
73
- }
74
- const projectPath = path.default.resolve(process.cwd(), projectName);
75
- if (await directoryHasFiles(projectPath)) {
76
- if (!(await (0, prompts.default)({
77
- type: "confirm",
78
- name: "overwrite",
79
- message: `Directory "${projectName}" is not empty. Continue and overwrite conflicting files?`,
80
- initial: false
81
- })).overwrite) {
82
- require_utils.logger.error("Operation cancelled.");
83
- process.exit(1);
84
- }
85
- }
86
- require_utils.logger.info(`Creating Farm.js app in ${projectPath}`);
87
- await fs_promises.default.mkdir(projectPath, { recursive: true });
88
- await copyTemplate(template, projectPath, useTypeScript);
89
- await updatePackageJson(projectPath, projectName);
90
- require_utils.logger.success(`🚜 Created ${projectName}`);
91
- require_utils.logger.info("");
92
- require_utils.logger.info("Next steps");
93
- require_utils.logger.info(` cd ${projectName}`);
94
- require_utils.logger.info(" pnpm install");
95
- require_utils.logger.info(" pnpm dev");
96
- require_utils.logger.info("");
97
- require_utils.logger.info("Tailwind is enabled by default. You only need postcss config for custom plugins.");
98
- }
99
- async function copyTemplate(template, projectPath, useTypeScript) {
100
- await copyDir(path.default.join(__dirname, "..", "templates", template), projectPath);
101
- if (useTypeScript) {
102
- const tsTemplatePath = path.default.join(__dirname, "..", "templates", "_typescript");
103
- if (await dirExists(tsTemplatePath)) await copyDir(tsTemplatePath, projectPath);
104
- }
105
- }
106
- async function copyDir(src, dest) {
107
- await fs_promises.default.mkdir(dest, { recursive: true });
108
- const entries = await fs_promises.default.readdir(src, { withFileTypes: true });
109
- for (const entry of entries) {
110
- const srcPath = path.default.join(src, entry.name);
111
- const destPath = path.default.join(dest, entry.name);
112
- if (entry.isDirectory()) await copyDir(srcPath, destPath);
113
- else await fs_promises.default.copyFile(srcPath, destPath);
114
- }
115
- }
116
- async function dirExists(path$2) {
117
- try {
118
- return (await fs_promises.default.stat(path$2)).isDirectory();
119
- } catch {
120
- return false;
121
- }
122
- }
123
- async function directoryHasFiles(dirPath) {
124
- if (!await dirExists(dirPath)) return false;
125
- return (await fs_promises.default.readdir(dirPath)).length > 0;
126
- }
127
- function validateProjectName(value) {
128
- const trimmed = value.trim();
129
- if (!trimmed) return "Project name is required";
130
- if (!/^[a-z0-9._-]+$/i.test(trimmed)) return "Use letters, numbers, hyphens, underscores, or dots";
131
- if (trimmed.startsWith(".") || trimmed.startsWith("_")) return "Project name cannot start with '.' or '_'";
132
- return true;
133
- }
134
- function validateProjectPathArg(value) {
135
- const trimmed = value.trim();
136
- if (!trimmed) return "Project name is required";
137
- const normalized = trimmed.replace(/[\\/]+$/, "");
138
- const baseName = path.default.basename(normalized);
139
- if (!baseName || baseName === "." || baseName === "..") return "Please provide a valid project directory name";
140
- return validateProjectName(baseName);
141
- }
142
- function prettifyTemplateName(name) {
143
- return name.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
144
- }
145
- async function getAvailableTemplates() {
146
- const templatesRoot = path.default.join(__dirname, "..", "templates");
147
- return (await fs_promises.default.readdir(templatesRoot, { withFileTypes: true })).filter((entry) => entry.isDirectory() && !entry.name.startsWith("_")).map((entry) => entry.name).sort();
148
- }
149
- async function updatePackageJson(projectPath, projectName) {
150
- const packageJsonPath = path.default.join(projectPath, "package.json");
151
- try {
152
- const content = await fs_promises.default.readFile(packageJsonPath, "utf-8");
153
- const packageJson = JSON.parse(content);
154
- packageJson.name = projectName;
155
- await fs_promises.default.writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`);
156
- } catch (error) {
157
- require_utils.logger.warn("Could not update package.json");
158
- }
159
- }
160
- //#endregion
161
- exports.createApp = createApp;
162
-
163
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["fs","path"],"sources":["../src/index.ts"],"sourcesContent":["import prompts from \"prompts\";\nimport path from \"path\";\nimport fs from \"fs/promises\";\nimport { logger, showBanner } from \"./utils\";\n\ninterface CreateAppOptions {\n template?: string;\n typescript?: boolean;\n}\n\nexport async function createApp(projectName?: string, options: CreateAppOptions = {}) {\n showBanner();\n\n const templates = await getAvailableTemplates();\n if (templates.length === 0) {\n logger.error(\"No templates are available in this package.\");\n process.exit(1);\n }\n\n // Get project name if not provided\n if (!projectName) {\n const response = await prompts({\n type: \"text\",\n name: \"projectName\",\n message: \"What is your project named?\",\n initial: \"my-farm-app\",\n validate: validateProjectName,\n });\n\n if (!response.projectName) {\n logger.error(\"Operation cancelled.\");\n process.exit(1);\n }\n\n projectName = response.projectName;\n } else {\n const validation = validateProjectPathArg(projectName);\n if (validation !== true) {\n logger.error(validation);\n process.exit(1);\n }\n }\n\n // Get template if not provided\n let template = options.template;\n if (!template) {\n const response = await prompts({\n type: \"select\",\n name: \"template\",\n message: \"Which template would you like to use?\",\n choices: templates.map((name) => ({\n title: prettifyTemplateName(name),\n value: name,\n description:\n name === \"basic\" ? \"A simple Farm.js app with built-in Tailwind support\" : undefined,\n })),\n initial: 0,\n });\n\n if (!response.template) {\n logger.error(\"Operation cancelled.\");\n process.exit(1);\n }\n template = response.template;\n } else if (!templates.includes(template)) {\n logger.error(\n `Unknown template \"${template}\". Available: ${templates.map((t) => `\"${t}\"`).join(\", \")}`,\n );\n process.exit(1);\n }\n\n // Check TypeScript preference\n let useTypeScript = options.typescript;\n if (useTypeScript === undefined) {\n const response = await prompts({\n type: \"confirm\",\n name: \"typescript\",\n message: \"Would you like to use TypeScript?\",\n initial: true,\n });\n\n if (response.typescript === undefined) {\n logger.error(\"Operation cancelled.\");\n process.exit(1);\n }\n useTypeScript = response.typescript;\n }\n\n const projectPath = path.resolve(process.cwd(), projectName!);\n const hasExistingFiles = await directoryHasFiles(projectPath);\n if (hasExistingFiles) {\n const overwriteResponse = await prompts({\n type: \"confirm\",\n name: \"overwrite\",\n message: `Directory \"${projectName}\" is not empty. Continue and overwrite conflicting files?`,\n initial: false,\n });\n\n if (!overwriteResponse.overwrite) {\n logger.error(\"Operation cancelled.\");\n process.exit(1);\n }\n }\n\n logger.info(`Creating Farm.js app in ${projectPath}`);\n\n await fs.mkdir(projectPath, { recursive: true });\n\n await copyTemplate(template!, projectPath, useTypeScript!);\n\n await updatePackageJson(projectPath, projectName!);\n\n logger.success(`🚜 Created ${projectName}`);\n logger.info(\"\");\n logger.info(\"Next steps\");\n logger.info(` cd ${projectName}`);\n logger.info(\" pnpm install\");\n logger.info(\" pnpm dev\");\n logger.info(\"\");\n logger.info(\"Tailwind is enabled by default. You only need postcss config for custom plugins.\");\n}\n\nasync function copyTemplate(template: string, projectPath: string, useTypeScript: boolean) {\n const templatePath = path.join(__dirname, \"..\", \"templates\", template);\n\n // Copy base template files\n await copyDir(templatePath, projectPath);\n\n // If TypeScript is requested, copy TS-specific files\n if (useTypeScript) {\n const tsTemplatePath = path.join(__dirname, \"..\", \"templates\", \"_typescript\");\n if (await dirExists(tsTemplatePath)) {\n await copyDir(tsTemplatePath, projectPath);\n }\n }\n}\n\nasync function copyDir(src: string, dest: string) {\n await fs.mkdir(dest, { recursive: true });\n\n const entries = await fs.readdir(src, { withFileTypes: true });\n\n for (const entry of entries) {\n const srcPath = path.join(src, entry.name);\n const destPath = path.join(dest, entry.name);\n\n if (entry.isDirectory()) {\n await copyDir(srcPath, destPath);\n } else {\n await fs.copyFile(srcPath, destPath);\n }\n }\n}\n\nasync function dirExists(path: string): Promise<boolean> {\n try {\n const stat = await fs.stat(path);\n return stat.isDirectory();\n } catch {\n return false;\n }\n}\n\nasync function directoryHasFiles(dirPath: string): Promise<boolean> {\n if (!(await dirExists(dirPath))) {\n return false;\n }\n const files = await fs.readdir(dirPath);\n return files.length > 0;\n}\n\nfunction validateProjectName(value: string): true | string {\n const trimmed = value.trim();\n if (!trimmed) {\n return \"Project name is required\";\n }\n\n // npm package-safe pattern\n if (!/^[a-z0-9._-]+$/i.test(trimmed)) {\n return \"Use letters, numbers, hyphens, underscores, or dots\";\n }\n\n if (trimmed.startsWith(\".\") || trimmed.startsWith(\"_\")) {\n return \"Project name cannot start with '.' or '_'\";\n }\n\n return true;\n}\n\nfunction validateProjectPathArg(value: string): true | string {\n const trimmed = value.trim();\n if (!trimmed) {\n return \"Project name is required\";\n }\n\n const normalized = trimmed.replace(/[\\\\/]+$/, \"\");\n const baseName = path.basename(normalized);\n if (!baseName || baseName === \".\" || baseName === \"..\") {\n return \"Please provide a valid project directory name\";\n }\n\n return validateProjectName(baseName);\n}\n\nfunction prettifyTemplateName(name: string): string {\n return name\n .split(\"-\")\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join(\" \");\n}\n\nasync function getAvailableTemplates(): Promise<string[]> {\n const templatesRoot = path.join(__dirname, \"..\", \"templates\");\n const entries = await fs.readdir(templatesRoot, { withFileTypes: true });\n return entries\n .filter((entry) => entry.isDirectory() && !entry.name.startsWith(\"_\"))\n .map((entry) => entry.name)\n .sort();\n}\n\nasync function updatePackageJson(projectPath: string, projectName: string) {\n const packageJsonPath = path.join(projectPath, \"package.json\");\n\n try {\n const content = await fs.readFile(packageJsonPath, \"utf-8\");\n const packageJson = JSON.parse(content);\n\n packageJson.name = projectName;\n\n await fs.writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\\n`);\n } catch (error) {\n logger.warn(\"Could not update package.json\");\n }\n}\n"],"mappings":";;;;;;;;;;AAUA,eAAsB,UAAU,aAAsB,UAA4B,CAAC,GAAG;CACpF,cAAA,WAAW;CAEX,MAAM,YAAY,MAAM,sBAAsB;CAC9C,IAAI,UAAU,WAAW,GAAG;EAC1B,cAAA,OAAO,MAAM,6CAA6C;EAC1D,QAAQ,KAAK,CAAC;CAChB;CAGA,IAAI,CAAC,aAAa;EAChB,MAAM,WAAW,OAAA,GAAM,QAAA,QAAA,CAAQ;GAC7B,MAAM;GACN,MAAM;GACN,SAAS;GACT,SAAS;GACT,UAAU;EACZ,CAAC;EAED,IAAI,CAAC,SAAS,aAAa;GACzB,cAAA,OAAO,MAAM,sBAAsB;GACnC,QAAQ,KAAK,CAAC;EAChB;EAEA,cAAc,SAAS;CACzB,OAAO;EACL,MAAM,aAAa,uBAAuB,WAAW;EACrD,IAAI,eAAe,MAAM;GACvB,cAAA,OAAO,MAAM,UAAU;GACvB,QAAQ,KAAK,CAAC;EAChB;CACF;CAGA,IAAI,WAAW,QAAQ;CACvB,IAAI,CAAC,UAAU;EACb,MAAM,WAAW,OAAA,GAAM,QAAA,QAAA,CAAQ;G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AAG,KAAK,UAAU,aAAa,MAAM,CAAC,EAAE,GAAG;CACjF,SAAS,OAAO;EACd,cAAA,OAAO,KAAK,+BAA+B;CAC7C;AACF"}
package/dist/index.mjs DELETED
@@ -1,158 +0,0 @@
1
- import { logger, showBanner } from "./utils.mjs";
2
- import prompts from "prompts";
3
- import path from "path";
4
- import fs from "fs/promises";
5
- //#region src/index.ts
6
- async function createApp(projectName, options = {}) {
7
- showBanner();
8
- const templates = await getAvailableTemplates();
9
- if (templates.length === 0) {
10
- logger.error("No templates are available in this package.");
11
- process.exit(1);
12
- }
13
- if (!projectName) {
14
- const response = await prompts({
15
- type: "text",
16
- name: "projectName",
17
- message: "What is your project named?",
18
- initial: "my-farm-app",
19
- validate: validateProjectName
20
- });
21
- if (!response.projectName) {
22
- logger.error("Operation cancelled.");
23
- process.exit(1);
24
- }
25
- projectName = response.projectName;
26
- } else {
27
- const validation = validateProjectPathArg(projectName);
28
- if (validation !== true) {
29
- logger.error(validation);
30
- process.exit(1);
31
- }
32
- }
33
- let template = options.template;
34
- if (!template) {
35
- const response = await prompts({
36
- type: "select",
37
- name: "template",
38
- message: "Which template would you like to use?",
39
- choices: templates.map((name) => ({
40
- title: prettifyTemplateName(name),
41
- value: name,
42
- description: name === "basic" ? "A simple Farm.js app with built-in Tailwind support" : void 0
43
- })),
44
- initial: 0
45
- });
46
- if (!response.template) {
47
- logger.error("Operation cancelled.");
48
- process.exit(1);
49
- }
50
- template = response.template;
51
- } else if (!templates.includes(template)) {
52
- logger.error(`Unknown template "${template}". Available: ${templates.map((t) => `"${t}"`).join(", ")}`);
53
- process.exit(1);
54
- }
55
- let useTypeScript = options.typescript;
56
- if (useTypeScript === void 0) {
57
- const response = await prompts({
58
- type: "confirm",
59
- name: "typescript",
60
- message: "Would you like to use TypeScript?",
61
- initial: true
62
- });
63
- if (response.typescript === void 0) {
64
- logger.error("Operation cancelled.");
65
- process.exit(1);
66
- }
67
- useTypeScript = response.typescript;
68
- }
69
- const projectPath = path.resolve(process.cwd(), projectName);
70
- if (await directoryHasFiles(projectPath)) {
71
- if (!(await prompts({
72
- type: "confirm",
73
- name: "overwrite",
74
- message: `Directory "${projectName}" is not empty. Continue and overwrite conflicting files?`,
75
- initial: false
76
- })).overwrite) {
77
- logger.error("Operation cancelled.");
78
- process.exit(1);
79
- }
80
- }
81
- logger.info(`Creating Farm.js app in ${projectPath}`);
82
- await fs.mkdir(projectPath, { recursive: true });
83
- await copyTemplate(template, projectPath, useTypeScript);
84
- await updatePackageJson(projectPath, projectName);
85
- logger.success(`🚜 Created ${projectName}`);
86
- logger.info("");
87
- logger.info("Next steps");
88
- logger.info(` cd ${projectName}`);
89
- logger.info(" pnpm install");
90
- logger.info(" pnpm dev");
91
- logger.info("");
92
- logger.info("Tailwind is enabled by default. You only need postcss config for custom plugins.");
93
- }
94
- async function copyTemplate(template, projectPath, useTypeScript) {
95
- await copyDir(path.join(__dirname, "..", "templates", template), projectPath);
96
- if (useTypeScript) {
97
- const tsTemplatePath = path.join(__dirname, "..", "templates", "_typescript");
98
- if (await dirExists(tsTemplatePath)) await copyDir(tsTemplatePath, projectPath);
99
- }
100
- }
101
- async function copyDir(src, dest) {
102
- await fs.mkdir(dest, { recursive: true });
103
- const entries = await fs.readdir(src, { withFileTypes: true });
104
- for (const entry of entries) {
105
- const srcPath = path.join(src, entry.name);
106
- const destPath = path.join(dest, entry.name);
107
- if (entry.isDirectory()) await copyDir(srcPath, destPath);
108
- else await fs.copyFile(srcPath, destPath);
109
- }
110
- }
111
- async function dirExists(path) {
112
- try {
113
- return (await fs.stat(path)).isDirectory();
114
- } catch {
115
- return false;
116
- }
117
- }
118
- async function directoryHasFiles(dirPath) {
119
- if (!await dirExists(dirPath)) return false;
120
- return (await fs.readdir(dirPath)).length > 0;
121
- }
122
- function validateProjectName(value) {
123
- const trimmed = value.trim();
124
- if (!trimmed) return "Project name is required";
125
- if (!/^[a-z0-9._-]+$/i.test(trimmed)) return "Use letters, numbers, hyphens, underscores, or dots";
126
- if (trimmed.startsWith(".") || trimmed.startsWith("_")) return "Project name cannot start with '.' or '_'";
127
- return true;
128
- }
129
- function validateProjectPathArg(value) {
130
- const trimmed = value.trim();
131
- if (!trimmed) return "Project name is required";
132
- const normalized = trimmed.replace(/[\\/]+$/, "");
133
- const baseName = path.basename(normalized);
134
- if (!baseName || baseName === "." || baseName === "..") return "Please provide a valid project directory name";
135
- return validateProjectName(baseName);
136
- }
137
- function prettifyTemplateName(name) {
138
- return name.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
139
- }
140
- async function getAvailableTemplates() {
141
- const templatesRoot = path.join(__dirname, "..", "templates");
142
- return (await fs.readdir(templatesRoot, { withFileTypes: true })).filter((entry) => entry.isDirectory() && !entry.name.startsWith("_")).map((entry) => entry.name).sort();
143
- }
144
- async function updatePackageJson(projectPath, projectName) {
145
- const packageJsonPath = path.join(projectPath, "package.json");
146
- try {
147
- const content = await fs.readFile(packageJsonPath, "utf-8");
148
- const packageJson = JSON.parse(content);
149
- packageJson.name = projectName;
150
- await fs.writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`);
151
- } catch (error) {
152
- logger.warn("Could not update package.json");
153
- }
154
- }
155
- //#endregion
156
- export { createApp };
157
-
158
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import prompts from \"prompts\";\nimport path from \"path\";\nimport fs from \"fs/promises\";\nimport { logger, showBanner } from \"./utils\";\n\ninterface CreateAppOptions {\n template?: string;\n typescript?: boolean;\n}\n\nexport async function createApp(projectName?: string, options: CreateAppOptions = {}) {\n showBanner();\n\n const templates = await getAvailableTemplates();\n if (templates.length === 0) {\n logger.error(\"No templates are available in this package.\");\n process.exit(1);\n }\n\n // Get project name if not provided\n if (!projectName) {\n const response = await prompts({\n type: \"text\",\n name: \"projectName\",\n message: \"What is your project named?\",\n initial: \"my-farm-app\",\n validate: validateProjectName,\n });\n\n if (!response.projectName) {\n logger.error(\"Operation cancelled.\");\n process.exit(1);\n }\n\n projectName = response.projectName;\n } else {\n const validation = validateProjectPathArg(projectName);\n if (validation !== true) {\n logger.error(validation);\n process.exit(1);\n }\n }\n\n // Get template if not provided\n let template = options.template;\n if (!template) {\n const response = await prompts({\n type: \"select\",\n name: \"template\",\n message: \"Which template would you like to use?\",\n choices: templates.map((name) => ({\n title: prettifyTemplateName(name),\n value: name,\n description:\n name === \"basic\" ? \"A simple Farm.js app with built-in Tailwind support\" : undefined,\n })),\n initial: 0,\n });\n\n if (!response.template) {\n logger.error(\"Operation cancelled.\");\n process.exit(1);\n }\n template = response.template;\n } else if (!templates.includes(template)) {\n logger.error(\n `Unknown template \"${template}\". Available: ${templates.map((t) => `\"${t}\"`).join(\", \")}`,\n );\n process.exit(1);\n }\n\n // Check TypeScript preference\n let useTypeScript = options.typescript;\n if (useTypeScript === undefined) {\n const response = await prompts({\n type: \"confirm\",\n name: \"typescript\",\n message: \"Would you like to use TypeScript?\",\n initial: true,\n });\n\n if (response.typescript === undefined) {\n logger.error(\"Operation cancelled.\");\n process.exit(1);\n }\n useTypeScript = response.typescript;\n }\n\n const projectPath = path.resolve(process.cwd(), projectName!);\n const hasExistingFiles = await directoryHasFiles(projectPath);\n if (hasExistingFiles) {\n const overwriteResponse = await prompts({\n type: \"confirm\",\n name: \"overwrite\",\n message: `Directory \"${projectName}\" is not empty. Continue and overwrite conflicting files?`,\n initial: false,\n });\n\n if (!overwriteResponse.overwrite) {\n logger.error(\"Operation cancelled.\");\n process.exit(1);\n }\n }\n\n logger.info(`Creating Farm.js app in ${projectPath}`);\n\n await fs.mkdir(projectPath, { recursive: true });\n\n await copyTemplate(template!, projectPath, useTypeScript!);\n\n await updatePackageJson(projectPath, projectName!);\n\n logger.success(`🚜 Created ${projectName}`);\n logger.info(\"\");\n logger.info(\"Next steps\");\n logger.info(` cd ${projectName}`);\n logger.info(\" pnpm install\");\n logger.info(\" pnpm dev\");\n logger.info(\"\");\n logger.info(\"Tailwind is enabled by default. You only need postcss config for custom plugins.\");\n}\n\nasync function copyTemplate(template: string, projectPath: string, useTypeScript: boolean) {\n const templatePath = path.join(__dirname, \"..\", \"templates\", template);\n\n // Copy base template files\n await copyDir(templatePath, projectPath);\n\n // If TypeScript is requested, copy TS-specific files\n if (useTypeScript) {\n const tsTemplatePath = path.join(__dirname, \"..\", \"templates\", \"_typescript\");\n if (await dirExists(tsTemplatePath)) {\n await copyDir(tsTemplatePath, projectPath);\n }\n }\n}\n\nasync function copyDir(src: string, dest: string) {\n await fs.mkdir(dest, { recursive: true });\n\n const entries = await fs.readdir(src, { withFileTypes: true });\n\n for (const entry of entries) {\n const srcPath = path.join(src, entry.name);\n const destPath = path.join(dest, entry.name);\n\n if (entry.isDirectory()) {\n await copyDir(srcPath, destPath);\n } else {\n await fs.copyFile(srcPath, destPath);\n }\n }\n}\n\nasync function dirExists(path: string): Promise<boolean> {\n try {\n const stat = await fs.stat(path);\n return stat.isDirectory();\n } catch {\n return false;\n }\n}\n\nasync function directoryHasFiles(dirPath: string): Promise<boolean> {\n if (!(await dirExists(dirPath))) {\n return false;\n }\n const files = await fs.readdir(dirPath);\n return files.length > 0;\n}\n\nfunction validateProjectName(value: string): true | string {\n const trimmed = value.trim();\n if (!trimmed) {\n return \"Project name is required\";\n }\n\n // npm package-safe pattern\n if (!/^[a-z0-9._-]+$/i.test(trimmed)) {\n return \"Use letters, numbers, hyphens, underscores, or dots\";\n }\n\n if (trimmed.startsWith(\".\") || trimmed.startsWith(\"_\")) {\n return \"Project name cannot start with '.' or '_'\";\n }\n\n return true;\n}\n\nfunction validateProjectPathArg(value: string): true | string {\n const trimmed = value.trim();\n if (!trimmed) {\n return \"Project name is required\";\n }\n\n const normalized = trimmed.replace(/[\\\\/]+$/, \"\");\n const baseName = path.basename(normalized);\n if (!baseName || baseName === \".\" || baseName === \"..\") {\n return \"Please provide a valid project directory name\";\n }\n\n return validateProjectName(baseName);\n}\n\nfunction prettifyTemplateName(name: string): string {\n return name\n .split(\"-\")\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join(\" \");\n}\n\nasync function getAvailableTemplates(): Promise<string[]> {\n const templatesRoot = path.join(__dirname, \"..\", \"templates\");\n const entries = await fs.readdir(templatesRoot, { withFileTypes: true });\n return entries\n .filter((entry) => entry.isDirectory() && !entry.name.startsWith(\"_\"))\n .map((entry) => entry.name)\n .sort();\n}\n\nasync function updatePackageJson(projectPath: string, projectName: string) {\n const packageJsonPath = path.join(projectPath, \"package.json\");\n\n try {\n const content = await fs.readFile(packageJsonPath, \"utf-8\");\n const packageJson = JSON.parse(content);\n\n packageJson.name = projectName;\n\n await fs.writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\\n`);\n } catch (error) {\n logger.warn(\"Could not update package.json\");\n }\n}\n"],"mappings":";;;;;AAUA,eAAsB,UAAU,aAAsB,UAA4B,CAAC,GAAG;CACpF,WAAW;CAEX,MAAM,YAAY,MAAM,sBAAsB;CAC9C,IAAI,UAAU,WAAW,GAAG;EAC1B,OAAO,MAAM,6CAA6C;EAC1D,QAAQ,KAAK,CAAC;CAChB;CAGA,IAAI,CAAC,aAAa;EAChB,MAAM,WAAW,MAAM,QAAQ;GAC7B,MAAM;GACN,MAAM;GACN,SAAS;GACT,SAAS;GACT,UAAU;EACZ,CAAC;EAED,IAAI,CAAC,SAAS,aAAa;GACzB,OAAO,MAAM,sBAAsB;GACnC,QAAQ,KAAK,CAAC;EAChB;EAEA,cAAc,SAAS;CACzB,OAAO;EACL,MAAM,aAAa,uBAAuB,WAAW;EACrD,IAAI,eAAe,MAAM;GACvB,OAAO,MAAM,UAAU;GACvB,QAAQ,KAAK,CAAC;EAChB;CACF;CAGA,IAAI,WAAW,QAAQ;CACvB,IAAI,CAAC,UAAU;EACb,MAAM,WAAW,MAAM,QAAQ;GAC7B,MAAM;GACN,MAAM;GACN,SAAS;GACT,SAAS,UAAU,KAAK,UAAU;IAChC,OAAO,qBAAqB,IA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,MAAM,UAAU,MAAM,KAAK;CAC3B,IAAI,CAAC,SACH,OAAO;CAGT,MAAM,aAAa,QAAQ,QAAQ,WAAW,EAAE;CAChD,MAAM,WAAW,KAAK,SAAS,UAAU;CACzC,IAAI,CAAC,YAAY,aAAa,OAAO,aAAa,MAChD,OAAO;CAGT,OAAO,oBAAoB,QAAQ;AACrC;AAEA,SAAS,qBAAqB,MAAsB;CAClD,OAAO,KACJ,MAAM,GAAG,CAAC,CACV,KAAK,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAC3D,KAAK,GAAG;AACb;AAEA,eAAe,wBAA2C;CACxD,MAAM,gBAAgB,KAAK,KAAK,WAAW,MAAM,WAAW;CAE5D,QAAO,MADe,GAAG,QAAQ,eAAe,EAAE,eAAe,KAAK,CAAC,EAAA,CAEpE,QAAQ,UAAU,MAAM,YAAY,KAAK,CAAC,MAAM,KAAK,WAAW,GAAG,CAAC,CAAC,CACrE,KAAK,UAAU,MAAM,IAAI,CAAC,CAC1B,KAAK;AACV;AAEA,eAAe,kBAAkB,aAAqB,aAAqB;CACzE,MAAM,kBAAkB,KAAK,KAAK,aAAa,cAAc;CAE7D,IAAI;EACF,MAAM,UAAU,MAAM,GAAG,SAAS,iBAAiB,OAAO;EAC1D,MAAM,cAAc,KAAK,MAAM,OAAO;EAEtC,YAAY,OAAO;EAEnB,MAAM,GAAG,UAAU,iBAAiB,GAAG,KAAK,UAAU,aAAa,MAAM,CAAC,EAAE,GAAG;CACjF,SAAS,OAAO;EACd,OAAO,KAAK,+BAA+B;CAC7C;AACF"}
@@ -1,28 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
19
- value: mod,
20
- enumerable: true
21
- }) : target, mod));
22
- //#endregion
23
- Object.defineProperty(exports, "__toESM", {
24
- enumerable: true,
25
- get: function() {
26
- return __toESM;
27
- }
28
- });
package/dist/utils.js DELETED
@@ -1,29 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.js");
3
- let picocolors = require("picocolors");
4
- picocolors = require_rolldown_runtime.__toESM(picocolors);
5
- //#region src/utils.ts
6
- const logger = {
7
- info: (message) => console.log(`${picocolors.default.blue("ℹ")} ${message}`),
8
- success: (message) => console.log(`${picocolors.default.green("✓")} ${message}`),
9
- warn: (message) => console.warn(`${picocolors.default.yellow("⚠")} ${message}`),
10
- error: (message) => console.error(`${picocolors.default.red("✗")} ${message}`)
11
- };
12
- function showBanner() {
13
- const art = [
14
- " _______ ",
15
- "| ___ |__ _ _ __ _ __ ___ ",
16
- "| |_ /| / _` | '__| '_ ` _ \\ ",
17
- "| _ \\| | (_| | | | | | | | | ",
18
- "|_| \\_\\_|\\__,_|_| |_| |_| |_|"
19
- ];
20
- console.log("");
21
- for (const line of art) console.log(picocolors.default.cyan(line));
22
- console.log(picocolors.default.bold(picocolors.default.green("Create Farm.js App")) + picocolors.default.dim(" modern React meta-framework"));
23
- console.log("");
24
- }
25
- //#endregion
26
- exports.logger = logger;
27
- exports.showBanner = showBanner;
28
-
29
- //# sourceMappingURL=utils.js.map
package/dist/utils.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","names":["pc"],"sources":["../src/utils.ts"],"sourcesContent":["import pc from \"picocolors\";\n\nexport const logger = {\n info: (message: string) => console.log(`${pc.blue(\"ℹ\")} ${message}`),\n success: (message: string) => console.log(`${pc.green(\"✓\")} ${message}`),\n warn: (message: string) => console.warn(`${pc.yellow(\"⚠\")} ${message}`),\n error: (message: string) => console.error(`${pc.red(\"✗\")} ${message}`),\n};\n\nexport function showBanner() {\n const art = [\n \" _______ \",\n \"| ___ |__ _ _ __ _ __ ___ \",\n \"| |_ /| / _` | '__| '_ ` _ \\\\ \",\n \"| _ \\\\| | (_| | | | | | | | | \",\n \"|_| \\\\_\\\\_|\\\\__,_|_| |_| |_| |_|\",\n ];\n\n console.log(\"\");\n for (const line of art) {\n console.log(pc.cyan(line));\n }\n console.log(pc.bold(pc.green(\"Create Farm.js App\")) + pc.dim(\" modern React meta-framework\"));\n console.log(\"\");\n}\n"],"mappings":";;;;;AAEA,MAAa,SAAS;CACpB,OAAO,YAAoB,QAAQ,IAAI,GAAGA,WAAAA,QAAG,KAAK,GAAG,EAAE,GAAG,SAAS;CACnE,UAAU,YAAoB,QAAQ,IAAI,GAAGA,WAAAA,QAAG,MAAM,GAAG,EAAE,GAAG,SAAS;CACvE,OAAO,YAAoB,QAAQ,KAAK,GAAGA,WAAAA,QAAG,OAAO,GAAG,EAAE,GAAG,SAAS;CACtE,QAAQ,YAAoB,QAAQ,MAAM,GAAGA,WAAAA,QAAG,IAAI,GAAG,EAAE,GAAG,SAAS;AACvE;AAEA,SAAgB,aAAa;CAC3B,MAAM,MAAM;EACV;EACA;EACA;EACA;EACA;CACF;CAEA,QAAQ,IAAI,EAAE;CACd,KAAK,MAAM,QAAQ,KACjB,QAAQ,IAAIA,WAAAA,QAAG,KAAK,IAAI,CAAC;CAE3B,QAAQ,IAAIA,WAAAA,QAAG,KAAKA,WAAAA,QAAG,MAAM,oBAAoB,CAAC,IAAIA,WAAAA,QAAG,IAAI,+BAA+B,CAAC;CAC7F,QAAQ,IAAI,EAAE;AAChB"}
package/dist/utils.mjs DELETED
@@ -1,25 +0,0 @@
1
- import pc from "picocolors";
2
- //#region src/utils.ts
3
- const logger = {
4
- info: (message) => console.log(`${pc.blue("ℹ")} ${message}`),
5
- success: (message) => console.log(`${pc.green("✓")} ${message}`),
6
- warn: (message) => console.warn(`${pc.yellow("⚠")} ${message}`),
7
- error: (message) => console.error(`${pc.red("✗")} ${message}`)
8
- };
9
- function showBanner() {
10
- const art = [
11
- " _______ ",
12
- "| ___ |__ _ _ __ _ __ ___ ",
13
- "| |_ /| / _` | '__| '_ ` _ \\ ",
14
- "| _ \\| | (_| | | | | | | | | ",
15
- "|_| \\_\\_|\\__,_|_| |_| |_| |_|"
16
- ];
17
- console.log("");
18
- for (const line of art) console.log(pc.cyan(line));
19
- console.log(pc.bold(pc.green("Create Farm.js App")) + pc.dim(" modern React meta-framework"));
20
- console.log("");
21
- }
22
- //#endregion
23
- export { logger, showBanner };
24
-
25
- //# sourceMappingURL=utils.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.mjs","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import pc from \"picocolors\";\n\nexport const logger = {\n info: (message: string) => console.log(`${pc.blue(\"ℹ\")} ${message}`),\n success: (message: string) => console.log(`${pc.green(\"✓\")} ${message}`),\n warn: (message: string) => console.warn(`${pc.yellow(\"⚠\")} ${message}`),\n error: (message: string) => console.error(`${pc.red(\"✗\")} ${message}`),\n};\n\nexport function showBanner() {\n const art = [\n \" _______ \",\n \"| ___ |__ _ _ __ _ __ ___ \",\n \"| |_ /| / _` | '__| '_ ` _ \\\\ \",\n \"| _ \\\\| | (_| | | | | | | | | \",\n \"|_| \\\\_\\\\_|\\\\__,_|_| |_| |_| |_|\",\n ];\n\n console.log(\"\");\n for (const line of art) {\n console.log(pc.cyan(line));\n }\n console.log(pc.bold(pc.green(\"Create Farm.js App\")) + pc.dim(\" modern React meta-framework\"));\n console.log(\"\");\n}\n"],"mappings":";;AAEA,MAAa,SAAS;CACpB,OAAO,YAAoB,QAAQ,IAAI,GAAG,GAAG,KAAK,GAAG,EAAE,GAAG,SAAS;CACnE,UAAU,YAAoB,QAAQ,IAAI,GAAG,GAAG,MAAM,GAAG,EAAE,GAAG,SAAS;CACvE,OAAO,YAAoB,QAAQ,KAAK,GAAG,GAAG,OAAO,GAAG,EAAE,GAAG,SAAS;CACtE,QAAQ,YAAoB,QAAQ,MAAM,GAAG,GAAG,IAAI,GAAG,EAAE,GAAG,SAAS;AACvE;AAEA,SAAgB,aAAa;CAC3B,MAAM,MAAM;EACV;EACA;EACA;EACA;EACA;CACF;CAEA,QAAQ,IAAI,EAAE;CACd,KAAK,MAAM,QAAQ,KACjB,QAAQ,IAAI,GAAG,KAAK,IAAI,CAAC;CAE3B,QAAQ,IAAI,GAAG,KAAK,GAAG,MAAM,oBAAoB,CAAC,IAAI,GAAG,IAAI,+BAA+B,CAAC;CAC7F,QAAQ,IAAI,EAAE;AAChB"}