├── .editorconfig ├── .eslintrc.json ├── .github └── workflows │ ├── nlm.yml │ ├── node.js.yml │ └── npm-publish.yml ├── .gitignore ├── .nlmrc ├── .npmrc ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── example └── config.json ├── file-alternatives.js ├── file.js ├── http.js ├── lib ├── cache.js ├── crash-recovery.js ├── dir-content.js ├── file-alternatives.js ├── file.js ├── http.js ├── interval.js ├── latest-file.js ├── promise.js ├── safe-merge.js └── shared-store.js ├── package-lock.json ├── package.json └── test ├── check-error.js ├── crash-recovery.test.js ├── crashing ├── file-alternatives.test.js ├── file.test.js ├── http.test.js ├── interval.test.js ├── latest-file.test.js ├── promise.test.js └── shared-store ├── error-handling.test.js ├── index.test.js ├── no-cache.test.js ├── retry.test.js └── with-cache.test.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.md] 11 | trim_trailing_whitespace = false 12 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "groupon", 3 | "overrides": [ 4 | { 5 | "files": "*.test.js", 6 | "env": { 7 | "mocha": true 8 | } 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /.github/workflows/nlm.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 3 | 4 | name: NLM 5 | 6 | on: 7 | pull_request: 8 | 9 | jobs: 10 | tag: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v2 15 | with: 16 | fetch-depth: 0 # necessary to get full commit history 17 | - name: Use Node.js 18 | uses: actions/setup-node@v2 19 | with: 20 | node-version: 14 21 | - run: npm ci 22 | - run: npx nlm verify 23 | env: 24 | GH_TOKEN: ${{secrets.GITHUB_TOKEN}} 25 | -------------------------------------------------------------------------------- /.github/workflows/node.js.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 3 | 4 | name: Node.js CI 5 | 6 | on: 7 | push: 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | 13 | strategy: 14 | matrix: 15 | node-version: [12.x, 14.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Use Node.js ${{ matrix.node-version }} 20 | uses: actions/setup-node@v2 21 | with: 22 | node-version: ${{ matrix.node-version }} 23 | - run: npm ci 24 | - run: npm run build --if-present 25 | - run: npm test 26 | -------------------------------------------------------------------------------- /.github/workflows/npm-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages 3 | 4 | name: Publish to NPM 5 | 6 | on: 7 | push: 8 | branches: [ main ] 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | - uses: actions/setup-node@v2 16 | with: 17 | node-version: 14 18 | - run: npm ci 19 | - run: npm test 20 | 21 | publish-npm: 22 | needs: build 23 | runs-on: ubuntu-latest 24 | steps: 25 | - uses: actions/checkout@v2 26 | with: 27 | fetch-depth: 0 28 | - uses: actions/setup-node@v2 29 | with: 30 | node-version: 14 31 | - run: npm ci 32 | - run: npx nlm release 33 | env: 34 | GH_TOKEN: ${{secrets.GITHUB_TOKEN}} 35 | NPM_TOKEN: ${{secrets.NPM_TOKEN}} 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /yarn.lock 2 | node_modules/ 3 | /tmp 4 | npm-debug.log 5 | test/tmp 6 | test/log 7 | /.idea 8 | /.nyc_output 9 | /coverage 10 | -------------------------------------------------------------------------------- /.nlmrc: -------------------------------------------------------------------------------- 1 | [license] 2 | files[] = src 3 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | registry=https://registry.npmjs.org 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ### v4.1.2 (2021-08-16) 2 | 3 | #### 🔼 Dependencies 4 | 5 | * [#55](https://github.com/groupon/shared-store/pull/55) chore(deps): bump path-parse from 1.0.6 to 1.0.7 ([@dependabot[bot]](https://github.com/apps/dependabot)) 6 | 7 | 8 | ### v4.1.1 (2021-06-11) 9 | 10 | #### 🐛 Bug Fixes 11 | 12 | * [#54](https://github.com/groupon/shared-store/pull/54) fix(yml): add .yaml extension ([@aaarichter](https://github.com/aaarichter)) 13 | 14 | #### 🏡 Internal 15 | 16 | * [#53](https://github.com/groupon/shared-store/pull/53) ci(actions): add GitHub actions ([@aaarichter](https://github.com/aaarichter)) 17 | 18 | 19 | ### v4.1.0 (2021-04-20) 20 | 21 | #### 🚀 New Features 22 | 23 | * [#51](https://github.com/groupon/shared-store/pull/51) feat: support yaml ([@aaarichter](https://github.com/aaarichter)) 24 | 25 | 26 | ### v4.0.8 (2021-03-26) 27 | 28 | #### 🏡 Internal 29 | 30 | * [#50](https://github.com/groupon/shared-store/pull/50) chore: switch to main & update packages ([@aaarichter](https://github.com/aaarichter)) 31 | 32 | 33 | ### v4.0.7 (2021-03-15) 34 | 35 | #### 🐛 Bug Fixes 36 | 37 | * [#49](https://github.com/groupon/shared-store/pull/49) fix: avoid error on empty cson/json ([@aaarichter](https://github.com/aaarichter)) 38 | 39 | 40 | ### v4.0.6 (2021-02-17) 41 | 42 | #### 🔼 Dependencies 43 | 44 | * [#48](https://github.com/groupon/shared-store/pull/48) chore(deps): bump ini from 1.3.5 to 1.3.8 ([@dependabot[bot]](https://github.com/apps/dependabot)) 45 | 46 | 47 | ### 4.0.5 - 2020-09-03 48 | 49 | * refactor: remove nodash functions & test refactor - **[@aaarichter](https://github.com/aaarichter)** [#47](https://github.com/groupon/shared-store/pull/47) 50 | - [`2ac79e2`](https://github.com/groupon/shared-store/commit/2ac79e2acb1c15617c1e6f09a08a8608cc4dd7d1) ♻️ **chore:** update dependencies 51 | - [`4ed2eb1`](https://github.com/groupon/shared-store/commit/4ed2eb14766c1d66fd3d1dc3c56a2416b7a512e4) ✅ **test:** use node assert instead of assertive 52 | - [`2e868e3`](https://github.com/groupon/shared-store/commit/2e868e3bfb239859d6bbcd866e0c155566f59f9e) 💚 **ci:** add node 14 to travis 53 | - [`d979d32`](https://github.com/groupon/shared-store/commit/d979d32198f93313d16475ad3317f424f656dcf8) ♻️ **chore:** update dependencies 54 | - [`9891749`](https://github.com/groupon/shared-store/commit/9891749bfbc9395b0c17db2bf002577b668f10b6) 📦️ **refactor:** remove nodash functions 55 | - [`779937e`](https://github.com/groupon/shared-store/commit/779937e8da8287bf9518db6c28aef322abf62687) ✅ **test:** fix test promise handling 56 | 57 | 58 | ### 4.0.4 - 2020-07-20 59 | 60 | * chore(deps): bump lodash from 4.17.15 to 4.17.19 - **[@dependabot[bot]](https://github.com/apps/dependabot)** [#45](https://github.com/groupon/shared-store/pull/45) 61 | - [`c468f10`](https://github.com/groupon/shared-store/commit/c468f100a06c19652df78a2179820d039ddbc1bf) **chore:** bump lodash from 4.17.15 to 4.17.19 - see: [4](- [Commits](https://github.com/lodash/lodash/compare/4) 62 | 63 | 64 | ### 4.0.3 - 2020-05-10 65 | 66 | * refactor: switch to rx-lite packages - **[@aaarichter](https://github.com/aaarichter)** [#44](https://github.com/groupon/shared-store/pull/44) 67 | - [`c8dc636`](https://github.com/groupon/shared-store/commit/c8dc63691e09cc02f8a421571459d907e5acb984) **refactor:** switch to rx-lite packages 68 | 69 | 70 | ### 4.0.2 - 2020-05-06 71 | 72 | * fix: set internal vars ahead of time - **[@aaarichter](https://github.com/aaarichter)** [#43](https://github.com/groupon/shared-store/pull/43) 73 | - [`5f7008d`](https://github.com/groupon/shared-store/commit/5f7008d214be98a2c64320973e7200beb74c863a) **fix:** set internal vars ahead of time 74 | 75 | 76 | ### 4.0.1 - 2020-04-30 77 | 78 | * chore: update package and remove unused bluebird pkg - **[@aaarichter](https://github.com/aaarichter)** [#42](https://github.com/groupon/shared-store/pull/42) 79 | - [`36a7c5a`](https://github.com/groupon/shared-store/commit/36a7c5a93705db5f89cd4f32d21452f47acd7d39) **chore:** update package and remove unused bluebird pkg 80 | 81 | 82 | ### 4.0.0 - 2020-04-07 83 | 84 | #### Breaking Changes 85 | 86 | - drop node 8 support due to dependencies 87 | 88 | *See: [`ad0263e`](https://github.com/groupon/shared-store/commit/ad0263e16033790f095d049c5699c5b728678218)* 89 | 90 | #### Commits 91 | 92 | * refactor: decaf, node 8 deprecation & package upgrades - **[@aaarichter](https://github.com/aaarichter)** [#41](https://github.com/groupon/shared-store/pull/41) 93 | - [`da08155`](https://github.com/groupon/shared-store/commit/da081559157016869b0c257ec5dad9f419536806) **refactor:** decaf /test 94 | - [`651472b`](https://github.com/groupon/shared-store/commit/651472b8a8e80cda33e0386f08e9a1f9ed5d273a) **refactor:** decaf /lib & improve tests 95 | - [`99a61da`](https://github.com/groupon/shared-store/commit/99a61dac1422f1be6ddae539ab9d3844b1d03654) **refactor:** safeMerge() 96 | - [`514a840`](https://github.com/groupon/shared-store/commit/514a840bb27cb30afb309a66eecec48a79e4147d) **chore:** upgrade cson-parser 97 | - [`ad0263e`](https://github.com/groupon/shared-store/commit/ad0263e16033790f095d049c5699c5b728678218) **chore:** drop node 8 support & upgrade mkdirp 98 | - [`84dcdd1`](https://github.com/groupon/shared-store/commit/84dcdd16e90829bf32c81fdd984e99487af92743) **refactor:** replace util.promisify with node promisify 99 | - [`15ab806`](https://github.com/groupon/shared-store/commit/15ab8061ee729d8790197408db0be37ed6b087c8) **chore:** ugprade debug 100 | - [`9ad2792`](https://github.com/groupon/shared-store/commit/9ad27927c46be953da6b4f6fb86c4e4430326bfc) **chore:** upgrade dev dependencies 101 | - [`dd4cdc8`](https://github.com/groupon/shared-store/commit/dd4cdc8d549b8a826a5b4f525086b226ccdcf22e) **chore:** add nyc 102 | - [`d0971dd`](https://github.com/groupon/shared-store/commit/d0971ddaf95552eed56a1969fb93654304073df9) **refactor:** replace lodash functions 103 | - [`a178aaf`](https://github.com/groupon/shared-store/commit/a178aaf2ec9db436e7d3e072a629e3b46a7a428b) **style:** clean code 104 | - [`948dc19`](https://github.com/groupon/shared-store/commit/948dc1933b6c7719c2b414c1d0524e6b4fb0bc02) **chore:** upgrade to rx 4.x 105 | - [`e168b42`](https://github.com/groupon/shared-store/commit/e168b42b3670422de90f545a62139b687ec684c3) **fix:** update travis.yml 106 | - [`49e4f31`](https://github.com/groupon/shared-store/commit/49e4f3194ed324d1af6bb7b9bbdb0eb2e7a4555b) **docs:** update readme 107 | 108 | 109 | ### 3.1.1 110 | 111 | * default `setActive()` to write cache files - **[@dbushong](https://github.com/dbushong)** [#40](https://github.com/groupon/shared-store/pull/40) 112 | - [`70fb4ea`](https://github.com/groupon/shared-store/commit/70fb4eae8937521abe99cacde9da701dfc5bc9e9) **fix:** default `setActive()` to write cache files 113 | 114 | 115 | ### 3.1.0 116 | 117 | * Allow skipping all tmp files - **[@jkrems](https://github.com/jkrems)** [#39](https://github.com/groupon/shared-store/pull/39) 118 | - [`ebf18c1`](https://github.com/groupon/shared-store/commit/ebf18c1d39172d5710f8edc84d6e2f9cdd2841c2) **feat:** Allow skipping all tmp files 119 | 120 | 121 | ### 3.0.0 122 | 123 | #### Breaking Changes 124 | 125 | None of the methods return Bluebird promises anymore. 126 | If a consumer of this library depends on it, they need to refactor 127 | to use native promise-based solutions. 128 | 129 | *See: [`5f22f8c`](https://github.com/groupon/shared-store/commit/5f22f8c80831e5531a4deb49d7835f7ca4f51500)* 130 | 131 | #### Commits 132 | 133 | * Remove bluebird dependency - **[@jkrems](https://github.com/jkrems)** [#38](https://github.com/groupon/shared-store/pull/38) 134 | - [`5f22f8c`](https://github.com/groupon/shared-store/commit/5f22f8c80831e5531a4deb49d7835f7ca4f51500) **refactor:** Remove bluebird dependency 135 | 136 | 137 | ### 2.2.2 138 | 139 | * Apply latest nlm generator - **[@markowsiak](https://github.com/markowsiak)** [#36](https://github.com/groupon/shared-store/pull/36) 140 | - [`535aa21`](https://github.com/groupon/shared-store/commit/535aa21152e4b283d783daca04a860e8fd56feb3) **chore:** Apply latest nlm generator 141 | - [`cf92a1e`](https://github.com/groupon/shared-store/commit/cf92a1e7b0ac80f409dc99aeb06e01a761e4e79a) **chore:** cleanup generator misses 142 | 143 | 144 | ### 2.2.1 145 | 146 | * fix: properly bundle all top-level js endpoints - **[@dbushong](https://github.com/dbushong)** [#35](https://github.com/groupon/shared-store/pull/35) 147 | - [`89ded1c`](https://github.com/groupon/shared-store/commit/89ded1c4b0344cd57cbc23091a301b407adb5cd4) **fix:** properly bundle all top-level js endpoints 148 | 149 | 150 | ### 2.2.0 151 | 152 | * feat: add fileAlternativesContent() handler - **[@dbushong](https://github.com/dbushong)** [#34](https://github.com/groupon/shared-store/pull/34) 153 | - [`0c8e56f`](https://github.com/groupon/shared-store/commit/0c8e56f16bcf30f908fe17ee9533564c8cbdbdd2) **feat:** add fileAlternativesContent() handler 154 | 155 | 156 | ### 2.1.4 157 | 158 | * Gracefully handle missing dir - **[@jkrems](https://github.com/jkrems)** [#33](https://github.com/groupon/shared-store/pull/33) 159 | - [`571d011`](https://github.com/groupon/shared-store/commit/571d011cbcd00d0065d4034ed023d7301cccc090) **fix:** Gracefully handle missing dir 160 | 161 | 162 | ### 2.1.3 163 | 164 | * Consume body of 304 response - **[@jkrems](https://github.com/jkrems)** [#32](https://github.com/groupon/shared-store/pull/32) 165 | - [`1453210`](https://github.com/groupon/shared-store/commit/145321022e7110d9509424d0b982fbb1d18c156e) **fix:** Consume body of 304 response 166 | 167 | 168 | ### 2.1.2 169 | 170 | * Safer interval handling - **[@jkrems](https://github.com/jkrems)** [#31](https://github.com/groupon/shared-store/pull/31) 171 | - [`bfb7276`](https://github.com/groupon/shared-store/commit/bfb72765ba460a2f1af73b93eb5715f222cdf0ba) **fix:** Safer interval handling 172 | - [`4bd2ffa`](https://github.com/groupon/shared-store/commit/4bd2ffaafa666916e7e6384ab41d7479affe46cd) **test:** Pass on node 6 173 | 174 | 175 | ### 2.1.1 176 | 177 | * stop emitting updates on HTTP 304s - **[@dbushong](https://github.com/dbushong)** [#30](https://github.com/groupon/shared-store/pull/30) 178 | - [`b5ea890`](https://github.com/groupon/shared-store/commit/b5ea890801b616759577eada2257e97786a6fdf8) **perf:** stop emitting updates on HTTP 304s 179 | - [`4d1a718`](https://github.com/groupon/shared-store/commit/4d1a7183d6fa96f1ff2c480cd37177a910e5d8b3) **chore:** update nlm & mocha; rebuild JS 180 | - [`9a8f23b`](https://github.com/groupon/shared-store/commit/9a8f23be74eb479cb5ad7faa7fe7a24481b542e3) **chore:** update coffeelint & make code pass 181 | 182 | 183 | ### 2.1.0 184 | 185 | * feat: allow switching active mode after instantiation - **[@dbushong](https://github.com/dbushong)** [#29](https://github.com/groupon/shared-store/pull/29) 186 | - [`115352a`](https://github.com/groupon/shared-store/commit/115352aec3ec3037587fbda622f47efa6ec97581) **feat:** allow switching active mode after instantiation 187 | 188 | 189 | ### 2.0.3 190 | 191 | * Apply latest nlm generator & upgrade to bluebird 3.x - **[@i-tier-bot](https://github.com/i-tier-bot)** [#28](https://github.com/groupon/shared-store/pull/28) 192 | - [`55b3a28`](https://github.com/groupon/shared-store/commit/55b3a2878c6a6aacef08c8f94b23c5b7dc978e04) **chore:** Apply latest nlm generator 193 | - [`cac9301`](https://github.com/groupon/shared-store/commit/cac9301c64169aefea505a957fba036f0dc54ce9) **fix:** Changes for bluebird 3 194 | 195 | 196 | ### 2.0.2 197 | 198 | * Update to nlm v2 - **[@jkrems](https://github.com/jkrems)** [#27](https://github.com/groupon/shared-store/pull/27) 199 | - [`9d61ca8`](https://github.com/groupon/shared-store/commit/9d61ca8a9720139bdfb8f8114f5ed597f5d3e05c) **chore:** Update to nlm v2 200 | 201 | 202 | ### 2.0.1 203 | 204 | * fix: survive invalid json tmpfile on init() - **[@dbushong](https://github.com/dbushong)** [#26](https://github.com/groupon/shared-store/pull/26) 205 | - [`7d5c9cc`](https://github.com/groupon/shared-store/commit/7d5c9ccae0b8f4d3ab3fed80ad29fdb90ff8c915) **fix:** survive invalid json tmpfile on init() 206 | 207 | 208 | ### 2.0.0 209 | 210 | #### Breaking Changes 211 | 212 | We are only testing against node v4 from now on. 213 | 214 | *See: [`e782cba`](https://github.com/groupon/shared-store/commit/e782cba29798d6bd5b1913d15e4b2b6b58ee53c4)* 215 | 216 | #### Commits 217 | 218 | * Switch from npub to nlm - **[@jkrems](https://github.com/jkrems)** [#25](https://github.com/groupon/shared-store/pull/25) 219 | - [`e782cba`](https://github.com/groupon/shared-store/commit/e782cba29798d6bd5b1913d15e4b2b6b58ee53c4) **chore:** Switch from npub to nlm 220 | 221 | 222 | 1.1.0 223 | ----- 224 | * More useful parse errors for files - @jkrems 225 | https://github.com/groupon/shared-store/pull/24 226 | 227 | 1.0.12 228 | ------ 229 | * fix to resolve store.init if cache = loaded data - @chkhoo #22 230 | 231 | 1.0.11 232 | ------ 233 | * emit correct @_options to meta - @chkhoo #20 234 | * fix when store.init errors, fetches from cache & getCurrent is null - @chkhoo #19 235 | 236 | 1.0.10 237 | ------ 238 | * fix ENOTFOUND error by intercepting init rejection - @chkhoo #18 239 | 240 | 1.0.9 241 | ----- 242 | * fix getaddrinfo ENOTFOUND by connecting only when subscribed - @chkhoo #17 243 | 244 | 1.0.8 245 | ----- 246 | * retry upon failure - @chkhoo #14 247 | 248 | 1.0.7 249 | ----- 250 | * fix fetching data from cache with init - @chkhoo #12 251 | 252 | 1.0.6 253 | ----- 254 | * fix multiple error events for single onError value - @chkhoo #11 255 | 256 | 1.0.5 257 | ----- 258 | * fix first error to store.init callback - @chkhoo #9 259 | * Put more focus on loader `options` in example - @jkrems #7 260 | * remove redundant npub tasks & Observable declarations - @chkhoo #6 261 | * fix err typo in README.md - @chkhoo #3 262 | 263 | 1.0.4 264 | ----- 265 | * Clean up license headers - @jkrems #2 266 | * Clear cache when app fails to start - @jkrems #1 267 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Contributing 4 | 5 | 🎉🏅 Thanks for helping us improve this project! 🙏 6 | 7 | This document outlines some of the practices we care about. 8 | If you have any questions or suggestions about the process, 9 | feel free to [open an issue](#reporting-issues) 10 | . 11 | 12 | ## How Can I Contribute? 13 | 14 | ### Reporting Issues 15 | 16 | If you find any mistakes in the docs or a bug in the code, 17 | please [open an issue in Github](https://github.com/groupon/shared-store/issues/new) so we can look into it. 18 | You can also [create a PR](#contributing-code) fixing it yourself, or course. 19 | 20 | If you report a bug, please follow these guidelines: 21 | 22 | * Make sure the bug exists in the latest version. 23 | * Include instructions on how to reproduce the issue. 24 | The instructions should be as minimal as possible 25 | and answer the three big questions: 26 | 1. What are the exact steps you took? This includes the exact versions of node, npm, and any packages involved. 27 | 1. What result are you expecting? 28 | 1. What is the actual result? 29 | 30 | ### Improving Documentation 31 | 32 | For small documentation changes, you can use [Github's editing feature](https://help.github.com/articles/editing-files-in-another-user-s-repository/). 33 | The only thing to keep in mind is to prefix the commit message with "docs: ". 34 | The default commit message generated by Github will lead to a failing CI build. 35 | 36 | For larger updates to the documentation 37 | it might be better to follow the [instructions for contributing code below](#contributing-code). 38 | 39 | ### Contributing Code 40 | 41 | **Note:** If you're planning on making substantial changes, 42 | please [open an issue first to discuss your idea](#reporting-issues). 43 | Otherwise you might end up investing a lot of work 44 | only to discover that it conflicts with plans the maintainers might have. 45 | 46 | The general steps for creating a pull request are: 47 | 48 | 1. Create a branch for your change. 49 | Always start your branch from the latest `main`. 50 | We often prefix the branch name with our initials, e.g. `jk-a-change`. 51 | 1. Run `npm install` to install the dependencies. 52 | 1. If you're fixing a bug, be sure to write a test *first*. 53 | That way you can validate that the test actually catches the bug and doesn't pass. 54 | 1. Make your changes to the code. 55 | Remember to update the tests if you add new features or change behavior. 56 | 1. Run the tests via `npm test`. This will also run style checks and other validations. 57 | You might see errors about uncommitted files. 58 | This is expected until you commit your changes. 59 | 1. Once you're done, `git add .` and `git commit`. 60 | Please follow the [commit message conventions](#commits--commit-messages) described below. 61 | 1. Push your branch to Github & create a PR. 62 | 63 | #### Code Style 64 | 65 | In addition to any linting rules the project might include, 66 | a few general rules of thumb: 67 | 68 | * Try to match the style of the rest of the code. 69 | * We prefer simple code that is easy to understand over terse, expressive code. 70 | * We try to structure projects by semantics instead of role. 71 | E.g. we'd rather have a `tree.js` module that contains tree traversal-related helpers 72 | than a `helpers.js` module. 73 | * Actually, if you create helpers you might want to put those into a separate package. 74 | That way it's easier to reuse them. 75 | 76 | #### Commits & Commit Messages 77 | 78 | Please follow the [angular commit message conventions](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#-git-commit-guidelines). 79 | We use an automated tool for generating releases 80 | that depends on the conventions to determine the next version and the content of the changelog. 81 | Commit messages that don't follow the conventions will cause `npm test` (and thus CI) to fail. 82 | 83 | The short summary - a commit message should look like this: 84 | 85 | ``` 86 | : 87 | 88 | 89 | 90 | 91 | 92 |