Skip to content

Commit

Permalink
chore: modify option
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayDonev committed Apr 2, 2024
1 parent 4999f08 commit 8f2b75b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 30 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ In case you want to add react-navigation example code in the project:
- `With set-up and example screens` option - when selected the App will automatically include an example BottomTabNavigator
(`src/common/navigation/bottomTab/BottomTabNavigator.tsx`)

#### `Icons`
#### `Icon Toolkit`

- `Lucide Icons` (Optional) Provides rich set of well styled icons.

Expand Down
8 changes: 1 addition & 7 deletions src/commands/start-project.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
IconChoice,
IconToolkitChoice,
SelectionPrompts,
StorybookChoice,
StyleLibraryChoice,
Expand Down Expand Up @@ -144,12 +144,6 @@ const startProject = async (toolbox: RnBootstrapToolbox) => {
}
}

if (selectedOptions.icons === IconChoice.withIcons &&
(selectedOptions.styleLibrary === StyleLibraryChoice.StyleSheet || selectedOptions.styleLibrary === StyleLibraryChoice.StyledComponents)) {
print.highlight('Installing additional dependencies...');
await spawnProgress('yarn add react-native-svg@14.0.0');
}

IS_MAC && (await yarn.run('pod-install'));

print.success(print.checkmark + ' Setup is done.');
Expand Down
9 changes: 5 additions & 4 deletions src/tools/dependency-versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,21 @@ export const styleDevDeps = ['@types/styled-components-react-native@^5.2.5'];
export const gluestackUIDeps = [
'@gluestack-ui/themed',
'@gluestack-style/react',
'react-native-svg@14.0.0',
'react-native-svg@^15.1.0',
'@gluestack-ui/config@latest'
];

export const glueStackUICoreDeps = [
'@gluestack-ui/themed',
'@gluestack-style/react',
'react-native-svg@14.0.0'
'react-native-svg@^15.1.0'
];

export const storybookDevDeps = ['cross-env'];

export const iconsDevDeps = [
'lucide-react-native'
export const lucideIconDeps = [
'lucide-react-native',
'react-native-svg@^15.1.0'
]

export const reactotronDevDeps = [
Expand Down
29 changes: 14 additions & 15 deletions src/tools/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
glueStackUICoreDeps,
storybookDevDeps,
reactotronDevDeps,
iconsDevDeps
lucideIconDeps
} from './dependency-versions';

export enum StyleLibraryChoice {
Expand All @@ -27,10 +27,9 @@ export enum StorybookChoice {
NoStorybook = 'No Storybook'
}

export enum IconChoice {
withIcons = 'Yes',
withoutIcons = 'No',

export enum IconToolkitChoice {
LucideIcons = 'Lucide Icons',
noIconToolkit = 'No Icon Toolkit',
}

export enum StateLibraryChoice {
Expand Down Expand Up @@ -58,15 +57,15 @@ export const SelectionToDependencyNameMap = {
[StateLibraryChoice.ReduxToolkit]: reduxDeps,
[StateLibraryChoice.ReduxToolkitWithQuery]: reduxDeps,
[ReactNavigationExampleChoice.WithReactNavigationExample]: navigationDeps,
[ReactNavigationExampleChoice.WithoutReactNavigationExample]: navigationDeps
[ReactNavigationExampleChoice.WithoutReactNavigationExample]: navigationDeps,
[IconToolkitChoice.LucideIcons]: lucideIconDeps
};

export const SelectionToDevDependencyNameMap = {
[StyleLibraryChoice.StyledComponents]: styleDevDeps,
[StorybookChoice.Storybook]: storybookDevDeps,
[StorybookChoice.StorybookWithStories]: storybookDevDeps,
[ReactotronChoice.withReactotron]: reactotronDevDeps,
[IconChoice.withIcons]: iconsDevDeps,
[ReactotronChoice.withReactotron]: reactotronDevDeps
};

// Maps selection to handlebars-friendly object for easier conditionals within templates.
Expand All @@ -76,7 +75,7 @@ export const SelectionToTemplateParamsMap: Partial<Record<
| StateLibraryChoice
| ReactotronChoice
| ReactNavigationExampleChoice
| IconChoice,
| IconToolkitChoice,
Partial<TemplateParams>
>> = {
[StyleLibraryChoice.GluestackUICore]: {
Expand Down Expand Up @@ -119,8 +118,8 @@ export const SelectionToTemplateParamsMap: Partial<Record<
[ReactNavigationExampleChoice.WithReactNavigationExample]: {
hasReactNavigationExample: true
},
[IconChoice.withIcons]: {
hasIcons: true,
[IconToolkitChoice.LucideIcons]: {
hasIconToolkit: true,
},

};
Expand Down Expand Up @@ -180,7 +179,7 @@ export const DefaultTemplateParams: TemplateParams = {
hasRTKQuery: false,
hasReactotron: false,
hasReactNavigationExample: false,
hasIcons: false
hasIconToolkit: false
};

const PromptSelectionOptions = {
Expand All @@ -204,9 +203,9 @@ const PromptSelectionOptions = {
choices: Object.values(ReactNavigationExampleChoice),
message: 'React Navigation:'
},
icons: {
choices: Object.values(IconChoice),
message: 'Lucide icons:'
iconToolkit: {
choices: Object.values(IconToolkitChoice),
message: 'Icon Toolkit:'
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/types/BaseProjectTemplateParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export interface TemplateParams {
hasGluestackUIDefaultTheme: boolean;
hasGluestackUIEjected: boolean;
hasAnyGluestackUIOption: boolean;
hasIcons: boolean;
hasIconToolkit: boolean;
hasStorybook: boolean;
hasStorybookExample: boolean;
hasReduxToolkit: boolean;
Expand Down
4 changes: 2 additions & 2 deletions src/types/StartProjectOptionSelectionResult.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
IconChoice,
IconToolkitChoice,
ReactNavigationExampleChoice,
StateLibraryChoice,
StorybookChoice,
Expand All @@ -11,5 +11,5 @@ export interface StartProjectOptionSelectionResult {
storybook: StorybookChoice;
stateManagementLibrary: StateLibraryChoice;
reactNavigationExample: ReactNavigationExampleChoice;
icons: IconChoice;
iconToolkit: IconToolkitChoice;
}

0 comments on commit 8f2b75b

Please sign in to comment.