Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update: add configuration and CLI pages #19

Merged
merged 1 commit into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions pages/get-started/_meta.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"installation": {
"title": "Installation"
},
"changelog": {
"title": "Changelog"
}
"installation": "Installation",
"changelog":"Changelog",
"configuration":"Configuration",
"cli":"CLI"
}
12 changes: 12 additions & 0 deletions pages/get-started/cli.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

import { Callout } from 'nextra/components'

# CLI

<h3 className="mt-4 text-xl font-normal text-gray-400">How to add and structure the hooks in your project.</h3>

<Callout type="info">
I've just added a convenient feature and I'll start working on it: a custom Command Line Interface (CLI) tool.
This CLI is designed to handle a specific step in the process, making things smoother for you.
Instead of manually dealing with it, you can now just run the CLI and let it take care of everything.
</Callout>
64 changes: 64 additions & 0 deletions pages/get-started/configuration.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { Steps } from 'nextra/components'
import { Callout } from 'nextra/components'
import { FileTree } from 'nextra/components'

# Configuration

<h3 className="mt-4 text-xl font-normal text-gray-400">How to configure Rehook to work with different React frameworks.</h3>


<Steps>

### Create configuration file

Begin by creating a file named `rehook.config.ts` in your project. This is where you will house your configuration.

Here's the structure I typically follow:

```
.
├── src
│ ├── hooks
│ ├── ...
├── rehook.config.ts
└── ...

```

<FileTree>
<FileTree.Folder name="src" defaultOpen>
<FileTree.File name="use-history.ts" />
<FileTree.File name="use-local-storage.ts" />
</FileTree.Folder>
<FileTree.File name="rehook.config.ts" />
</FileTree>

### Copy & paste

Copy & paste the configuration below:

```ts
// rehook.config.ts

export const VITE_DEFAULT_ENV_VARS = ['BASE_URL', 'NODE', 'MODE', 'DEV', 'PROD', 'SSR']

export const NEXT_DEFAULT_ENV_VARS = ['NODE_ENV', 'TZ']

type RehookConfig = {
framework: 'VITE' | 'NEXT'
ignoreDefaultEnv: boolean
}

export const rehookConfig: RehookConfig = {
framework: 'VITE' // or NEXT,

ignoreDefaultEnv: true, // This is for useEnv hook
}
```




### That's it !

</Steps>
7 changes: 0 additions & 7 deletions pages/get-started/installation.mdx
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import { Steps } from 'nextra/components'
import { Callout } from 'nextra/components'
import { FileTree } from 'nextra/components'

# Installation

<h3 className="mt-4 text-xl font-normal text-gray-400">How to add and structure the hooks in your project.</h3>

<Callout type="info">
**Quick heads up!**
I've just added a convenient feature and I'll start working on it: a custom Command Line Interface (CLI) tool.
This CLI is designed to handle a specific step in the process, making things smoother for you.
Instead of manually dealing with it, you can now just run the CLI and let it take care of everything.
</Callout>

<Steps>
### Create folder
Expand Down
Loading