Development

Explains the guidelines to follow when developing components for Lottie Player.

Clone the project locally. You can do this using a GUI GIT client such as Gitkraken, or the command line. If you are copying the example here, make sure to clone the git project.

git clone git@github.com:LottieFiles/<--project-name-here-->.git

You need Node.js version 12 or 14 to build the libraries. To install Node.js, download the "LTS" installer from nodejs.org. If you are using nodenv, read the nodenv docs for instructions on switching Node.js versions. Node is also available via many of the package managers, such as apt and choco.

Once you have installed Node.js (which includes the popular npm package manager), open the Terminal and run the following to install Yarn:

npm install --global yarn

After installing Yarn, run the following commands to install the dependencies, and test and build the project.

yarn install
yarn test
yarn build

Guidelines

  • Use defensive programming techniques: Ensure type and range of input values, cast values to native representation whenever possible, etc.

  • Refrain from using external dependencies: Discuss before adding a dependency. Check with Bundlephobia for package size and dependencies when choosing one.

  • Use code formatting in the IDE using the given eslint+prettier configs.

  • Write tests to cover all functions and code branches with valid and invalid values.

  • All projects should build under Windows, macOS and Ubuntu. We typically use compatibility shims such as SHX to assist with this.

Last updated