|
| 1 | +# Contributing to esbuild-sass-modules-plugin |
| 2 | + |
| 3 | +The following is a set of guidelines for contributing to the project. |
| 4 | +These are mostly guidelines, not rules. |
| 5 | +Use your best judgment, and feel free to propose changes to this document in a |
| 6 | +pull request. |
| 7 | + |
| 8 | +#### Table Of Contents |
| 9 | +[Code of Conduct](#code-of-conduct) |
| 10 | + |
| 11 | +[tldr; I just have a question!](#tldr-i-just-have-a-question) |
| 12 | + |
| 13 | +[What should I know before I get started?](#what-should-i-know-before-i-get-started) |
| 14 | +* [Package manager](#package-manager) |
| 15 | +* [Dependencies](#dependencies) |
| 16 | +* [Workflow](#workflow) |
| 17 | +* [Code style](#code-style) |
| 18 | +* [Pull requests](#pull-requests) |
| 19 | + |
| 20 | +[Thank you!](#thank-you) |
| 21 | + |
| 22 | +## Code of Conduct |
| 23 | + |
| 24 | +This project and everyone participating in it is governed by the |
| 25 | +[Code of Conduct](CODE_OF_CONDUCT.md). |
| 26 | +By participating, you are expected to uphold this code. |
| 27 | +Please report unacceptable behavior to [officialsquirrelnetwork@gmail.com](mailto:officialsquirrelnetwork@gmail.com). |
| 28 | + |
| 29 | +## TLDR; I just have a question! |
| 30 | +> **Note:** Please don't file an issue to ask a question. |
| 31 | +
|
| 32 | +Feel free to contact us in the network by reaching the Squirrel Network's |
| 33 | +administrators. |
| 34 | + |
| 35 | +## What should I know before I get started? |
| 36 | + |
| 37 | +### Package manager |
| 38 | + |
| 39 | +This project uses the Yarn package manager version 3.2.1 in the _stable_ branch. |
| 40 | +To ensure version changes will not affect the build or the tests, the actual |
| 41 | +CLI is included in this repository under [.yarn/releases](.yarn/releases). |
| 42 | + |
| 43 | +Beacuse of Yarn, this npm module package needs to be loaded accordingly when |
| 44 | +running tests; the following command should allow you to make both Node and Jest |
| 45 | +work with modules: |
| 46 | + |
| 47 | +```shell |
| 48 | +$ yarn node --experimental-vm-modules $(yarn bin jest) |
| 49 | +``` |
| 50 | + |
| 51 | +### Dependencies |
| 52 | + |
| 53 | +This project depends on the following packages: |
| 54 | + |
| 55 | +* lodash |
| 56 | +* esbuild |
| 57 | +* jest |
| 58 | +* postcss |
| 59 | +* sass |
| 60 | + |
| 61 | +However, removing or adding dependencies can be done after approved pull |
| 62 | +requests. |
| 63 | + |
| 64 | +### Workflow |
| 65 | + |
| 66 | +This repository is organized in the following branches: |
| 67 | + |
| 68 | +* `master`: production-ready code expected to be published on npm |
| 69 | +* `develop`: working tested code that merges the features and eventually gets |
| 70 | +hotfixes |
| 71 | +* `feature/`: the branches under this name represent the features of this |
| 72 | +package and should be named accordingly |
| 73 | +* `testing`: for developing and fixing the test suites themselves |
| 74 | + |
| 75 | +The usual workflow is as defined below: |
| 76 | + |
| 77 | +1. Clone this repo |
| 78 | +2. Checkout `develop` |
| 79 | +3. Create or checkout the `feature/` branch you'll be working on |
| 80 | +4. Develop the feature or the tests |
| 81 | +5. Commit to that `feature/` branch only the changes in `src/` |
| 82 | +6. Move to `testing` |
| 83 | +7. Merge your `feature/` into `testing` |
| 84 | +8. Commit the changes to your test suites |
| 85 | +9. If everything goes well, checkout `feature/` again and merge `testing` to |
| 86 | +your `feature/` |
| 87 | +10. Merge `feature/` into `develop` |
| 88 | + |
| 89 | +> Note: please make sure that all the branches you're working on are up-to-date, |
| 90 | +> and do not directly merge on `master`. |
| 91 | +
|
| 92 | +### Code style |
| 93 | + |
| 94 | +> Note: please use UTF-8 without BOM for all the files and Unix-style line |
| 95 | +> endings. |
| 96 | +
|
| 97 | +There is not relly any defined code style, but there are some rules I would |
| 98 | +prefer the contributors to follow: |
| 99 | + |
| 100 | +- Use the same indentation characters, which in this case is tabs. |
| 101 | +- The block notation I use is inspired by [Elm](https://elm-lang.org/examples/cards) |
| 102 | +and looks like these examples: |
| 103 | +```js |
| 104 | +{ property1: value |
| 105 | +, property2: value |
| 106 | +, property3: value |
| 107 | +} |
| 108 | + |
| 109 | +[ item1 |
| 110 | +, item2 |
| 111 | +, item3 |
| 112 | +] |
| 113 | +``` |
| 114 | +In my opinion, this style looks more clean and easy to read and edit. |
| 115 | +- Use the `_().method` versions with lodash. |
| 116 | +- Use [BSD-style switches](https://www.freebsd.org/cgi/man.cgi?query=style&sektion=9) |
| 117 | +and scope the cases with brackets: |
| 118 | +```js |
| 119 | +switch(on) { |
| 120 | +case match: { |
| 121 | + break; |
| 122 | +} |
| 123 | +} |
| 124 | +``` |
| 125 | +In my opinion, this makes it more clear where the cases begin or end, and also |
| 126 | +scopes them in a block which can sometimes be useful. |
| 127 | +- Do not go over 80 columns. I usually have multiple files open at one time, and |
| 128 | +80 columns makes it so that code can fit into my view without having to scroll |
| 129 | +it horizontally. |
| 130 | + |
| 131 | +### Pull requests |
| 132 | + |
| 133 | +In general, feel free to file us pull requests. There aren't any special |
| 134 | +requirements to meet I can think of, but just following this guide and the Code |
| 135 | +of Conduct should be enough. |
| 136 | + |
| 137 | +## Thank you! |
| 138 | + |
| 139 | +Thank you from me and the whole Squirrel Network for contributing to this small |
| 140 | +plugin! |
| 141 | + |
| 142 | +<p align=center> |
| 143 | + |
| 144 | +</p> |
0 commit comments