Skip to content

Commit ffe79cf

Browse files
committed
fix: some issues
1 parent 4635a66 commit ffe79cf

File tree

5 files changed

+46
-40
lines changed

5 files changed

+46
-40
lines changed

cli/src/commands/create-expo-stack.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ const command: GluegunCommand = {
301301
// Add zustand package
302302
cliResults.packages.push({
303303
name: 'zustand',
304-
type: 'state_management'
304+
type: 'state-management'
305305
});
306306
}
307307

@@ -363,6 +363,13 @@ const command: GluegunCommand = {
363363
script += '--drawer+tabs ';
364364
}
365365
}
366+
367+
const stateManagementPackage = cliResults.packages.find((p) => p.type === 'state-management');
368+
369+
if (stateManagementPackage) {
370+
// currently only redux is supported
371+
script += `--${stateManagementPackage.name} `;
372+
}
366373
} else {
367374
// Add the packages
368375
cliResults.packages.forEach((p) => {
@@ -408,6 +415,7 @@ const command: GluegunCommand = {
408415
warning(` ${generateRerunScript(cliResults)}`);
409416

410417
const { packages } = cliResults;
418+
411419
// Define props to be passed into the templates
412420
const authenticationPackage = packages.find((p) => p.type === 'authentication') || undefined;
413421
const navigationPackage = packages.find((p) => p.type === 'navigation') || undefined;
@@ -417,7 +425,7 @@ const command: GluegunCommand = {
417425
const analyticsPackage = packages.find((p) => p.type === 'analytics');
418426

419427
//add the state management package if it is selected
420-
const stateManagementPackage = packages.find((p) => p.type === 'state_management') || undefined;
428+
const stateManagementPackage = packages.find((p) => p.type === 'state-management') || undefined;
421429

422430
let files: string[] = [];
423431

cli/src/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ export const availablePackages = [
2626
'restyle',
2727
'unistyles',
2828
'i18next',
29-
'zustand'
30-
'vexo-analytics',
29+
'zustand',
30+
'vexo-analytics'
3131
] as const;
3232

3333
export type AuthenticationSelect = 'supabase' | 'firebase' | undefined;
@@ -62,7 +62,7 @@ export type SelectedComponents =
6262

6363
export type AvailablePackages = {
6464
name: (typeof availablePackages)[number];
65-
type: 'navigation' | 'styling' | 'authentication' | 'internationalization' | 'state_management' | 'analytics';
65+
type: 'navigation' | 'styling' | 'authentication' | 'internationalization' | 'state-management' | 'analytics';
6666
options?: { selectedComponents?: SelectedComponents[]; type?: NavigationTypes };
6767
};
6868

cli/src/utilities/configureProjectFiles.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,6 @@ export function configureProjectFiles(
327327
files = [...files, ...firebaseFiles];
328328
}
329329

330-
// add state management files if needed
331-
if (stateManagementPackage?.name === 'zustand') {
332-
const zustandFiles = ['packages/zustand/StateManagement/zustandStore.ts.ejs'];
333-
files = [...files, ...zustandFiles];
334330
// add vexo analytics files if needed
335331
if (analyticsPackage?.name == 'vexo-analytics') {
336332
const vexoFiles = ['packages/vexo-analytics/.env.ejs'];
@@ -354,6 +350,12 @@ export function configureProjectFiles(
354350
}
355351
}
356352

353+
// add state management files if needed
354+
if (stateManagementPackage?.name === 'zustand') {
355+
const zustandFiles = ['packages/zustand/StateManagement/zustandStore.ts.ejs'];
356+
files = [...files, ...zustandFiles];
357+
}
358+
357359
// Add npmrc file if user is using pnpm
358360
if (packageManager === 'pnpm') {
359361
files.push('base/.npmrc.ejs');

cli/src/utilities/runCLI.ts

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,32 @@ export async function runCLI(toolbox: Toolbox, projectName: string): Promise<Cli
364364
success(`No problem, skipping eas for now.`);
365365
}
366366

367+
const stateManagementSelect = await select({
368+
message: 'What would you like to use for state management?',
369+
options: [
370+
{ value: undefined, label: 'None' },
371+
{ value: 'zustand', label: 'Zustand' }
372+
// { value: 'mobx', label: 'MobX' },
373+
// { value: 'redux', label: 'Redux' },
374+
]
375+
});
376+
377+
if (isCancel(stateManagementSelect)) {
378+
cancel('Cancelled... 👋');
379+
return process.exit(0);
380+
}
381+
382+
if (stateManagementSelect) {
383+
cliResults.packages.push({
384+
name: stateManagementSelect as StateManagementSelect,
385+
type: 'state-management'
386+
});
387+
388+
success(`You'll be using ${stateManagementSelect} for state management.`);
389+
} else {
390+
success(`No problem, skipping state management for now.`);
391+
}
392+
367393
// Offer user ability to save configuration
368394
const shouldSaveConfig = await confirm({
369395
message: 'Would you like to save this configuration for future use?',
@@ -385,37 +411,6 @@ export async function runCLI(toolbox: Toolbox, projectName: string): Promise<Cli
385411
cancel('Cancelled... 👋');
386412
return process.exit(0);
387413
}
388-
if (authenticationSelect) {
389-
cliResults.packages.push({ name: authenticationSelect as AuthenticationSelect, type: 'authentication' });
390-
} else {
391-
success(`No problem, skipping authentication for now.`);
392-
}
393-
394-
const stateManagementSelect = await select({
395-
message: 'What would you like to use for state management?',
396-
options: [
397-
{ value: undefined, label: 'None' },
398-
{ value: 'zustand', label: 'Zustand' }
399-
// { value: 'mobx', label: 'MobX' },
400-
]
401-
});
402-
403-
if (isCancel(stateManagementSelect)) {
404-
cancel('Cancelled... 👋');
405-
return process.exit(0);
406-
}
407-
408-
if (stateManagementSelect) {
409-
cliResults.packages.push({ name: stateManagementSelect as StateManagementSelect, type: 'state_management' });
410-
success(`You'll be using ${stateManagementSelect} for state management.`);
411-
} else {
412-
success(`No problem, skipping state management for now.`);
413-
}
414-
415-
const internationalizationSelect = await confirm({
416-
message: `What would you like to support internationalization?`,
417-
initialValue: false
418-
});
419414

420415
await saveConfig({ name, cliResults });
421416
}

docs/src/content/docs/en/installation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ bun create expo-stack myapp --expo-router --nativewind --bun
6767
| `--drawer` | Use a Drawer navigator (pass with either Expo Router or React Navigation flag) |
6868
| `--firebase` | Use Firebase for authentication, initial configuration only |
6969
| `--supabase` | Use Supabase for authentication, initial configuration only |
70+
| `--vexo-analytics` | Use Vexo Analytics for analytics, initial configuration only |
7071
| `--nativewind` | Use Nativewind for styling |
7172
| `--unistyles` | Use Unistyles for styling |
7273
| `--tamagui` | Use Tamagui for styling |

0 commit comments

Comments
 (0)