create-twinbloc-app 0.1.9 → 0.1.10
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/LICENSE +21 -0
- package/README.md +5 -3
- package/bin/cli.js +238 -226
- package/package.json +6 -3
- package/template/react-native-starter/LICENSE +21 -0
- package/template/react-native-starter/package.json +2 -0
- package/template/react-native-starter/uniwind-types.d.ts +5 -5
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-composition-patterns/AGENTS.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-composition-patterns/SKILL.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-composition-patterns/rules/architecture-avoid-boolean-props.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-composition-patterns/rules/architecture-compound-components.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-composition-patterns/rules/patterns-children-over-render-props.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-composition-patterns/rules/patterns-explicit-variants.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-composition-patterns/rules/react19-no-forwardref.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-composition-patterns/rules/state-context-interface.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-composition-patterns/rules/state-decouple-implementation.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-composition-patterns/rules/state-lift-state.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/AGENTS.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/SKILL.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/animation-derived-value.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/animation-gesture-detector-press.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/animation-gpu-properties.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/design-system-compound-components.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/fonts-config-plugin.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/imports-design-system-folder.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/js-hoist-intl.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/list-performance-callbacks.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/list-performance-function-references.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/list-performance-images.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/list-performance-inline-objects.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/list-performance-item-expensive.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/list-performance-item-memo.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/list-performance-item-types.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/list-performance-virtualize.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/monorepo-native-deps-in-app.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/monorepo-single-dependency-versions.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/navigation-native-navigators.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/react-compiler-destructure-functions.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/react-compiler-reanimated-shared-values.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/react-state-dispatcher.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/react-state-fallback.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/react-state-minimize.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/rendering-no-falsy-and.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/rendering-text-in-text-component.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/scroll-position-no-state.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/state-ground-truth.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/ui-expo-image.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/ui-image-gallery.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/ui-measure-views.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/ui-menus.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/ui-native-modals.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/ui-pressable.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/ui-safe-area-scroll.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/ui-scrollview-content-inset.md +0 -0
- /package/template/react-native-starter/{.agents → agent-skills/.agents}/skills/vercel-react-native-skills/rules/ui-styling.md +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Twinbloc Studios
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -7,7 +7,8 @@ Create a React Native app with the Twinbloc starter template. This CLI scaffolds
|
|
|
7
7
|
- Expo SDK 54 project with Expo Router and typed routes
|
|
8
8
|
- React Native 0.81 + React 19 setup
|
|
9
9
|
- TypeScript-first structure with strict TS config
|
|
10
|
-
-
|
|
10
|
+
- UniWind (Universal Tailwind) for styling
|
|
11
|
+
- Built-in AI Agent Skills (Cursor, Copilot, Trae, Windsurf, etc.)
|
|
11
12
|
- Zustand store examples with persisted auth state
|
|
12
13
|
- TanStack Query with MMKV persistence
|
|
13
14
|
- Axios API client with auth-aware helpers
|
|
@@ -93,7 +94,7 @@ MyApp/
|
|
|
93
94
|
store/ # Zustand stores
|
|
94
95
|
translations/ # i18n resource files
|
|
95
96
|
app.config.ts # Env-driven Expo config
|
|
96
|
-
global.css #
|
|
97
|
+
global.css # UniWind globals
|
|
97
98
|
package.json # Scripts and dependencies
|
|
98
99
|
tsconfig.json # TypeScript config
|
|
99
100
|
```
|
|
@@ -130,7 +131,8 @@ npm run reset-project # Move starter to app-example and create a fresh app
|
|
|
130
131
|
|
|
131
132
|
- Location: `template/react-native-starter`
|
|
132
133
|
- Framework: Expo SDK 54 + Expo Router
|
|
133
|
-
- Styling:
|
|
134
|
+
- Styling: UniWind
|
|
135
|
+
- AI Readiness: Built-in Agent Skills support
|
|
134
136
|
- State: Zustand stores in `src/store`
|
|
135
137
|
- Data: TanStack Query helpers in `src/api`
|
|
136
138
|
- i18n: `src/lib/i18n` and `src/translations`
|
package/bin/cli.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { intro, outro, text, select, multiselect, spinner, isCancel, cancel, confirm } from "@clack/prompts";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import fs from "fs-extra";
|
|
5
|
-
import { spawnSync } from "child_process";
|
|
5
|
+
import { spawnSync, spawn } from "child_process";
|
|
6
6
|
import chalk from "chalk";
|
|
7
7
|
import { fileURLToPath } from "url";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import figlet from "figlet";
|
|
9
|
+
import gradient from "gradient-string";
|
|
10
10
|
|
|
11
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
12
12
|
const __dirname = path.dirname(__filename);
|
|
@@ -14,85 +14,6 @@ const packageRoot = path.resolve(__dirname, "..");
|
|
|
14
14
|
const templateRoot = path.join(packageRoot, "template", "react-native-starter");
|
|
15
15
|
const examplesRoot = path.join(packageRoot, "examples");
|
|
16
16
|
|
|
17
|
-
const program = new Command();
|
|
18
|
-
|
|
19
|
-
program
|
|
20
|
-
.name("create-twinbloc-app")
|
|
21
|
-
.argument("<project-directory>")
|
|
22
|
-
.option("--example <name>", "example variant", "base")
|
|
23
|
-
.option("--skip-install", "skip dependency installation", false)
|
|
24
|
-
.option("--pm <npm|yarn|pnpm|bun>", "force package manager")
|
|
25
|
-
.parse(process.argv);
|
|
26
|
-
|
|
27
|
-
const [projectDirectory] = program.args;
|
|
28
|
-
const options = program.opts();
|
|
29
|
-
|
|
30
|
-
if (!projectDirectory) {
|
|
31
|
-
console.error(chalk.red("Project directory is required."));
|
|
32
|
-
process.exit(1);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const targetDir = path.resolve(process.cwd(), projectDirectory);
|
|
36
|
-
|
|
37
|
-
const isEmptyDir = async (dir) => {
|
|
38
|
-
if (!fs.existsSync(dir)) return true;
|
|
39
|
-
const entries = await fs.readdir(dir);
|
|
40
|
-
return entries.length === 0;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const resolveExamplePath = (name) => {
|
|
44
|
-
if (!name || name === "base") return null;
|
|
45
|
-
return path.join(examplesRoot, name);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const detectPackageManager = () => {
|
|
49
|
-
if (options.pm) return options.pm;
|
|
50
|
-
const userAgent = process.env.npm_config_user_agent || "";
|
|
51
|
-
if (userAgent.includes("pnpm")) return "pnpm";
|
|
52
|
-
if (userAgent.includes("yarn")) return "yarn";
|
|
53
|
-
if (userAgent.includes("bun")) return "bun";
|
|
54
|
-
return "npm";
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const cleanLockfilesForBun = async (dir) => {
|
|
58
|
-
const lockfiles = ["package-lock.json", "yarn.lock", "pnpm-lock.yaml"];
|
|
59
|
-
await Promise.all(lockfiles.map((file) => fs.remove(path.join(dir, file))));
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const runInstall = (dir, pm) => {
|
|
63
|
-
const cmd = pm === "yarn" ? "yarn" : pm;
|
|
64
|
-
const args = pm === "npm" ? ["install"] : ["install"];
|
|
65
|
-
const result = spawnSync(cmd, args, { cwd: dir, stdio: "inherit" });
|
|
66
|
-
if (result.status !== 0) process.exit(result.status);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const brandPrimary = chalk.hex("#6CABDD");
|
|
70
|
-
const brandDeep = chalk.hex("#1C2C5B");
|
|
71
|
-
const rnBlue = chalk.hex("#61DAFB");
|
|
72
|
-
const uiMuted = chalk.hex("#A0A0A0");
|
|
73
|
-
const uiAccent = chalk.hex("#00F0FF");
|
|
74
|
-
const uiActive = chalk.hex("#FFFFFF");
|
|
75
|
-
const uiSelected = chalk.hex("#00FF9D");
|
|
76
|
-
const uiHighlight = chalk.hex("#FF79C6");
|
|
77
|
-
|
|
78
|
-
const printBanner = () => {
|
|
79
|
-
const lines = [
|
|
80
|
-
"████████╗██╗ ██╗██╗███╗ ██╗██████╗ ██╗ ██████╗ ██████╗",
|
|
81
|
-
"╚══██╔══╝██║ ██║██║████╗ ██║██╔══██╗██║ ██╔═══██╗██╔════╝",
|
|
82
|
-
" ██║ ██║ █╗ ██║██║██╔██╗ ██║██████╔╝██║ ██║ ██║██║",
|
|
83
|
-
" ██║ ██║███╗██║██║██║╚██╗██║██╔══██╗██║ ██║ ██║██║",
|
|
84
|
-
" ██║ ╚███╔███╔╝██║██║ ╚████║██████╔╝███████╗╚██████╔╝╚██████╗",
|
|
85
|
-
" ╚═╝ ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝╚═════╝ ╚══════╝ ╚═════╝ ╚═════╝",
|
|
86
|
-
];
|
|
87
|
-
lines.forEach((line, index) => {
|
|
88
|
-
const paint = index < 3 ? brandPrimary : brandDeep;
|
|
89
|
-
console.log(paint(line));
|
|
90
|
-
});
|
|
91
|
-
console.log(brandPrimary("React Native Starter"));
|
|
92
|
-
console.log(rnBlue(" ⚛ React Native • Expo + Router • TypeScript • Zustand"));
|
|
93
|
-
console.log("");
|
|
94
|
-
};
|
|
95
|
-
|
|
96
17
|
const agentDirectories = [
|
|
97
18
|
{ key: "agent", path: ".agent/skills", label: "Vscode" },
|
|
98
19
|
{ key: "cursor", path: ".cursor", label: "Cursor" },
|
|
@@ -100,192 +21,283 @@ const agentDirectories = [
|
|
|
100
21
|
{ key: "windsurf", path: ".windsurf/skills", label: "Windsurf" },
|
|
101
22
|
{ key: "codex", path: ".codex/skills", label: "Codex" },
|
|
102
23
|
{ key: "antigravity", path: ".agents/skills", label: "Antigravity" },
|
|
103
|
-
{ key: "
|
|
24
|
+
{ key: "copilot", path: ".copilot/skills", label: "Copilot" },
|
|
104
25
|
{ key: "kilocode", path: ".kilocode/skills", label: "Kilocode" },
|
|
105
26
|
{ key: "opencode", path: ".opencode/skills", label: "Opencode" },
|
|
106
27
|
{ key: "trae", path: ".trae/skills", label: "Trae" },
|
|
107
28
|
];
|
|
108
29
|
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (await fs.pathExists(path.join(rootDir, dir.path))) {
|
|
113
|
-
existing.add(dir.key);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return existing;
|
|
30
|
+
const handleCancel = () => {
|
|
31
|
+
cancel("Operation cancelled.");
|
|
32
|
+
process.exit(0);
|
|
117
33
|
};
|
|
118
34
|
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
35
|
+
const displayBanner = async () => {
|
|
36
|
+
console.clear();
|
|
37
|
+
|
|
38
|
+
// 1. Logo with Sci-Fi/Cyberpunk feel
|
|
39
|
+
const title = figlet.textSync("TwinBloc", { font: "Slant" });
|
|
40
|
+
console.log(gradient.vice.multiline(title));
|
|
41
|
+
|
|
42
|
+
// 2. Clean Modern Header
|
|
43
|
+
console.log(chalk.hex("#4D4D4D")(" ────────────────────────────────────────────────────────────"));
|
|
44
|
+
console.log(
|
|
45
|
+
chalk.bold.white(" 🚀 The Ultimate React Native Starter") +
|
|
46
|
+
chalk.hex("#4D4D4D")(" | ") +
|
|
47
|
+
chalk.cyan("Expo SDK 54") +
|
|
48
|
+
chalk.hex("#4D4D4D")(" | ") +
|
|
49
|
+
chalk.magenta("AI Powered"),
|
|
50
|
+
);
|
|
51
|
+
console.log(chalk.hex("#4D4D4D")(" ────────────────────────────────────────────────────────────\n"));
|
|
52
|
+
|
|
53
|
+
// 3. Impactful Tagline
|
|
54
|
+
console.log(
|
|
55
|
+
" " +
|
|
56
|
+
chalk.bgHex("#6C5CE7").white.bold(" SYSTEM ") +
|
|
57
|
+
" " +
|
|
58
|
+
chalk.bold.italic.white("Undefined boundaries. ") +
|
|
59
|
+
chalk.bold.italic.cyan("Infinite possibilities."),
|
|
60
|
+
);
|
|
61
|
+
console.log("");
|
|
62
|
+
|
|
63
|
+
// 4. Feature Highlights (Mini-Grid)
|
|
64
|
+
const check = chalk.green("✔");
|
|
65
|
+
console.log(` ${check} TypeScript First ${check} UniWind`);
|
|
66
|
+
console.log(` ${check} TanStack Query ${check} Zustand Storage`);
|
|
67
|
+
console.log("");
|
|
68
|
+
|
|
69
|
+
// 5. "Boot Sequence" Animation
|
|
70
|
+
const s = spinner();
|
|
71
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
72
|
+
|
|
73
|
+
s.start(chalk.dim("Initializing neural interface..."));
|
|
74
|
+
await sleep(800);
|
|
75
|
+
|
|
76
|
+
s.message(chalk.dim("Calibrating synergy modules..."));
|
|
77
|
+
await sleep(800);
|
|
78
|
+
|
|
79
|
+
s.message(chalk.dim("Engaging cross-platform engines..."));
|
|
80
|
+
await sleep(800);
|
|
81
|
+
|
|
82
|
+
s.stop(chalk.green("✔ Environment Synchronized. Ready."));
|
|
124
83
|
console.log("");
|
|
125
84
|
};
|
|
126
85
|
|
|
127
|
-
const
|
|
128
|
-
if (
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
output.write("\x1b[J");
|
|
132
|
-
choices.forEach((choice, index) => {
|
|
133
|
-
const isActive = index === activeIndex;
|
|
134
|
-
const isSelected = selectedKeys.has(choice.key);
|
|
135
|
-
const pointer = isActive ? uiActive("▸") : uiMuted(" ");
|
|
136
|
-
const mark = isSelected ? uiSelected("●") : uiMuted("○");
|
|
137
|
-
const label = isSelected ? uiSelected.bold(choice.label) : uiAccent(choice.label);
|
|
138
|
-
const line = ` ${pointer} ${mark} ${label}`;
|
|
139
|
-
if (isActive) {
|
|
140
|
-
console.log(chalk.bgHex("#0F2438").hex("#FFFFFF")(line));
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
console.log(line);
|
|
144
|
-
});
|
|
86
|
+
const getAvailableExamples = async () => {
|
|
87
|
+
if (!fs.existsSync(examplesRoot)) return [];
|
|
88
|
+
const entries = await fs.readdir(examplesRoot, { withFileTypes: true });
|
|
89
|
+
return entries.filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name);
|
|
145
90
|
};
|
|
146
91
|
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
92
|
+
const main = async () => {
|
|
93
|
+
await displayBanner();
|
|
94
|
+
|
|
95
|
+
intro(chalk.bgHex("#1C2C5B").hex("#FFFFFF")(" Let's configure your Twinbloc Starter application "));
|
|
96
|
+
|
|
97
|
+
const projectName = await text({
|
|
98
|
+
message: "What would you like to name your project?",
|
|
99
|
+
placeholder: "my-twinbloc-app",
|
|
100
|
+
validate(value) {
|
|
101
|
+
if (!value || value.length === 0) return "Value is required!";
|
|
102
|
+
if (/[^a-z0-9-_]/.test(value)) return "Project name can only contain lowercase letters, numbers, hyphens, and underscores.";
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
if (isCancel(projectName)) handleCancel();
|
|
107
|
+
|
|
108
|
+
const targetDir = path.resolve(process.cwd(), projectName);
|
|
109
|
+
|
|
110
|
+
if (fs.existsSync(targetDir) && fs.readdirSync(targetDir).length > 0) {
|
|
111
|
+
const shouldOverwrite = await select({
|
|
112
|
+
message: `Directory "${projectName}" is not empty. How would you like to proceed?`,
|
|
113
|
+
options: [
|
|
114
|
+
{ value: "cancel", label: "Cancel operation" },
|
|
115
|
+
{ value: "overwrite", label: "Remove existing files and continue" },
|
|
116
|
+
],
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
if (isCancel(shouldOverwrite) || shouldOverwrite === "cancel") handleCancel();
|
|
120
|
+
|
|
121
|
+
await fs.remove(targetDir);
|
|
151
122
|
}
|
|
152
123
|
|
|
153
|
-
|
|
154
|
-
|
|
124
|
+
// Example Selection
|
|
125
|
+
const availableExamples = await getAvailableExamples();
|
|
126
|
+
const exampleOptions = [{ value: "base", label: "Base (Default)" }, ...availableExamples.map((ex) => ({ value: ex, label: ex }))];
|
|
155
127
|
|
|
156
|
-
|
|
157
|
-
|
|
128
|
+
const example = await select({
|
|
129
|
+
message: "Select a template variant",
|
|
130
|
+
options: exampleOptions,
|
|
131
|
+
});
|
|
158
132
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (input.isTTY) {
|
|
184
|
-
input.setRawMode(false);
|
|
185
|
-
}
|
|
186
|
-
output.write("\n");
|
|
187
|
-
resolve(selectedKeys);
|
|
188
|
-
}
|
|
189
|
-
};
|
|
133
|
+
if (isCancel(example)) handleCancel();
|
|
134
|
+
|
|
135
|
+
// Agent Selection
|
|
136
|
+
const selectedAgents = await multiselect({
|
|
137
|
+
message: "Select agent configs to include",
|
|
138
|
+
options: agentDirectories.map((agent) => ({
|
|
139
|
+
value: agent.key,
|
|
140
|
+
label: agent.label,
|
|
141
|
+
})),
|
|
142
|
+
required: false,
|
|
143
|
+
hint: "Space to select, Enter to submit",
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
if (isCancel(selectedAgents)) handleCancel();
|
|
147
|
+
|
|
148
|
+
const detectPackageManager = () => {
|
|
149
|
+
const userAgent = process.env.npm_config_user_agent || "";
|
|
150
|
+
if (userAgent.includes("pnpm")) return "pnpm";
|
|
151
|
+
if (userAgent.includes("yarn")) return "yarn";
|
|
152
|
+
if (userAgent.includes("bun")) return "bun";
|
|
153
|
+
return "npm";
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const packageManager = detectPackageManager();
|
|
190
157
|
|
|
191
|
-
|
|
158
|
+
const shouldInstall = await confirm({
|
|
159
|
+
message: "Install dependencies?",
|
|
160
|
+
initialValue: true,
|
|
192
161
|
});
|
|
193
|
-
};
|
|
194
162
|
|
|
195
|
-
|
|
196
|
-
const empty = await isEmptyDir(targetDir);
|
|
197
|
-
if (!empty) {
|
|
198
|
-
console.error(chalk.red("Target directory must be empty."));
|
|
199
|
-
process.exit(1);
|
|
200
|
-
}
|
|
163
|
+
if (isCancel(shouldInstall)) handleCancel();
|
|
201
164
|
|
|
202
|
-
|
|
165
|
+
const s = spinner();
|
|
166
|
+
s.start("Initializing project...");
|
|
203
167
|
|
|
168
|
+
// 1. Copy template
|
|
204
169
|
if (!fs.existsSync(templateRoot)) {
|
|
205
|
-
|
|
170
|
+
s.stop("Template folder not found!");
|
|
171
|
+
console.error(chalk.red("Template folder not found at: " + templateRoot));
|
|
206
172
|
process.exit(1);
|
|
207
173
|
}
|
|
208
174
|
|
|
209
|
-
await fs.
|
|
175
|
+
await fs.ensureDir(targetDir);
|
|
176
|
+
await fs.copy(templateRoot, targetDir, {
|
|
177
|
+
filter: (src) => {
|
|
178
|
+
const relativePath = path.relative(templateRoot, src);
|
|
179
|
+
// Exclude android, ios, agent-skills, node_modules, .expo, and .git folders from the initial copy
|
|
180
|
+
return (
|
|
181
|
+
!relativePath.startsWith("android") &&
|
|
182
|
+
!relativePath.startsWith("ios") &&
|
|
183
|
+
!relativePath.startsWith("agent-skills") &&
|
|
184
|
+
!relativePath.includes("node_modules") &&
|
|
185
|
+
!relativePath.startsWith(".expo") &&
|
|
186
|
+
// Exclude .git directory but keep .gitignore, .github, etc.
|
|
187
|
+
relativePath !== ".git" &&
|
|
188
|
+
!relativePath.startsWith(".git" + path.sep)
|
|
189
|
+
);
|
|
190
|
+
},
|
|
191
|
+
});
|
|
210
192
|
|
|
211
|
-
|
|
212
|
-
if (
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
193
|
+
// 2. Copy example if selected
|
|
194
|
+
if (example !== "base") {
|
|
195
|
+
const examplePath = path.join(examplesRoot, example);
|
|
196
|
+
if (await fs.pathExists(examplePath)) {
|
|
197
|
+
await fs.copy(examplePath, targetDir, { overwrite: true });
|
|
216
198
|
}
|
|
217
|
-
await fs.copy(examplePath, targetDir, { overwrite: true });
|
|
218
199
|
}
|
|
219
200
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
const
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
const sourceAgent = agentDirectories.find((d) => d.key === "antigravity");
|
|
228
|
-
const sourcePath = path.join(targetDir, sourceAgent.path);
|
|
229
|
-
|
|
230
|
-
if (await fs.pathExists(sourcePath)) {
|
|
231
|
-
await Promise.all(
|
|
232
|
-
agentDirectories
|
|
233
|
-
.filter((dir) => selectedKeys.has(dir.key) && dir.key !== "antigravity")
|
|
234
|
-
.map(async (dir) => {
|
|
235
|
-
const destPath = path.join(targetDir, dir.path);
|
|
236
|
-
await fs.ensureDir(destPath);
|
|
237
|
-
await fs.copy(sourcePath, destPath, { overwrite: true });
|
|
238
|
-
}),
|
|
239
|
-
);
|
|
240
|
-
}
|
|
201
|
+
// 3. Handle Agent Configs
|
|
202
|
+
// Source agents from the 'agent-skills' directory in the template
|
|
203
|
+
const agentSkillsRoot = path.join(templateRoot, "agent-skills");
|
|
204
|
+
const antigravityConfig = agentDirectories.find((d) => d.key === "antigravity");
|
|
205
|
+
const antigravitySourcePath = path.join(agentSkillsRoot, antigravityConfig.path);
|
|
206
|
+
|
|
207
|
+
const selectedKeys = new Set(selectedAgents);
|
|
241
208
|
|
|
242
|
-
await Promise.all(
|
|
209
|
+
await Promise.all(
|
|
210
|
+
agentDirectories.map(async (agent) => {
|
|
211
|
+
if (!selectedKeys.has(agent.key)) return;
|
|
243
212
|
|
|
244
|
-
|
|
245
|
-
|
|
213
|
+
const agentSourcePath = path.join(agentSkillsRoot, agent.path);
|
|
214
|
+
const agentDestPath = path.join(targetDir, agent.path);
|
|
246
215
|
|
|
247
|
-
|
|
216
|
+
// 1. Try to copy specific agent config if it exists
|
|
217
|
+
if (await fs.pathExists(agentSourcePath)) {
|
|
218
|
+
await fs.ensureDir(path.dirname(agentDestPath));
|
|
219
|
+
await fs.copy(agentSourcePath, agentDestPath, { overwrite: true });
|
|
220
|
+
}
|
|
221
|
+
// 2. Fallback: Copy from antigravity if specific config is missing
|
|
222
|
+
else if (await fs.pathExists(antigravitySourcePath)) {
|
|
223
|
+
await fs.ensureDir(path.dirname(agentDestPath));
|
|
224
|
+
await fs.copy(antigravitySourcePath, agentDestPath, { overwrite: true });
|
|
225
|
+
} else {
|
|
226
|
+
// Just ensure the directory exists if nothing else
|
|
227
|
+
await fs.ensureDir(agentDestPath);
|
|
228
|
+
}
|
|
229
|
+
}),
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
// 4. Update package.json
|
|
248
233
|
const targetPackageJson = path.join(targetDir, "package.json");
|
|
249
|
-
if (fs.
|
|
234
|
+
if (await fs.pathExists(targetPackageJson)) {
|
|
250
235
|
const pkg = await fs.readJson(targetPackageJson);
|
|
251
|
-
pkg.name =
|
|
236
|
+
pkg.name = projectName;
|
|
252
237
|
await fs.writeJson(targetPackageJson, pkg, { spaces: 2 });
|
|
253
238
|
}
|
|
254
239
|
|
|
255
|
-
|
|
240
|
+
// 5. Git init
|
|
241
|
+
s.message("Initialized git repository");
|
|
242
|
+
try {
|
|
243
|
+
spawnSync("git", ["init"], { cwd: targetDir, stdio: "ignore" });
|
|
244
|
+
spawnSync("git", ["add", "."], { cwd: targetDir, stdio: "ignore" });
|
|
245
|
+
spawnSync("git", ["commit", "-m", "Initial commit"], { cwd: targetDir, stdio: "ignore" });
|
|
246
|
+
} catch (e) {
|
|
247
|
+
// ignore
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (shouldInstall) {
|
|
251
|
+
s.message(`Installing dependencies via ${packageManager}`);
|
|
256
252
|
|
|
257
|
-
|
|
258
|
-
if (
|
|
259
|
-
|
|
253
|
+
// Clean lockfiles for bun if needed (from original logic)
|
|
254
|
+
if (packageManager === "bun") {
|
|
255
|
+
const lockfiles = ["package-lock.json", "yarn.lock", "pnpm-lock.yaml"];
|
|
256
|
+
await Promise.all(lockfiles.map((file) => fs.remove(path.join(targetDir, file))));
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const installCmd = packageManager === "yarn" ? "yarn" : packageManager;
|
|
260
|
+
const installArgs = ["install"];
|
|
261
|
+
|
|
262
|
+
try {
|
|
263
|
+
await new Promise((resolve, reject) => {
|
|
264
|
+
const child = spawn(installCmd, installArgs, {
|
|
265
|
+
cwd: targetDir,
|
|
266
|
+
stdio: "ignore",
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
child.on("close", (code) => {
|
|
270
|
+
if (code === 0) resolve();
|
|
271
|
+
else reject(new Error(`Installation failed with code ${code}`));
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
child.on("error", (err) => reject(err));
|
|
275
|
+
});
|
|
276
|
+
} catch (error) {
|
|
277
|
+
s.stop("Failed to install dependencies.");
|
|
278
|
+
console.error(chalk.red("Error installing dependencies."));
|
|
279
|
+
process.exit(1);
|
|
260
280
|
}
|
|
261
|
-
runInstall(targetDir, pm);
|
|
262
281
|
}
|
|
263
282
|
|
|
264
|
-
|
|
265
|
-
const execCommand = pm === "npm" ? "npx" : pm;
|
|
283
|
+
s.stop("Project created successfully!");
|
|
266
284
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
uiMuted(` - Build a dev client (if you haven’t): ${execCommand} expo run:ios / ${execCommand} expo run:android`),
|
|
281
|
-
uiMuted(" - Open the app from the dev client on your device or simulator"),
|
|
282
|
-
]
|
|
283
|
-
.filter(Boolean)
|
|
284
|
-
.join("\n"),
|
|
285
|
-
);
|
|
285
|
+
outro(`Your Twinbloc Start app is ready in '${projectName}'.`);
|
|
286
|
+
|
|
287
|
+
const runCommand = packageManager === "npm" ? "npm run" : packageManager;
|
|
288
|
+
const execCommand = packageManager === "npm" ? "npx" : packageManager;
|
|
289
|
+
|
|
290
|
+
console.log(chalk.dim("Next steps:"));
|
|
291
|
+
console.log(chalk.blue(` cd ${projectName}`));
|
|
292
|
+
if (!shouldInstall) {
|
|
293
|
+
console.log(chalk.blue(` ${packageManager} install`));
|
|
294
|
+
}
|
|
295
|
+
console.log(chalk.blue(` ${runCommand} start`));
|
|
296
|
+
console.log("");
|
|
297
|
+
console.log(chalk.dim(` - Build a dev client: ${execCommand} expo run:ios / ${execCommand} expo run:android`));
|
|
286
298
|
};
|
|
287
299
|
|
|
288
|
-
main().catch((
|
|
289
|
-
console.error(
|
|
300
|
+
main().catch((err) => {
|
|
301
|
+
console.error(err);
|
|
290
302
|
process.exit(1);
|
|
291
303
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-twinbloc-app",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "React Native starter template with optional examples",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"cli",
|
|
21
21
|
"create-app"
|
|
22
22
|
],
|
|
23
|
-
"author": "
|
|
23
|
+
"author": "Twinbloc Studios",
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"engines": {
|
|
26
26
|
"node": ">=18"
|
|
@@ -30,9 +30,12 @@
|
|
|
30
30
|
"test": "node ./bin/cli.js --help"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
+
"@clack/prompts": "^1.0.0",
|
|
33
34
|
"chalk": "^5.4.1",
|
|
34
35
|
"commander": "^12.1.0",
|
|
35
|
-
"
|
|
36
|
+
"figlet": "^1.10.0",
|
|
37
|
+
"fs-extra": "^11.2.0",
|
|
38
|
+
"gradient-string": "^3.0.0"
|
|
36
39
|
},
|
|
37
40
|
"devDependencies": {
|
|
38
41
|
"eslint": "^8.57.1"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Twinbloc Studios
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"name": "react-native-starter",
|
|
3
3
|
"main": "expo-router/entry",
|
|
4
4
|
"version": "1.0.0",
|
|
5
|
+
"license": "MIT",
|
|
5
6
|
"expo": {
|
|
6
7
|
"doctor": {
|
|
7
8
|
"reactNativeDirectoryCheck": {
|
|
@@ -14,6 +15,7 @@
|
|
|
14
15
|
"packageManager": "pnpm@9.15.2",
|
|
15
16
|
"scripts": {
|
|
16
17
|
"start": "expo start",
|
|
18
|
+
"doctor": "npx expo-doctor",
|
|
17
19
|
"reset-project": "node ./app-example/scripts/reset-project.js",
|
|
18
20
|
"android": "expo run:android",
|
|
19
21
|
"ios": "expo run:ios",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// NOTE: This file is generated by uniwind and it should not be edited manually.
|
|
2
2
|
/// <reference types="uniwind/types" />
|
|
3
3
|
|
|
4
|
-
declare module
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
declare module "uniwind" {
|
|
5
|
+
export interface UniwindConfig {
|
|
6
|
+
themes: readonly ["light", "dark"];
|
|
7
|
+
}
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export {}
|
|
10
|
+
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|