Readme · Migration · Advanced · Typescript · Contributing
We appreciate any community contributions to this project, whether in the form of issues or pull requests.
This document outlines what we'd like you to follow in terms of commit messages and code style.
It also explains what to do in case you want to set up the project locally and run tests.
Working on your first Pull Request? You can learn how from this extensive list of resources for people who are new to contributing to Open Source.
This project is written in ES2015 and transpiled to ES5 using Babel, to the dist directory. This should generally only happen at publishing time, or for testing purposes only.
Run npm install to install all necessary dependencies. When running npm install locally, dist is not compiled.
All necessary dependencies are installed under node_modules and any necessary tools can be accessed via npm scripts. There is no need to install anything globally.
When importing local, in development code, via index.js, this file checks if dist exists and uses that. Otherwise, it uses the code from lib.
If you have a dist directory, run npm run clean.
npm run cleanremoves any built filesnpm run build:devbuilds vendored files, node package and browser versionnpm run build:prodbuilds production-ready minified sourcesnpm run buildcombinesclean,build:devandbuild:prodnpm run build:typesemits type declaration files for js files
This project has unit and integration tests, as well as tests checking types. All of these run on both Node.js and browser environments.
Both of these test environments are setup to deal with Babel and code transpiling, so there's no need to worry about that.
npm run test:unitruns Node.js unit testsnpm run test:integrationruns the integration tests against the Contentful CDA APInpm run test:typesruns type checking testsnpm testruns linting on the test code and runs all three kinds of teststest:demo-noderuns a Node.js demo application and its tests, making sure that Node.js builds are functioning and are bundled correctlytest:demo-browserruns a browser client demo application and its tests, making sure that browser builds are functioning and are bundled correctlytest:demo-projectsruns both Node.js and browser application tests
Code is documented using TypeDoc, and reference documentation is published automatically with each new version.
npm run docs:watchwatches code directory, and rebuilds documentation when anything changes. Useful for documentation writing and developmentnpm run docs:buildbuilds documentationnpm run docs:publishbuilds documentation and publishes it to github pages
This project uses ESLint configuration from standard. Install a relevant editor plugin if you'd like.
Everywhere where it isn't applicable, follow a style similar to the existing code.
This project uses the Angular JS Commit Message Conventions, via semantic-release. See the semantic-release commit message format section for more details.
This project strictly follows Semantic Versioning by use of semantic-release.
This means that new versions are released automatically as fixes, features or breaking changes are released.
You can check the changelog on the releases page.