Skip to content

Latest commit

 

History

History
194 lines (137 loc) · 7.54 KB

CONTRIBUTING.md

File metadata and controls

194 lines (137 loc) · 7.54 KB

Contributing

First off, thank you for taking the time to contribute to Open Web ❤️

💭 Knowledge

TypeScript

It's important to note early on that these projects are written with TypeScript. If you're unfamiliar with it or any strongly typed languages such as Java then this may be a slight roadblock. However, there's never a truly perfect time to start learning it, so ... why not today!

Don't be discouraged, because you likely will get by learning TypeScript on-the-fly as you view some of the component examples within the codebase. It's easy getting started—the code is very readable!

Stacks

This project uses Stacks as its framework/engine. Under the hood, it is powered by Vue & Vite to build Vue components, Web Components, and "composable functions".

Architecture

An understanding of the library architecture and design will help if you're looking to contribute long-term, or you are working on a big PR. Browse the source and read our documentation to get a better idea on how it is structured. Feel free to ask any question (Twitter, Discord, or GitHub Discussions), we would love to elaborate.

🎒 Getting Started

Install

Please view the README and the instructions below on how to install the project locally.

Project Setup

Working on your first Pull Request? You can learn how from this free series How to Contribute to an Open Source Project on GitHub.

Head over to the repository on GitHub and click the Fork button in the top right corner. After the project has been forked, run the following commands in your terminal:

# Replace {github-username} with your GitHub username.
git clone https://github.com/{github-username}/stacks --depth=1

cd stacks

# Create a branch for your PR, replace {issue-no} with the GitHub issue number.
git checkout -b issue-{issue-no}

Now it'll help if we keep our main branch pointing at the original repository and make pull requests from the forked branch.

# Add the original repository as a "remote" called "upstream".
git remote add upstream [email protected]:stacksjs/stacks.git

# Fetch the git information from the remote.
git fetch upstream

# Set your local main branch to use the upstream main branch whenever you run `git pull`.
git branch --set-upstream-to=upstream/main main

# Run this when we want to update our version of main.
git pull

Artisan Toolkit

The following list is of some of the most common ways to interact with the Stacks API. Meet Artisan:

pnpm stacks install # installs all dependencies
pnpm stacks dev # starts one of the dev servers (components, functions, pages, or docs)
pnpm stacks build # follow CLI prompts to select which library (or server) to build
pnpm stacks commit # follow CLI prompts for committing changes
pnpm stacks release # creates the releases for the stack & consequently, publishes them to npm

pnpm stacks make:component HelloWorld # scaffolds a component
pnpm stacks make:function HelloWorld # scaffolds a function
pnpm stacks make:page hello-world # scaffolds a page (https://127.0.0.1/hello-world)

pnpm stacks help
View the complete Artisan Toolkit
pnpm stacks --help # view help menu
pnpm stacks install # installs your dependencies
pnpm stacks fresh # fresh reinstall of all deps
pnpm stacks update # auto-update deps & the Stacks framework

pnpm stacks --version # get the Stacks version
pnpm stacks --help # view help menu

# if you need any more info to any command listed here, you may suffix
# any of them via the "help option", i.e. `pnpm stacks ... --help`

pnpm stacks dev # starts one of the dev servers (components, functions, pages, or docs)
pnpm stacks dev:components # starts local playground dev server
pnpm stacks dev:desktop # starts local Desktop dev server
pnpm stacks dev:pages # starts local playground pages dev server
pnpm stacks dev:functions # stubs local the functions
pnpm stacks dev:docs # starts local docs dev server

# for Laravel users, `serve` may be a more familiar command. Hence, we aliased it:
pnpm stacks serve # starts one of the dev servers (components, functions, pages, or docs)
pnpm stacks serve:components # starts local playground dev server
pnpm stacks serve:pages # starts local playground pages dev server
pnpm stacks serve:functions # stubs local the functions
pnpm stacks serve:docs # starts local docs dev server

# sets your application key
pnpm stacks key:generate

pnpm stacks make:stack project
pnpm stacks make:component HelloWorld
pnpm stacks make:function hello-world
pnpm stacks make:page hello-world
pnpm stacks make:lang de
pnpm stacks make:database cars
pnpm stacks make:table brands
pnpm stacks make:migration create_cars_table
pnpm stacks make:factory cars

pnpm stacks stub # stubs all the libraries
pnpm stacks stub:functions # stubs the function library

pnpm stacks lint # runs linter
pnpm stacks lint:fix # runs linter and fixes issues

pnpm stacks commit # follow CLI prompts for committing staged changes
pnpm stacks release # creates the releases for the stack & triggers the Release Action (workflow)
pnpm stacks changelog # generates CHANGELOG.md

# building for production (e.g. npm, Vercel, Netlify, et al.)
pnpm stacks build # select a specific build (follow CLI prompts)
pnpm stacks build:components # builds Vue component library & Web Component library
pnpm stacks build:functions # builds function library
pnpm stacks build:vue-components # builds Vue 2 & 3-ready Component library
pnpm stacks build:web-components # builds framework agnostic Web Component library (i.e. Custom Elements)
pnpm stacks build:pages # builds pages

# when deploying your app/s
pnpm stacks deploy:docs
pnpm stacks deploy:functions
pnpm stacks deploy:pages

# select the example to run (follow CLI prompts)
pnpm stacks example

# test your stack
pnpm stacks test # runs test suite
pnpm stacks test:unit # runs unit tests
pnpm stacks test:e2e # runs e2e tests
pnpm stacks test:coverage # runs test coverage
pnpm stacks test:types # runs typecheck

🧪 Test

Unit

Each of our components come with test cases. Feel free to check them out within the ./tests root folder. When adding or or updating functionality, please ensure it is covered through our tests cases. Ensure so by running pnpm test.

✍️ Commit

This project uses semantic commit messages to automate package releases. We automated the commit process for you, and simply run pnpm run commit in your terminal and follow the instructions.

For example,

# Add all changes to staging to be committed.
git add .

# Commit changes.
pnpm run commit

# Push changes up to GitHub.
git push

🎉 Pull Request

When you're all done, head over to the repository, and click the big green Compare & Pull Request button that should appear after you've pushed changes to your fork.

Don't expect your PR to be accepted immediately or even accepted at all. Give the community time to vet it and see if it should be merged. Please don't be disheartened if it's not accepted. Your contribution is appreciated more than you can imagine, and even a failed PR can teach us a lot ❤️