From e17e118a687a3431289ec8bfa42ace6fcf114523 Mon Sep 17 00:00:00 2001 From: MinuKang Date: Fri, 16 Aug 2024 21:26:29 +0900 Subject: [PATCH] chore: Introduce of opensource (#23) * chore: Introduce of opensource * update example at README.md --- .github/ISSUE_TEMPLATE/bug.yml | 56 ++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.yml | 44 ++++++++++++ CODE_OF_CONDUCT.md | 38 +++++++++++ CONTRIBUTING.md | 75 +++++++++++++++++++++ README.md | 78 +++++++++++++++++++--- 5 files changed, 282 insertions(+), 9 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 0000000..d14484e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -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 diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..a749dc7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -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 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..861b2b6 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -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 frontend.devops@toss.im. 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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..8868805 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,75 @@ +# Contributing to @use-funnel libraries + +Welcome contribution from everyone
+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 git@github.com:{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 pnpm@9.6.0. 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: + +``` +[optional package scope]: + +[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. diff --git a/README.md b/README.md index cb7774c..3bea63c 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,75 @@ -# use-funnel +# @use-funnel -## Development +
+ + +

@use-funnel

+
+

A powerful and safe step-by-step state management library

+
-### 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 ( + history.push('Step2', { message })} />} + Step2={({ context, history }) => ( + history.push('Step3', { flag })} /> + )} + Step3={({ context }) => } + /> + ); +} + +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. + + + + + Toss + + + +MIT © Viva Republica, Inc. See [LICENSE](./LICENSE) for details.