Skip to content

Commit

Permalink
chore: Introduce of opensource (#23)
Browse files Browse the repository at this point in the history
* chore: Introduce of opensource

* update example at README.md
  • Loading branch information
minuukang authored Aug 16, 2024
1 parent eb6d0c7 commit e17e118
Show file tree
Hide file tree
Showing 5 changed files with 282 additions and 9 deletions.
56 changes: 56 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Bug Report
description: Report a bug
labels: [bug]
title: '[Bug]:'
body:
- type: dropdown
id: package
attributes:
label: Package Scope
description: Is this issue related to a specific package?
multiple: true
options:
- '@use-funnel/core'
- '@use-funnel/react-router-dom'
- '@use-funnel/next'
- '@use-funnel/react-navigation-native'
- '@use-funnel/browser'
- etc
validations:
required: true

- type: textarea
id: description
attributes:
description: Description what bug we need to fix
label: Bug description
validations:
required: true

- type: textarea
id: expected
attributes:
label: Expected behavior

- type: textarea
id: reproduction-steps
attributes:
label: To Reproduce
description: Please tell me in detail how to reproduce it. If it seems to occur only in a specific environment, please also provide information about the OS and the environment
placeholder: |
Minimal reproducible code or describe steps to reproduce. Optional, but recommended
- type: textarea
id: possible-solution
attributes:
label: Possible Solution
placeholder: I think this is probably...
validations:
required: false

- type: textarea
id: etc
attributes:
label: etc.
validations:
required: false
44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Feature Request
description: Suggest an idea
labels: [feature]
title: '[Feature]:'
body:
- type: dropdown
id: package
attributes:
label: Package Scope
description: Is this issue related to a specific package?
multiple: true
options:
- '@use-funnel/core'
- '@use-funnel/react-router-dom'
- '@use-funnel/next'
- '@use-funnel/react-navigation-native'
- '@use-funnel/browser'
- etc
validations:
required: true

- type: textarea
id: description
attributes:
description: Description what feature you want
label: Description
validations:
required: true

- type: textarea
id: possible-solution
attributes:
label: Possible Solution
description: If you have suggestions on a fix for the bug
placeholder: I think this is probably...
validations:
required: false

- type: textarea
id: etc
attributes:
label: etc.
validations:
required: false
38 changes: 38 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Contributor Covenant Code of Conduct
Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
Our Standards

Examples of behavior that contributes to creating a positive environment include:

Using welcoming and inclusive language
Being respectful of differing viewpoints and experiences
Gracefully accepting constructive criticism
Focusing on what is best for the community
Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

The use of sexualized language or imagery and unwelcome sexual attention or advances
Trolling, insulting/derogatory comments, and personal or political attacks
Public or private harassment
Publishing others' private information, such as a physical or electronic address, without explicit permission
Other conduct which could reasonably be considered inappropriate in a professional setting

Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
Attribution

This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at http://contributor-covenant.org/version/1/4
75 changes: 75 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Contributing to @use-funnel libraries

Welcome contribution from everyone <br/>
All communications in this repository will be by English.

> Every contributor to @use-funnel libraries should adhere to [our Code of Conduct](./CODE_OF_CONDUCT.md). Please read it to understand what actions will and will not be tolerated.
## Contributing as issue

### 1. Search for duplicates

[Search the existing issues](https://github.com/toss/use-funnel/issues) before logging a new one.

### 2. Have a question?

The issue tracker is for **issues**, in other words, bugs and suggestions.
If you have a _question_, please use [GitHub Discussions](https://github.com/toss/use-funnel/discussions), your favorite search engine, or other resources.

### 3. Found a bug?

When logging a bug, please be sure to include the following:

- What version of TypeScript you're using (run `tsc --v`)
- If at all possible, an _isolated_ way to reproduce the behavior
- The behavior you expect to see, and the actual behavior

### 4. Feature suggestion?

We also accept suggestions in the [issue tracker](https://github.com/toss/use-funnel/issues/new?assignees=&labels=&projects=&template=feature_request.md&title=%5BFeature%5D%3A).

In general, things we find useful when reviewing suggestions are:

- A description of the problem you're trying to solve
- An overview of the suggested solution

## Contributing as code

### Prerequisites

0. [Choose an issue about bug or feature you want to work on](https://github.com/toss/use-funnel/issues)
1. Fork this repository.
2. Clone the repository
```shell
git clone [email protected]:{username}/use-funnel.git
```
3. Please use the correct node version. You can use the version declared in [.nvmrc](https://github.com/toss/use-funnel/blob/main/.nvmrc). We strongly recommend [nvm](https://github.com/nvm-sh/nvm) to control local machine's node version easily. also We recommend [nvm's deeper shell integration](https://github.com/nvm-sh/nvm#deeper-shell-integration) too.
4. Install packages. [We use [email protected]. Install pnpm with corepack please if you can](https://pnpm.io/installation#using-corepack). We recommend using corepack for pnpm to automatically use the version declared in the packageManager field of package.json.
```shell
corepack enable && corepack prepare
pnpm install
```

### Add a new router package

```shell
pnpm add:router --name your-router-name
```

### Pull Requests

> [Opening a pull request](https://github.com/toss/use-funnel/pulls)

All commit message and title of your Pull Request should match the following format:

```
<type>[optional package scope]: <description>
[optional body]
[optional footer(s)]
```

> We adhere [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). We check your commits on pre-commit(git-hook) by husky with our rules. please follow it.

Several predefined GitHub Workflows will check qualities. If you fail our checks, please check the error message and update the Pull Request.
78 changes: 69 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,75 @@
# use-funnel
# @use-funnel

## Development
<div align="center">
<a href="https://use-funnel.slash.page" title="@use-funnel - A powerful and safe step-by-step state management library">
<img src="./docs/public/logo.png" width="200" />
<h1 align="center">@use-funnel</h1>
</a>
<p style="font-size:18px;">A powerful and safe step-by-step state management library</p>
</div>

### Add router package
`@use-funnel` is a [React Hook](https://react.dev/reference/rules/rules-of-hooks) that helps you easily implement complex UI flows.

```sh
pnpm add:router --name your-router-name
```
## Core Concepts

### Strong Type Support

By comparing the type of the current step with the type of the next step, you can safely manage only the necessary states.

### State Management by History

Manage states by history, so you can easily manage back and forth.

### Various Router Support

Supports browser history, react-router-dom, next.js, @react-navigation/native, etc.

## Example

### Build workspace all
```tsx
import { useFunnel } from '@use-funnel/react-router-dom';

```sh
pnpm --filter="*" run build
export function App() {
const funnel = useFunnel<{
Step1: { message?: string; flag?: boolean };
Step2: { message: string; flag?: boolean };
Step3: { message: string; flag: boolean };
}>({
id: 'hello-world',
initial: {
step: 'Step1',
context: {},
},
});
return (
<funnel.Render
Step1={({ history }) => <Step1 onNext={(message) => history.push('Step2', { message })} />}
Step2={({ context, history }) => (
<Step2 message={context.message} onNext={(flag) => history.push('Step3', { flag })} />
)}
Step3={({ context }) => <Step3 message={context.message} flag={context.flag} />}
/>
);
}

declare function Step1(props: { onNext: (message: string) => void }): React.ReactNode;
declare function Step2(props: { message: string; onNext: (flag: boolean) => void }): React.ReactNode;
declare function Step3(props: { message: string; flag: boolean }): React.ReactNode;
```

## Visit [use-funnel.slash.page](https://use-funnel.slash.page) for docs, guides, API and more!

[English](https://use-funnel.slash.page/en) | [한국어](https://use-funnel.slash.page/ko)

## Contributing

Read our [Contributing Guide](./CONTRIBUTING.md) to familiarize yourself with `@use-funnel` development process, how to suggest bug fixes and improvements, and the steps for building and testing your changes.

<a title="Toss" href="https://toss.im">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://static.toss.im/logos/png/4x/logo-toss-reverse.png">
<img alt="Toss" src="https://static.toss.im/logos/png/4x/logo-toss.png" width="100">
</picture>
</a>

MIT © Viva Republica, Inc. See [LICENSE](./LICENSE) for details.

0 comments on commit e17e118

Please sign in to comment.