newcandies 0.1.0 → 0.1.2
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 +46 -55
- package/package.json +13 -13
package/dist/index.js
CHANGED
|
@@ -14,6 +14,9 @@ var TEMPLATE_MAP = {
|
|
|
14
14
|
},
|
|
15
15
|
"boilerplate/supersimplenotes": {
|
|
16
16
|
extraDeps: ["@react-native-community/netinfo"]
|
|
17
|
+
},
|
|
18
|
+
"app-brief/react-query/sproutsy": {
|
|
19
|
+
extraDeps: ["@tanstack/react-query"]
|
|
17
20
|
}
|
|
18
21
|
};
|
|
19
22
|
var TEMPLATES = {
|
|
@@ -32,7 +35,7 @@ var TEMPLATES = {
|
|
|
32
35
|
"mini-app-brief": { categories: [{ value: "forms", label: "forms", variants: [{ value: "lite", label: "lite" }] }] },
|
|
33
36
|
"default": [{ value: "default", label: "Default (Expo Router + Uniwind)" }]
|
|
34
37
|
};
|
|
35
|
-
var program = new Command().name("newcandies").option("-t, --type <type>").option("--template <name>").option("--category <name>").option("--variant <name>").option("-
|
|
38
|
+
var program = new Command().name("newcandies").option("-t, --type <type>").option("--template <name>").option("--category <name>").option("--variant <name>").option("-y, --yes").option("--pm <pm>", "npm|pnpm|yarn|bun").option("--no-install").parse(process.argv);
|
|
36
39
|
var opts = program.opts();
|
|
37
40
|
async function main() {
|
|
38
41
|
console.clear();
|
|
@@ -75,17 +78,6 @@ async function main() {
|
|
|
75
78
|
const cat = cats.find((c) => c.value === results.category);
|
|
76
79
|
return p.select({ message: "Pick variant", options: cat.variants });
|
|
77
80
|
},
|
|
78
|
-
navigator: async () => {
|
|
79
|
-
if (opts.navigator) return opts.navigator;
|
|
80
|
-
return p.select({
|
|
81
|
-
message: "Navigator",
|
|
82
|
-
options: [
|
|
83
|
-
{ value: "stack", label: "Stack" },
|
|
84
|
-
{ value: "tabs", label: "Tabs" }
|
|
85
|
-
],
|
|
86
|
-
initialValue: "tabs"
|
|
87
|
-
});
|
|
88
|
-
},
|
|
89
81
|
install: async () => {
|
|
90
82
|
if (opts.yes !== void 0) return !!opts.yes;
|
|
91
83
|
if (opts.install === false) return false;
|
|
@@ -112,7 +104,8 @@ async function main() {
|
|
|
112
104
|
const s = p.spinner();
|
|
113
105
|
s.start("Scaffolding");
|
|
114
106
|
await fs.ensureDir(dest);
|
|
115
|
-
|
|
107
|
+
const withQuery = project.type === "app-brief" && project.category === "react-query" && project.variant === "sproutsy";
|
|
108
|
+
await writeBaseline({ dest, name: project.name, withQuery });
|
|
116
109
|
await applyTemplateOverlay({ dest, type: project.type, template: project.template, category: project.category, variant: project.variant });
|
|
117
110
|
s.stop("Files ready");
|
|
118
111
|
const extraDeps = resolveExtraDeps({ type: project.type, template: project.template, category: project.category, variant: project.variant });
|
|
@@ -134,7 +127,7 @@ function TEMPLATESafe(type) {
|
|
|
134
127
|
if (Array.isArray(t)) return t;
|
|
135
128
|
return [{ value: "default", label: "Default (Expo Router + Uniwind)" }];
|
|
136
129
|
}
|
|
137
|
-
async function writeBaseline({ dest, name,
|
|
130
|
+
async function writeBaseline({ dest, name, withQuery }) {
|
|
138
131
|
const pkg = {
|
|
139
132
|
name,
|
|
140
133
|
version: "0.0.0",
|
|
@@ -212,25 +205,56 @@ module.exports = withUniwindConfig(config, {
|
|
|
212
205
|
}
|
|
213
206
|
`;
|
|
214
207
|
await fs.writeFile(path.join(appDir, "global.css"), globalCss);
|
|
215
|
-
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
import '../global.css';
|
|
220
|
-
import { Tabs } from 'expo-router';
|
|
208
|
+
{
|
|
209
|
+
const rootLayout = withQuery ? `import 'react-native-gesture-handler';
|
|
210
|
+
import './global.css';
|
|
211
|
+
import { Slot } from 'expo-router';
|
|
221
212
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
222
213
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
214
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
223
215
|
|
|
224
|
-
const
|
|
216
|
+
const queryClient = new QueryClient();
|
|
217
|
+
|
|
218
|
+
const RootLayout = () => {
|
|
219
|
+
return (
|
|
220
|
+
<GestureHandlerRootView style={{ flex: 1 }}>
|
|
221
|
+
<SafeAreaProvider>
|
|
222
|
+
<QueryClientProvider client={queryClient}>
|
|
223
|
+
<Slot />
|
|
224
|
+
</QueryClientProvider>
|
|
225
|
+
</SafeAreaProvider>
|
|
226
|
+
</GestureHandlerRootView>
|
|
227
|
+
);
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
export default RootLayout;
|
|
231
|
+
` : `import 'react-native-gesture-handler';
|
|
232
|
+
import './global.css';
|
|
233
|
+
import { Slot } from 'expo-router';
|
|
234
|
+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
235
|
+
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
236
|
+
|
|
237
|
+
const RootLayout = () => {
|
|
225
238
|
return (
|
|
226
239
|
<GestureHandlerRootView style={{ flex: 1 }}>
|
|
227
240
|
<SafeAreaProvider>
|
|
228
|
-
<
|
|
241
|
+
<Slot />
|
|
229
242
|
</SafeAreaProvider>
|
|
230
243
|
</GestureHandlerRootView>
|
|
231
244
|
);
|
|
232
245
|
};
|
|
233
246
|
|
|
247
|
+
export default RootLayout;
|
|
248
|
+
`;
|
|
249
|
+
await fs.writeFile(path.join(appDir, "_layout.tsx"), rootLayout);
|
|
250
|
+
const tabsDir = path.join(appDir, "(tabs)");
|
|
251
|
+
await fs.ensureDir(tabsDir);
|
|
252
|
+
const layout = `import { Tabs } from 'expo-router';
|
|
253
|
+
|
|
254
|
+
const TabsLayout = () => {
|
|
255
|
+
return <Tabs screenOptions={{ headerShown: false }} />;
|
|
256
|
+
};
|
|
257
|
+
|
|
234
258
|
export default TabsLayout;
|
|
235
259
|
`;
|
|
236
260
|
await fs.writeFile(path.join(tabsDir, "_layout.tsx"), layout);
|
|
@@ -256,39 +280,6 @@ const Settings = () => (
|
|
|
256
280
|
export default Settings;
|
|
257
281
|
`;
|
|
258
282
|
await fs.writeFile(path.join(tabsDir, "settings.tsx"), settings);
|
|
259
|
-
} else {
|
|
260
|
-
const layout = `import 'react-native-gesture-handler';
|
|
261
|
-
import './global.css';
|
|
262
|
-
import { Stack } from 'expo-router';
|
|
263
|
-
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
264
|
-
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
265
|
-
|
|
266
|
-
const RootLayout = () => {
|
|
267
|
-
return (
|
|
268
|
-
<GestureHandlerRootView style={{ flex: 1 }}>
|
|
269
|
-
<SafeAreaProvider>
|
|
270
|
-
<Stack screenOptions={{ headerShown: false }} />
|
|
271
|
-
</SafeAreaProvider>
|
|
272
|
-
</GestureHandlerRootView>
|
|
273
|
-
);
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
export default RootLayout;
|
|
277
|
-
`;
|
|
278
|
-
await fs.writeFile(path.join(appDir, "_layout.tsx"), layout);
|
|
279
|
-
const index = `import { View, Text } from 'react-native';
|
|
280
|
-
|
|
281
|
-
const Home = () => {
|
|
282
|
-
return (
|
|
283
|
-
<View className="flex-1 items-center justify-center bg-background">
|
|
284
|
-
<Text className="text-foreground text-xl">Hello from Stack + Uniwind + Router</Text>
|
|
285
|
-
</View>
|
|
286
|
-
);
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
export default Home;
|
|
290
|
-
`;
|
|
291
|
-
await fs.writeFile(path.join(appDir, "index.tsx"), index);
|
|
292
283
|
}
|
|
293
284
|
}
|
|
294
285
|
async function applyTemplateOverlay({ dest, type, template, category, variant }) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "newcandies",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Scaffold Expo Router + Uniwind React Native apps with layered templates.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -21,19 +21,19 @@
|
|
|
21
21
|
"start": "node dist/index.js",
|
|
22
22
|
"prepublishOnly": "npm run build"
|
|
23
23
|
},
|
|
24
|
-
|
|
25
|
-
"@clack/prompts": "
|
|
26
|
-
"commander": "
|
|
27
|
-
"execa": "
|
|
28
|
-
"fs-extra": "
|
|
29
|
-
"giget": "
|
|
30
|
-
"picocolors": "
|
|
31
|
-
"validate-npm-package-name": "
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@clack/prompts": "1.0.0-alpha.6",
|
|
26
|
+
"commander": "14.0.2",
|
|
27
|
+
"execa": "9.6.0",
|
|
28
|
+
"fs-extra": "11.3.2",
|
|
29
|
+
"giget": "2.0.0",
|
|
30
|
+
"picocolors": "1.1.1",
|
|
31
|
+
"validate-npm-package-name": "7.0.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@types/fs-extra": "
|
|
35
|
-
"@types/node": "
|
|
36
|
-
"tsup": "
|
|
37
|
-
"typescript": "
|
|
34
|
+
"@types/fs-extra": "11.0.4",
|
|
35
|
+
"@types/node": "24.10.0",
|
|
36
|
+
"tsup": "8.5.0",
|
|
37
|
+
"typescript": "5.9.3"
|
|
38
38
|
}
|
|
39
39
|
}
|