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

docs: Updates contributing file #2112

Merged
merged 7 commits into from
Nov 21, 2023
Merged
Changes from 5 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
117 changes: 28 additions & 89 deletions CONTRIBUTING.MD
Original file line number Diff line number Diff line change
@@ -1,117 +1,56 @@
# How to contribute

## Developing Locally

### Developing Packages that depend on one another at the same time

1. Run `yarn` at the root of the repo.

2. Run `yarn lerna link --force-local` at the root of the repo.

3. Run `yarn build` at the root of the repo.

4. Run `yarn dev` at each of the packages that depends on the other.
1. Fork this repository.

> You can run a package individually: `yarn workspace {packageName} develop`
2. Clone your forked `faststore` repository.

### Developing packages while also testing on a store

1. Repeat the steps from the above section

2. Run `yarn link` on the package that you are developing

3. Run `yarn` at the store's repo
3. Create a new branch for the changes you are working on.

4. If the store's repo already have the package that you are developing as a dependency, just run `yarn link {packageName}`

5. If your package is not an npm dependency yet, you can develop locally by referring to your local version of the package on gatsby config.

Example:
## Developing Locally

```ts
{
resolve: '/Users/jmgris/work/faststore/packages/gatsby-plugin-pixel-facebook'
}
```
### Developing Packages

### Creating Components on the `faststore/ui`
1. Run `yarn` at the root of the repo.

You can generate the boilerplate files for your new component using the following command:
2. Run `yarn build` at the root of the repo.

- run `yarn generate-ui-component`
3. Run `yarn turbo run dev --filter={packageName}` to run a package individually.

```bash
# What is your component name?
> For example, if you want to run the `@faststore/core` package, at the root of the repo run:
>
> `yarn turbo run dev --filter=@faststore/core`

ComponentName
### Developing packages while also testing on a store

# What is your component atomic group? (Use arrow keys)
To test your changes in a store, you will need to create a pull request (for more guidance, refer to the next section). You can keep your pull request in `draft` while testing.

> atoms
> molecules
> organisms
```
1. After committing your changes, push them to the remote repo and open a Pull Request.

- It will automatically generate the files below:
2. In the checks's section, find `ci/codesandbox` and click on `Details`.

```
✔ ++ faststore/packages/ui/src/atoms/ComponentName/ComponentName.tsx
✔ ++ faststore/packages/ui/src/atoms/ComponentName/index.tsx
✔ ++ faststore/packages/styles/src/atoms/component-name.css
✔ ++ faststore/packages/ui/src/atoms/ComponentName/ComponentName.test.tsx
✔ ++ faststore/packages/ui/src/atoms/ComponentName/stories/ComponentName.stories.tsx
✔ ++ faststore/packages/ui/src/atoms/ComponentName/stories/ComponentName.mdx
✔ _+ faststore/packages/ui/src/index.ts
```
<img width="502" alt="checks_details" src="https://github.com/vtex/faststore/assets/3356699/fb4a357d-b077-44d3-888b-41cbd05d39d3"></img>
hellofanny marked this conversation as resolved.
Show resolved Hide resolved

And that is it! You will be ready to work on your component. 🎉
3. Use the `Local Install Instructions` provided for the PR to **add your version of the packages** as dependencies in the `package.json` file of the [starter](https://github.com/vtex-sites/starter.store) or your store.

> For the component name, please follow the Pascal Case pattern, and do not use `-`, i.e., Component-Name.
<img width="502" alt="image" src="https://github.com/vtex/faststore/assets/3356699/8d25cc15-1463-4f6b-9c57-7c8ecddbc22f"></img>
hellofanny marked this conversation as resolved.
Show resolved Hide resolved

> Please do not edit `// Atoms`, `// Molecules` and `// Organisms` comments on `packages/ui/scr/index.ts` [file](https://github.com/vtex/faststore/blob/b1badead35dc43b41f25480a66f4e81cc9a8e22a/packages/ui/src/index.ts), because we are using it as a [pattern](https://github.com/vtex/faststore/blob/443cbd117e34ea1702a2994ca4ad0b2733f17189/generators/plopfile.ts#L62) to update the file. For more details, check [here](https://github.com/vtex/faststore/pull/1039).
4. Run `yarn` to install the updates and test your changes.

## Creating Pull Requests

1. Create a production build by running `yarn build` at the root of the package that you are developing

2. Commit your changes in a branch

3. Push your changes to the remote repo and open a Pull Request

4. Use the `Local Install Instructions` provided on the `CodeSandBox` bot in the PR to add your version of the packages as dependencies in the `package.json` file of the [storecomponents](https://github.com/vtex-sites/storecomponents.store).

5. Submit a Pull Request with this changes to `storecomponents`

6. Wait for checks to pass and reviews to be approved.

## Release

1. After acquiring the necessary approval, rebase and squash-merge your PR in master

2. A bot will commit on master releasing your changes. In the meantime, go grab a coffee ☕

> If the bot isn't working or you want to release it manually, use the following command to clean any artifact and release a clean build:
>
> `git clean -fdx && yarn && lerna run build && lerna publish patch --yes`

3. Update `package.json` of the `storecomponents` with:
We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification for pull request title and commits messages.

```
yarn upgrade -L --scope @vtex
```
1. After committing your changes, push them to the remote repo and open a Pull Request.

4. Stage, commit and push your changes with:
2. Please add a clear and concise title PR title with one the prefixes.

```
git add . && git commit -m "upgrade deps" && git push
```
- Available prefixes: `feat`, `fix`, `chore`, `docs`, `style`
- Example: `feat: Add Carousel component`

5. Rebase with master
3. You will be presented with a pull request template. Kindly provide a description of the motivation behind and the changes you made. This information will help reviewers in understanding your contributions.

```
git rebase origin/master && git push --force
```
4. Wait for checks to pass and reviews to be approved.

6. Wait for the PR checks to have been passed
5. When your changes are merged, a new release will be initiated, incorporating your updates into the latest version.

7. Squash-merge for releasing a new store version 🎉
Thanks for contributing 🎉