Skip to content

Latest commit

 

History

History
114 lines (74 loc) · 4.12 KB

CONTRIBUTING.md

File metadata and controls

114 lines (74 loc) · 4.12 KB

Contributions Welcome!

Interested in contributing? We'd love your help!

If you run into problems or find something confusing, please share it with us in this discussion. A great experience for new contributors is very important to us!

Please note that all activity on the snowpackjs/snowpack repository and our Discord is moderated and will be strictly enforced under Snowpack's Contributor Code of Conduct.

Our issue tracker is always organized with a selection of high-priority bugs, feature requests, and "help wanted!"/"good first issue" items. For general package troubleshooting and discussions, check out our Package Community discussion board.

Requirements

Snowpack uses yarn workspaces to manage multiple packages contained in this repository. To contribute, make sure that you have Yarn installed on your machine.

Initial setup

git clone https://github.com/snowpackjs/snowpack.git
cd snowpack
yarn

Build after changes

Some packages in the repo are written in JavaScript, and require no build step. Others (like Snowpack itself) are written in TypeScript, and require a build step to run.

# Option 1: A one-time build step
yarn build

# Option 2: Start a persistent TypeScript watcher, recompiling on every change
# Recommended for active development, when many changes are required
yarn build:watch

Updating and adding packages

Since this is a monorepo with several packages, if you want to update/add packages in the subrepos like create-snowpack-app/app-template-11ty you'll want to run the commands in the target subdirectory like

cd create-snowpack-app/app-template-vue
yarn add vue@latest

Tests

We recommend running all tests before you submit a PR.

Running tests

From the repository's root folder, run

yarn build
yarn test
yarn test:dev # might fail on windows, see #1171

Snapshot tests

The way our snapshot tests work is they test Snowpack by building the codebases in test/build. You'll almost always have a "failed" snapshot test when you make a contribution because your new change will make the final build different. You'll want to take a new snapshot. To do this run:

yarn test -u

You'll notice this changes the snapshot file. Commit this change and submit it along with your PR.

Filtering tests

You can filter the tests that are being run using Jest's --testNamePattern (alias: -t) CLI option. You can ignore the 123 snapshots obsolete messages.

yarn test --testNamePattern treeshake

Run local snowpack in another project

You can run your local snowpack by path

yarn build
cd path/to/some-other-project
/path/to/snowpack/pkg/dist-node/index.bin.js dev --verbose --reload

Or by linking the global snowpack library to your local clone

cd pkg
npm link
cd path/to/some-other-project
snowpack dev --verbose --reload

To test a local version of the CLI tool use

node /path/to/snowpack/create-snowpack-app/cli [my-new-dir] --template @snowpack/app-template-vue

To test a local version of the create-snowpack-app templates use

npx create-snowpack-app [my-new-dir] --template ./path/to/template

Note the path must start with must start with a . to be considered local

The --verbose flag enables additional logs which will help to identify the source of a problem. The --reload will clear the local cache which might have been created by a different snowpack version. Learn more about Snowpack's CLI flags.

Discussion

Join the Pika Discord