Skip to content

Commit

Permalink
feat(infrastucture): upgrade rollup, babel, typescript and prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
plouc committed Jun 21, 2020
1 parent 1517720 commit b08e791
Show file tree
Hide file tree
Showing 43 changed files with 2,530 additions and 1,205 deletions.
8 changes: 2 additions & 6 deletions api/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,14 @@ app.get('/r/:id', (req, res) => {

const rendered = render.chart(config, req.query)

res.set('Content-Type', 'image/svg+xml')
.status(200)
.send(rendered)
res.set('Content-Type', 'image/svg+xml').status(200).send(rendered)
})

_.forOwn(samples, (config, id) => {
app.get(`/samples/${id}.svg`, (req, res) => {
const rendered = render.chart(config, req.query)

res.set('Content-Type', 'image/svg+xml')
.status(200)
.send(rendered)
res.set('Content-Type', 'image/svg+xml').status(200).send(rendered)
})
})

Expand Down
18 changes: 4 additions & 14 deletions api/src/mapping/bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,16 @@ module.exports = {
component: Bar,
schema: Joi.object().keys(
Object.assign({}, dimensions, common.axes, {
data: Joi.array()
.min(1)
.required(),
data: Joi.array().min(1).required(),
indexBy: Joi.string().required(),
keys: Joi.array()
.sparse(false)
.min(1)
.unique()
.required(),
keys: Joi.array().sparse(false).min(1).unique().required(),

groupMode: Joi.any().valid(['grouped', 'stacked']),
layout: Joi.any().valid(['horizontal', 'vertical']),
reverse: Joi.boolean(),

minValue: Joi.alternatives()
.try(Joi.any().valid('auto'), Joi.number())
.required(),
maxValue: Joi.alternatives()
.try(Joi.any().valid('auto'), Joi.number())
.required(),
minValue: Joi.alternatives().try(Joi.any().valid('auto'), Joi.number()).required(),
maxValue: Joi.alternatives().try(Joi.any().valid('auto'), Joi.number()).required(),
padding: Joi.number(),
innerPadding: Joi.number(),

Expand Down
4 changes: 1 addition & 3 deletions api/src/mapping/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ module.exports = {
Object.assign({}, dimensions, {
from: Joi.string().required(),
to: Joi.string().required(),
data: Joi.array()
.min(1)
.required(),
data: Joi.array().min(1).required(),
colors: Joi.string(),
direction: Joi.any().valid(['horizontal', 'vertical']),
yearSpacing: Joi.number(),
Expand Down
16 changes: 4 additions & 12 deletions api/src/mapping/chord.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,14 @@ module.exports = {
keys: Joi.array().required(),

padAngle: Joi.number(),
innerRadiusRatio: Joi.number()
.min(0)
.max(1),
innerRadiusOffset: Joi.number()
.min(0)
.max(1),
innerRadiusRatio: Joi.number().min(0).max(1),
innerRadiusOffset: Joi.number().min(0).max(1),

ribbonOpacity: Joi.number()
.min(0)
.max(1),
ribbonOpacity: Joi.number().min(0).max(1),
ribbonBorderWidth: Joi.number().min(0),
ribbonBorderColor: inheritedColor,

arcOpacity: Joi.number()
.min(0)
.max(1),
arcOpacity: Joi.number().min(0).max(1),
arcBorderWidth: Joi.number().min(0),
arcBorderColor: inheritedColor,

Expand Down
8 changes: 2 additions & 6 deletions api/src/mapping/commons/dimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@
const Joi = require('joi')

exports.dimensions = {
width: Joi.number()
.integer()
.required(),
height: Joi.number()
.integer()
.required(),
width: Joi.number().integer().required(),
height: Joi.number().integer().required(),
margin: Joi.object().keys({
top: Joi.number().integer(),
right: Joi.number().integer(),
Expand Down
26 changes: 6 additions & 20 deletions api/src/mapping/heatmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,19 @@ module.exports = {
component: HeatMap,
schema: Joi.object().keys(
Object.assign({}, dimensions, common.axes, {
data: Joi.array()
.min(1)
.required(),
data: Joi.array().min(1).required(),
indexBy: Joi.string().required(),
keys: Joi.array()
.sparse(false)
.min(1)
.unique()
.required(),
keys: Joi.array().sparse(false).min(1).unique().required(),

minValue: Joi.alternatives()
.try(Joi.any().valid('auto'), Joi.number())
.required(),
maxValue: Joi.alternatives()
.try(Joi.any().valid('auto'), Joi.number())
.required(),
minValue: Joi.alternatives().try(Joi.any().valid('auto'), Joi.number()).required(),
maxValue: Joi.alternatives().try(Joi.any().valid('auto'), Joi.number()).required(),

forceSquare: Joi.boolean(),
sizeVariation: Joi.number()
.min(0)
.max(1),
sizeVariation: Joi.number().min(0).max(1),
padding: Joi.number(),

cellShape: Joi.any().valid(['rect', 'circle']),
cellOpacity: Joi.number()
.min(0)
.max(1),
cellOpacity: Joi.number().min(0).max(1),
cellBorderWidth: Joi.number().min(0),
cellBorderColor: inheritedColor,

Expand Down
8 changes: 2 additions & 6 deletions api/src/mapping/line.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,8 @@ module.exports = {

markers: Joi.array().items(
Joi.object().keys({
axis: Joi.any()
.valid(['x', 'y'])
.required(),
value: Joi.alternatives()
.try(Joi.string(), Joi.number())
.required(),
axis: Joi.any().valid(['x', 'y']).required(),
value: Joi.alternatives().try(Joi.string(), Joi.number()).required(),
style: Joi.object(),
})
),
Expand Down
4 changes: 1 addition & 3 deletions api/src/mapping/pie.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ module.exports = {
component: Pie,
schema: Joi.object().keys(
Object.assign({}, dimensions, {
data: Joi.array()
.min(1)
.required(),
data: Joi.array().min(1).required(),

innerRadius: Joi.number().min(0),
padAngle: Joi.number().min(0),
Expand Down
18 changes: 4 additions & 14 deletions api/src/mapping/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@ module.exports = {
component: Radar,
schema: Joi.object().keys(
Object.assign({}, dimensions, {
data: Joi.array()
.min(1)
.required(),
keys: Joi.array()
.sparse(false)
.min(1)
.unique()
.required(),
data: Joi.array().min(1).required(),
keys: Joi.array().sparse(false).min(1).unique().required(),
indexBy: Joi.string().required(),
maxValue: Joi.alternatives().try(Joi.valid('auto'), Joi.number()),

Expand All @@ -33,9 +27,7 @@ module.exports = {
borderWidth: Joi.number().min(0),
borderColor: inheritedColor,

gridLevels: Joi.number()
.integer()
.positive(),
gridLevels: Joi.number().integer().positive(),
gridShape: Joi.any().valid(['linear', 'circular']),
gridLabelOffset: Joi.number(),

Expand All @@ -54,9 +46,7 @@ module.exports = {

colors: ordinalColors,
colorBy: Joi.string(),
fillOpacity: Joi.number()
.min(0)
.max(1),
fillOpacity: Joi.number().min(0).max(1),
})
),
runtimeProps: ['width', 'height', 'colors'],
Expand Down
12 changes: 3 additions & 9 deletions api/src/mapping/sankey.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ module.exports = {
.keys({
source: Joi.alternatives().try(Joi.string(), Joi.number()),
target: Joi.alternatives().try(Joi.string(), Joi.number()),
value: Joi.number()
.min(0)
.required(),
value: Joi.number().min(0).required(),
})
.unknown()
)
Expand All @@ -49,18 +47,14 @@ module.exports = {
align: Joi.any().valid(sankeyAlignmentPropKeys),
sort: Joi.valid('auto', 'input', 'ascending', 'descending'),

nodeOpacity: Joi.number()
.min(0)
.max(1),
nodeOpacity: Joi.number().min(0).max(1),
nodeWidth: Joi.number().min(1),
nodePaddingX: Joi.number().positive(),
nodePaddingY: Joi.number().positive(),
nodeBorderWidth: Joi.number().min(0),
nodeBorderColor: inheritedColor,

linkOpacity: Joi.number()
.min(0)
.max(1),
linkOpacity: Joi.number().min(0).max(1),
linkContract: Joi.number(),
linkBlendMode: common.blendMode,
enableLinkGradient: Joi.boolean(),
Expand Down
6 changes: 3 additions & 3 deletions conf/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { camelCase, upperFirst } from 'lodash'
import babel from 'rollup-plugin-babel'
import resolve from 'rollup-plugin-node-resolve'
import babel from '@rollup/plugin-babel'
import resolve from '@rollup/plugin-node-resolve'
import stripBanner from 'rollup-plugin-strip-banner'
import cleanup from 'rollup-plugin-cleanup'

Expand Down Expand Up @@ -45,7 +45,7 @@ const commonPlugins = [
}),
babel({
exclude: 'node_modules/**',
externalHelpers: true,
babelHelpers: 'bundled',
presets: [
'@nivo/babel-preset'
]
Expand Down
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
},
"keywords": [],
"devDependencies": {
"@babel/core": "^7.7.5",
"@babel/core": "^7.10.3",
"@ekino/config": "^0.3.0",
"@nivo/babel-preset": "0.60.0",
"@nivo/generators": "0.60.0",
"@nivo/generators": "0.62.0",
"@storybook/addon-actions": "^5.2.8",
"@storybook/addon-info": "^5.2.8",
"@storybook/addon-knobs": "^5.2.8",
Expand All @@ -32,37 +32,37 @@
"@storybook/theming": "^5.2.8",
"@types/lodash": "^4.14.149",
"@types/react": "^16.9.16",
"babel-eslint": "^10.0.3",
"babel-eslint": "^10.1.0",
"babel-jest": "^24.9.0",
"babel-loader": "^8.0.6",
"babel-loader": "^8.1.0",
"chalk": "^2.4.2",
"clog-cli": "^1.0.0",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.15.1",
"eslint": "^5.13.3",
"eslint-plugin-react": "^7.17.0",
"eslint": "^7.3.0",
"eslint-plugin-react": "^7.20.0",
"gh-pages": "^1.0.0",
"jest": "^24.9.0",
"jsdom": "^12.0.0",
"lerna": "^3.19.0",
"jest": "^26.0.1",
"jsdom": "^16.2.2",
"lerna": "^3.22.1",
"lodash": "^4.17.15",
"prettier": "^1.19.1",
"prettier": "^2.0.5",
"prop-types": "^15.7.2",
"puppeteer": "^0.13.0",
"raf": "^3.4.0",
"raf": "^3.4.1",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-test-renderer": "^16.8.6",
"rollup": "^1.27.12",
"rollup-plugin-babel": "^4.3.3",
"rollup": "^2.17.1",
"@rollup/plugin-babel": "^5.0.3",
"rollup-plugin-cleanup": "^3.1.1",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-prettier": "^0.6.0",
"rollup-plugin-strip-banner": "^1.0.0",
"rollup-plugin-typescript2": "^0.25.3",
"@rollup/plugin-node-resolve": "^8.0.1",
"rollup-plugin-prettier": "^2.1.0",
"rollup-plugin-strip-banner": "^2.0.0",
"rollup-plugin-typescript2": "^0.27.1",
"serve": "^11.2.0",
"tslint": "^5.20.1",
"typescript": "^3.7.3"
"tslint": "^6.1.2",
"typescript": "^3.9.5"
},
"resolutions": {
"upath": "1.1.0",
Expand Down
12 changes: 3 additions & 9 deletions packages/axes/tests/compute.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,9 @@ describe('getTicks', () => {

describe('computeCartesianTicks()', () => {
const ordinalScale = scaleOrdinal([0, 10, 20, 30]).domain(['A', 'B', 'C', 'D'])
const pointScale = scalePoint()
.domain(['E', 'F', 'G', 'H'])
.range([0, 300])
const bandScale = scaleBand()
.domain(['I', 'J', 'K', 'L'])
.rangeRound([0, 400])
const linearScale = scaleLinear()
.domain([0, 500])
.range([0, 100])
const pointScale = scalePoint().domain(['E', 'F', 'G', 'H']).range([0, 300])
const bandScale = scaleBand().domain(['I', 'J', 'K', 'L']).rangeRound([0, 400])
const linearScale = scaleLinear().domain([0, 500]).range([0, 100])

describe('from linear scale', () => {
it('should compute ticks for x axis', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/bar/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ declare module '@nivo/bar' {
tooltipFormat: string | ValueFormatter
tooltip: TooltipProp

legends: Array<{ dataFrom: 'indexes' | 'keys' } & LegendProps>
legends: ({ dataFrom: 'indexes' | 'keys' } & LegendProps)[]

markers: CartesianMarkerProps[]
}>
Expand Down
5 changes: 1 addition & 4 deletions packages/bar/src/compute/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,4 @@ import { scaleBand } from 'd3-scale'
* @returns {Function}
*/
export const getIndexedScale = (data, getIndex, range, padding) =>
scaleBand()
.rangeRound(range)
.domain(data.map(getIndex))
.padding(padding)
scaleBand().rangeRound(range).domain(data.map(getIndex)).padding(padding)
4 changes: 1 addition & 3 deletions packages/bar/src/compute/grouped.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ export const getGroupedScale = (data, keys, _minValue, _maxValue, range) => {
if (minValue > 0) minValue = 0
}

return scaleLinear()
.rangeRound(range)
.domain([minValue, maxValue])
return scaleLinear().rangeRound(range).domain([minValue, maxValue])
}

/**
Expand Down
Loading

0 comments on commit b08e791

Please sign in to comment.