Developing Polythene
December 23, 2018 ยท View on GitHub
Setting up the development repo
Install Lerna:
npm install -g lerna
Get the Polythene repo and prepare:
git clone https://github.com/ArthurClemens/polythene.git
cd polythene
npm
This will install all dependencies and run lerna bootstrap.
Commands:
lerna run build- builds all components (in each dist directory)lerna run build:component button- builds the button component; the same goes for the other componentslerna run build:tests- builds the testslerna run clean- removes all dist directories
Packages are built with Rollup, both as es module and as umd. Rollup creates cleaner files compared to Webpack. If you like to experiment, build scripts are in the root scripts directory.
Testing
Test files for each component are located in packages/test-COMPONENT. These include Jest snapshots to verify the output.
If you haven't done so, start by installing all dependencies in the root:
npm install- this will install all dependencies and runlerna bootstrap
Editing tests
- Modify and build files:
npm run build- builds files indist
- Update snapshots:
npm run testnpm run test:watch
Viewing tests
Test files can be viewed by the "test renderers":
- With Mithril:
cd packages/tests-render-mithril - With React:
cd packages/tests-render-react
Run in the browser:
-
npm run dev- uses Webpack's dev server -
With Mithril: http://localhost:3000
-
With React: http://localhost:3100