Skip to content

Commit

Permalink
Merge branch 'master' into defaultHiddenLines
Browse files Browse the repository at this point in the history
  • Loading branch information
clcatalan authored Jun 17, 2024
2 parents 12b10ce + da6d6b7 commit fa5b2f4
Show file tree
Hide file tree
Showing 220 changed files with 7,948 additions and 2,706 deletions.
2 changes: 1 addition & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"buildCommand": false,
"packages": ["packages/*"],
"sandboxes": ["/examples/codesandbox", "/website"],
"node": "16"
"node": "18"
}
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
/stats/
/storybook-static/
node_modules/
/packages/recompose/
1 change: 0 additions & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# These are supported funding model platforms

github: [wyze]
open_collective: nivo
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Build nivo packages
run: make pkgs-build
- name: Cypress run
uses: cypress-io/github-action@v5
uses: cypress-io/github-action@v6
with:
install: false
component: true
Expand Down
20 changes: 18 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ the various packages, please execute the following:
make init
```

> please note that it will take a while as this project uses a lot of dependencies…'
> please note that it will take a while as this project uses a lot of dependencies…
### Windows

If you want to build this project on Windows, it is recommended to use either WSL 2, or Git bash + `choco install make`.
If you want to build this project on Windows, it is recommended to use either WSL 2,
or Git bash + `choco install make`.

## Development

Expand Down Expand Up @@ -77,6 +78,13 @@ You can also build the packages without running a watcher, you have two options:

### Testing

#### Unit tests

Unit tests for each package are located in the `packages/<pkg>/tests` folder, we're using jest
as a test running and `react-test-renderer` as a testing library, some tests are still using
`enzyme`, but this lib is not maintained anymore and doesn't support newer versions of React,
so those should eventually be migrated.

To run unit tests on all packages, run the following command:

```
Expand All @@ -92,6 +100,14 @@ make pkg-test-bar

where `bar` is the name of the targeted nivo package.

#### End-to-end tests

Sometimes it's difficult to test certain things in unit tests, from our experience, animations
and interactions can be tricky to test via unit tests only, so we also try to have end-to-end tests.

We're using `cypress` for writing such tests, and those are located in the `cypress/src/components`
folder, as we introduced end-to-end tests later, not all packages have some.

### Formatting

Nivo uses prettier in order to provide a consistent code style.
Expand Down
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ fmt: ##@0 global format code using prettier (js, css, md)
"storybook/.storybook/*.{js,ts,tsx}" \
"storybook/stories/**/*.{js,ts,tsx}" \
"cypress/src/**/*.{js,ts,tsx}" \
"scripts/*.{js,mjs}" \
"cypress/src/**/*.{js,tsx}" \
"README.md"

fmt-check: ##@0 global check if files were all formatted using prettier
Expand All @@ -74,6 +76,8 @@ fmt-check: ##@0 global check if files were all formatted using prettier
"storybook/.storybook/*.{js,ts,tsx}" \
"storybook/stories/**/*.{js,ts,tsx}" \
"cypress/src/**/*.{js,ts,tsx}" \
"scripts/*.{js,mjs}" \
"cypress/src/**/*.{js,tsx}" \
"README.md"

test: ##@0 global run all checks/tests (packages, website)
Expand Down Expand Up @@ -203,11 +207,22 @@ pkgs-publish-next: ##@1 packages publish all packages for @next npm tag
@echo "${YELLOW}Publishing packages${RESET}"
@pnpm lerna publish --exact --npm-tag=next

pkg-dev-%: ##@1 packages build package (es flavor) on change, eg. `package-watch-bar`
pkg-dev-%: ##@1 packages build package (es flavor) on change, eg. `pkg-dev-bar`
@echo "${YELLOW}Running build watcher for package ${WHITE}@nivo/${*}${RESET}"
@rm -rf ./packages/${*}/cjs
@export PACKAGE=${*}; NODE_ENV=development BABEL_ENV=development ./node_modules/.bin/rollup -c conf/rollup.config.mjs -w

pkg-icons-%: ##@1 capture packages icons for the website, eg. `pkg-icons-bar`
./scripts/capture.mjs icons --pkg ${*}
@$(MAKE) website-sprites

pkg-previews-%: ##@1 capture packages previews for readmes, eg. `pkg-previews-bar`
./scripts/capture.mjs charts --pkg ${*}

pkg-capture-%: ##@1 capture packages previews and icons, eg. `pkg-capture-bar`
./scripts/capture.mjs all --pkg ${*}
@$(MAKE) website-sprites

########################################################################################################################
#
# 2. WEBSITE
Expand Down
6 changes: 3 additions & 3 deletions api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nivo/api",
"version": "0.85.1",
"version": "0.87.0",
"private": true,
"description": "Rendering API for nivo dataviz React/d3 components",
"main": "src/app.js",
Expand All @@ -16,7 +16,7 @@
},
"engineStrict": true,
"engines": {
"node": ">=16"
"node": ">=18"
},
"devDependencies": {
"nodemon": "^2.0.22"
Expand All @@ -39,7 +39,7 @@
"winston": "3.3.3"
},
"scripts": {
"start": "yarn build && node app.js",
"start": "npm run build && node app.js",
"dev": "nodemon app.ts",
"build": "tsc"
},
Expand Down
15 changes: 10 additions & 5 deletions conf/base.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
baseUrl: http://localhost:9000
baseUrl: http://localhost:8000
capture:
pages:
- id: home
Expand Down Expand Up @@ -57,6 +57,10 @@ capture:
chart: bar
flavors: [svg, canvas]

- pkg: bullet
chart: bullet
flavors: [ svg ]

- pkg: calendar
chart: calendar
flavors: [svg]
Expand All @@ -71,10 +75,6 @@ capture:
# html is broken for now
# flavors: [svg, html, canvas]

- pkg: bullet
chart: bullet
flavors: [svg]

- pkg: heatmap
chart: heatmap
flavors: [svg, canvas]
Expand Down Expand Up @@ -121,6 +121,11 @@ capture:
chart: sunburst
flavors: [svg]

- pkg: tree
chart: tree
theme: dark
flavors: [svg]

- pkg: treemap
chart: treemap
flavors: [svg, html, canvas]
Expand Down
10 changes: 6 additions & 4 deletions cypress/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { defineConfig } from 'cypress'
import { defineConfig } from "cypress";

export default defineConfig({
viewportWidth: 600,
viewportHeight: 600,
component: {
devServer: {
framework: 'create-react-app',
bundler: 'webpack',
framework: "create-react-app",
bundler: "webpack",
},
video: false,
},
})
});
9 changes: 5 additions & 4 deletions cypress/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nivo-e2e",
"version": "0.85.1",
"version": "0.87.0",
"private": true,
"description": "nivo end-to-end tests",
"dependencies": {
Expand Down Expand Up @@ -33,6 +33,7 @@
"@nivo/stream": "workspace:*",
"@nivo/sunburst": "workspace:*",
"@nivo/swarmplot": "workspace:*",
"@nivo/tree": "workspace:*",
"@nivo/treemap": "workspace:*",
"@nivo/voronoi": "workspace:*",
"@nivo/waffle": "workspace:*"
Expand All @@ -45,9 +46,9 @@
"node": ">=18"
},
"devDependencies": {
"cypress": "^12.11.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"cypress": "^13.8.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-scripts": "^5.0.1",
"typescript": "^4.9.5"
},
Expand Down
Loading

0 comments on commit fa5b2f4

Please sign in to comment.