beever-create 0.0.0-stage → 0.1.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/dist/index.js +70 -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/README.md +0 -3
package/dist/index.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
var projectName = process.argv[2];
|
|
8
|
+
if (!projectName) {
|
|
9
|
+
console.log("Please provide a project name.");
|
|
10
|
+
console.log("Usage: npx beever-create <project-name>");
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
var validProjectName = /^[a-zA-Z0-9_-]+$/.test(projectName);
|
|
14
|
+
if (!validProjectName) {
|
|
15
|
+
console.error(
|
|
16
|
+
"Invalid project name. Use only letters, numbers, hyphens, and underscores."
|
|
17
|
+
);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
var projectPath = path.resolve(process.cwd(), projectName);
|
|
21
|
+
if (fs.existsSync(projectPath)) {
|
|
22
|
+
console.error(`A folder named "${projectName}" already exists.`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
var currentDirectory = path.dirname(fileURLToPath(import.meta.url));
|
|
26
|
+
var templatesPath = path.resolve(currentDirectory, "../templates");
|
|
27
|
+
var packageName = projectName.toLowerCase().replace(/_/g, "-");
|
|
28
|
+
function replaceProjectName(directory) {
|
|
29
|
+
const entries = fs.readdirSync(directory, {
|
|
30
|
+
withFileTypes: true
|
|
31
|
+
});
|
|
32
|
+
for (const entry of entries) {
|
|
33
|
+
const entryPath = path.join(directory, entry.name);
|
|
34
|
+
if (entry.isDirectory()) {
|
|
35
|
+
replaceProjectName(entryPath);
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const content = fs.readFileSync(entryPath, "utf8");
|
|
39
|
+
if (content.includes("{{projectName}}")) {
|
|
40
|
+
fs.writeFileSync(
|
|
41
|
+
entryPath,
|
|
42
|
+
content.split("{{projectName}}").join(packageName),
|
|
43
|
+
"utf8"
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
if (!fs.existsSync(templatesPath)) {
|
|
50
|
+
throw new Error("Project templates directory not found.");
|
|
51
|
+
}
|
|
52
|
+
fs.mkdirSync(projectPath);
|
|
53
|
+
fs.cpSync(templatesPath, projectPath, {
|
|
54
|
+
recursive: true
|
|
55
|
+
});
|
|
56
|
+
replaceProjectName(projectPath);
|
|
57
|
+
console.log("Beever project created successfully!");
|
|
58
|
+
console.log(`Project location: ${projectPath}`);
|
|
59
|
+
} catch (error) {
|
|
60
|
+
console.error("Failed to create Beever project.");
|
|
61
|
+
if (fs.existsSync(projectPath)) {
|
|
62
|
+
fs.rmSync(projectPath, {
|
|
63
|
+
recursive: true,
|
|
64
|
+
force: true
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
console.error(error);
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
//# 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 { 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(\"Beever project created successfully!\");\r\n console.log(`Project location: ${projectPath}`);\r\n} catch (error) {\r\n console.error(\"Failed 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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AAwC;AAAA,EAC1D;AAEA,KAAG,UAAU,WAAW;AAExB,KAAG,OAAO,eAAe,aAAa;AAAA,IACpC,WAAW;AAAA,EACb,CAAC;AAED,qBAAmB,WAAW;AAE9B,UAAQ,IAAI,sCAAsC;AAClD,UAAQ,IAAI,qBAAqB,WAAW,EAAE;AAChD,SAAS,OAAO;AACd,UAAQ,MAAM,kCAAkC;AAEhD,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;","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.0",
|
|
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 --root web",
|
|
8
|
+
"build:web": "vite build --root web",
|
|
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";
|
|
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