beever-create 0.0.0-stage → 0.1.1
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/dist/index.js +88 -0
- package/dist/index.js.map +1 -0
- package/package.json +22 -6
- package/templates/README.md +37 -0
- package/templates/features/welcome/index.ts +2 -0
- package/templates/features/welcome/pages/WelcomePage.tsx +8 -0
- package/templates/features/welcome/screens/WelcomeScreen.tsx +24 -0
- package/templates/mobile/App.tsx +5 -0
- package/templates/mobile/app.json +9 -0
- package/templates/mobile/index.ts +4 -0
- package/templates/package.json +25 -0
- package/templates/shared/index.ts +1 -0
- package/templates/web/index.html +12 -0
- package/templates/web/main.tsx +10 -0
- package/templates/web/vite.config.ts +8 -0
- package/README.md +0 -3
package/dist/index.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import { spawnSync } from "child_process";
|
|
7
|
+
import { fileURLToPath } from "url";
|
|
8
|
+
var projectName = process.argv[2];
|
|
9
|
+
if (!projectName) {
|
|
10
|
+
console.log("Please provide a project name.");
|
|
11
|
+
console.log("Usage: npx beever-create <project-name>");
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
var validProjectName = /^[a-zA-Z0-9_-]+$/.test(projectName);
|
|
15
|
+
if (!validProjectName) {
|
|
16
|
+
console.error(
|
|
17
|
+
"Invalid project name. Use only letters, numbers, hyphens, and underscores."
|
|
18
|
+
);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
var projectPath = path.resolve(process.cwd(), projectName);
|
|
22
|
+
if (fs.existsSync(projectPath)) {
|
|
23
|
+
console.error(`A folder named "${projectName}" already exists.`);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
var currentDirectory = path.dirname(fileURLToPath(import.meta.url));
|
|
27
|
+
var templatesPath = path.resolve(currentDirectory, "../templates");
|
|
28
|
+
var packageName = projectName.toLowerCase().replace(/_/g, "-");
|
|
29
|
+
function replaceProjectName(directory) {
|
|
30
|
+
const entries = fs.readdirSync(directory, {
|
|
31
|
+
withFileTypes: true
|
|
32
|
+
});
|
|
33
|
+
for (const entry of entries) {
|
|
34
|
+
const entryPath = path.join(directory, entry.name);
|
|
35
|
+
if (entry.isDirectory()) {
|
|
36
|
+
replaceProjectName(entryPath);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const content = fs.readFileSync(entryPath, "utf8");
|
|
40
|
+
if (content.includes("{{projectName}}")) {
|
|
41
|
+
fs.writeFileSync(
|
|
42
|
+
entryPath,
|
|
43
|
+
content.split("{{projectName}}").join(packageName),
|
|
44
|
+
"utf8"
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
if (!fs.existsSync(templatesPath)) {
|
|
51
|
+
throw new Error("Project templates directory not found.");
|
|
52
|
+
}
|
|
53
|
+
fs.mkdirSync(projectPath);
|
|
54
|
+
fs.cpSync(templatesPath, projectPath, {
|
|
55
|
+
recursive: true
|
|
56
|
+
});
|
|
57
|
+
replaceProjectName(projectPath);
|
|
58
|
+
console.log("\nBeever project created successfully!");
|
|
59
|
+
console.log(`Project location: ${projectPath}`);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
console.error("\nFailed to create Beever project.");
|
|
62
|
+
if (fs.existsSync(projectPath)) {
|
|
63
|
+
fs.rmSync(projectPath, {
|
|
64
|
+
recursive: true,
|
|
65
|
+
force: true
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
console.error(error);
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
console.log("\nInstalling project dependencies...\n");
|
|
72
|
+
var installResult = spawnSync("npm", ["install"], {
|
|
73
|
+
cwd: projectPath,
|
|
74
|
+
stdio: "inherit",
|
|
75
|
+
shell: process.platform === "win32"
|
|
76
|
+
});
|
|
77
|
+
if (installResult.error || installResult.status !== 0) {
|
|
78
|
+
console.error("\nDependency installation failed.");
|
|
79
|
+
console.error(`Your project was created at: ${projectPath}`);
|
|
80
|
+
console.error("You can retry by running 'npm install' inside the project.");
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
console.log("\nDependencies installed successfully!");
|
|
84
|
+
console.log("\nYour Beever project is ready!");
|
|
85
|
+
console.log("\nNext steps:");
|
|
86
|
+
console.log(` cd ${projectName}`);
|
|
87
|
+
console.log(" npm run web");
|
|
88
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import fs from \"node:fs\";\r\nimport path from \"node:path\";\r\nimport { spawnSync } from \"node:child_process\";\r\nimport { fileURLToPath } from \"node:url\";\r\n\r\nconst projectName = process.argv[2];\r\n\r\nif (!projectName) {\r\n console.log(\"Please provide a project name.\");\r\n console.log(\"Usage: npx beever-create <project-name>\");\r\n process.exit(1);\r\n}\r\n\r\nconst validProjectName = /^[a-zA-Z0-9_-]+$/.test(projectName);\r\n\r\nif (!validProjectName) {\r\n console.error(\r\n \"Invalid project name. Use only letters, numbers, hyphens, and underscores.\",\r\n );\r\n process.exit(1);\r\n}\r\n\r\nconst projectPath = path.resolve(process.cwd(), projectName);\r\n\r\nif (fs.existsSync(projectPath)) {\r\n console.error(`A folder named \"${projectName}\" already exists.`);\r\n process.exit(1);\r\n}\r\n\r\nconst currentDirectory = path.dirname(fileURLToPath(import.meta.url));\r\nconst templatesPath = path.resolve(currentDirectory, \"../templates\");\r\n\r\nconst packageName = projectName.toLowerCase().replace(/_/g, \"-\");\r\n\r\nfunction replaceProjectName(directory: string) {\r\n const entries = fs.readdirSync(directory, {\r\n withFileTypes: true,\r\n });\r\n\r\n for (const entry of entries) {\r\n const entryPath = path.join(directory, entry.name);\r\n\r\n if (entry.isDirectory()) {\r\n replaceProjectName(entryPath);\r\n continue;\r\n }\r\n\r\n const content = fs.readFileSync(entryPath, \"utf8\");\r\n\r\n if (content.includes(\"{{projectName}}\")) {\r\n fs.writeFileSync(\r\n entryPath,\r\n content.split(\"{{projectName}}\").join(packageName),\r\n \"utf8\",\r\n );\r\n }\r\n }\r\n}\r\n\r\ntry {\r\n if (!fs.existsSync(templatesPath)) {\r\n throw new Error(\"Project templates directory not found.\");\r\n }\r\n\r\n fs.mkdirSync(projectPath);\r\n\r\n fs.cpSync(templatesPath, projectPath, {\r\n recursive: true,\r\n });\r\n\r\n replaceProjectName(projectPath);\r\n\r\n console.log(\"\\nBeever project created successfully!\");\r\n console.log(`Project location: ${projectPath}`);\r\n} catch (error) {\r\n console.error(\"\\nFailed to create Beever project.\");\r\n\r\n if (fs.existsSync(projectPath)) {\r\n fs.rmSync(projectPath, {\r\n recursive: true,\r\n force: true,\r\n });\r\n }\r\n\r\n console.error(error);\r\n process.exit(1);\r\n}\r\n\r\n// Automatically install project dependencies.\r\nconsole.log(\"\\nInstalling project dependencies...\\n\");\r\n\r\nconst installResult = spawnSync(\"npm\", [\"install\"], {\r\n cwd: projectPath,\r\n stdio: \"inherit\",\r\n shell: process.platform === \"win32\",\r\n});\r\n\r\nif (installResult.error || installResult.status !== 0) {\r\n console.error(\"\\nDependency installation failed.\");\r\n console.error(`Your project was created at: ${projectPath}`);\r\n console.error(\"You can retry by running 'npm install' inside the project.\");\r\n process.exit(1);\r\n}\r\n\r\nconsole.log(\"\\nDependencies installed successfully!\");\r\nconsole.log(\"\\nYour Beever project is ready!\");\r\n\r\nconsole.log(\"\\nNext steps:\");\r\nconsole.log(` cd ${projectName}`);\r\nconsole.log(\" npm run web\");\r\n"],"mappings":";;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAE9B,IAAM,cAAc,QAAQ,KAAK,CAAC;AAElC,IAAI,CAAC,aAAa;AAChB,UAAQ,I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AAQ,IAAI,qBAAqB,WAAW,EAAE;AAChD,SAAS,OAAO;AACd,UAAQ,MAAM,oCAAoC;AAElD,MAAI,GAAG,WAAW,WAAW,GAAG;AAC9B,OAAG,OAAO,aAAa;AAAA,MACrB,WAAW;AAAA,MACX,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AAEA,UAAQ,MAAM,KAAK;AACnB,UAAQ,KAAK,CAAC;AAChB;AAGA,QAAQ,IAAI,wCAAwC;AAEpD,IAAM,gBAAgB,UAAU,OAAO,CAAC,SAAS,GAAG;AAAA,EAClD,KAAK;AAAA,EACL,OAAO;AAAA,EACP,OAAO,QAAQ,aAAa;AAC9B,CAAC;AAED,IAAI,cAAc,SAAS,cAAc,WAAW,GAAG;AACrD,UAAQ,MAAM,mCAAmC;AACjD,UAAQ,MAAM,gCAAgC,WAAW,EAAE;AAC3D,UAAQ,MAAM,4DAA4D;AAC1E,UAAQ,KAAK,CAAC;AAChB;AAEA,QAAQ,IAAI,wCAAwC;AACpD,QAAQ,IAAI,iCAAiC;AAE7C,QAAQ,IAAI,eAAe;AAC3B,QAAQ,IAAI,QAAQ,WAAW,EAAE;AACjC,QAAQ,IAAI,eAAe;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "beever-create",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "beever-create",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "CLI tool for creating Beever projects.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"beever-create": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"templates"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsup"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^20.19.0",
|
|
19
|
+
"tsup": "^9.0.0",
|
|
20
|
+
"typescript": "^6.0.3"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Beever Project
|
|
2
|
+
|
|
3
|
+
A cross-platform application built with Beever.
|
|
4
|
+
|
|
5
|
+
## Project Structure
|
|
6
|
+
|
|
7
|
+
- `features/` — Feature modules containing platform-specific UI.
|
|
8
|
+
- `shared/` — Code shared across features and platforms.
|
|
9
|
+
- `web/` — Web application entry point.
|
|
10
|
+
- `mobile/` — Mobile application entry point.
|
|
11
|
+
|
|
12
|
+
## Getting Started
|
|
13
|
+
|
|
14
|
+
Install dependencies:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Run the Web Application
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm run web
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Run the Mobile Application
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm run mobile
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Built With
|
|
33
|
+
|
|
34
|
+
- React
|
|
35
|
+
- React Native
|
|
36
|
+
- Expo
|
|
37
|
+
- Beever
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { View, Text, StyleSheet } from "react-native";
|
|
2
|
+
|
|
3
|
+
export function WelcomeScreen() {
|
|
4
|
+
return (
|
|
5
|
+
<View style={styles.container}>
|
|
6
|
+
<Text style={styles.title}>Welcome to Beever!</Text>
|
|
7
|
+
<Text>Your cross-platform project starts here.</Text>
|
|
8
|
+
</View>
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const styles = StyleSheet.create({
|
|
13
|
+
container: {
|
|
14
|
+
flex: 1,
|
|
15
|
+
alignItems: "center",
|
|
16
|
+
justifyContent: "center",
|
|
17
|
+
padding: 24,
|
|
18
|
+
},
|
|
19
|
+
title: {
|
|
20
|
+
fontSize: 24,
|
|
21
|
+
fontWeight: "bold",
|
|
22
|
+
marginBottom: 8,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{projectName}}",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"main": "mobile/index.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"web": "vite web --config web/vite.config.ts",
|
|
8
|
+
"build:web": "vite build web --config web/vite.config.ts",
|
|
9
|
+
"mobile": "expo start --config mobile/app.json"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@beever/web": "0.1.0",
|
|
13
|
+
"@beever/mobile": "0.1.0",
|
|
14
|
+
"expo": "~58.0.26",
|
|
15
|
+
"react": "19.3.0",
|
|
16
|
+
"react-dom": "19.3.0",
|
|
17
|
+
"react-native": "0.88.1"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/react": "^19.3.0",
|
|
21
|
+
"@types/react-dom": "^19.3.0",
|
|
22
|
+
"typescript": "^5.9.3",
|
|
23
|
+
"vite": "^7.3.8"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Shared code used across multiple features and platforms
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>{{projectName}}</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="root"></div>
|
|
10
|
+
<script type="module" src="/main.tsx"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createRoot } from "react-dom/client";
|
|
2
|
+
import { WelcomePage } from "../features/welcome/pages/WelcomePage";
|
|
3
|
+
|
|
4
|
+
const rootElement = document.getElementById("root");
|
|
5
|
+
|
|
6
|
+
if (!rootElement) {
|
|
7
|
+
throw new Error("Root element not found.");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
createRoot(rootElement).render(<WelcomePage />);
|
package/README.md
DELETED