Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feature/migrate-victo…
Browse files Browse the repository at this point in the history
…ry-group-to-ts
  • Loading branch information
scottrippey committed Aug 11, 2022
2 parents 52e61da + 06f5c73 commit ae4c089
Show file tree
Hide file tree
Showing 57 changed files with 938 additions and 485 deletions.
12 changes: 12 additions & 0 deletions .changeset/shiny-emus-film.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"victory-core": patch
"victory-axis": patch
"victory-errorbar": patch
"victory-scatter": patch
"victory-cursor-container": patch
---

- Removed Template Literal Types to increase TS compatibility (fixes #2418)
- Improved type for `VictoryLabelProps["textAnchor"]` (fixes #2361)
- Fixed exported types for `VictoryAxis`, `VictoryBoxPlot`, `VictoryErrorBar`, and `VictoryScatter` (fixes #2411)
- Migrate `victory-cursor-container` to TS (fixes #2402)
22 changes: 20 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,24 @@ To develop against `victory-native`, please see the package [README](./packages/

### Tips and tricks

#### Scripts can be run from the _root_ AND from inside any _package_ folder

For example, when working on a single package like `victory-core`, you can run `pnpm run check --watch` from the `packages/victory-core` directory, and it will only check the core. Example:

```sh
$ cd packages/victory-core
$ pnpm run check --watch
```

This is especially helpful when you're making changes to any package that is _depended upon_, like `victory-core` or `victory-vendor`, and don't want to run every single script during development.


#### My IDE shows outdated TypeScript errors

It seems like VS Code and WebStorm both struggle to update their internal cache, whenever the **built types** change. For example, when making changes to `victory-core`, the TypeScript changes won't be picked up by your IDE automatically.

Instead of restarting your IDE completely, try restarting the TypeScript Service.

#### My computer grinds to a halt!

The initial build/check, or one where something that is part of a lot of cache keys changes, can really slow down your computer, especially if you've got an older model. To allow you to do other work on your computer at the same time, consider using the `WIREIT_PARALLEL=<NUM_PROCESS>` environment variable like:
Expand Down Expand Up @@ -219,7 +237,7 @@ Here are more details:
When you would like to add a changeset (which creates a file indicating the type of change), in your branch/PR issue this command:

```sh
$ pnpm changeset
$ pnpm run changeset
```

to produce an interactive menu. Navigate the packages with arrow keys and hit `<space>` to select 1+ packages. Hit `<return>` when done. Select semver versions for packages and add appropriate messages. From there, you'll be prompted to enter a summary of the change. Some tips for this summary:
Expand Down Expand Up @@ -252,7 +270,7 @@ On the merge of a version packages PR, the changesets GitHub action will publish

For exceptional circumstances, here is a quick guide to manually publishing from a local computer using changesets.

1. Add a changeset with `pnpm changeset`. Add changeset file, review file, tweak, and commit.
1. Add a changeset with `pnpm run changeset`. Add changeset file, review file, tweak, and commit.
2. Make a version. Due to our changelog plugin you will need to create a personal GitHub token and pass it to the environment.

```sh
Expand Down
8 changes: 2 additions & 6 deletions demo/js/components/immutable-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ import React from "react";
import PropTypes from "prop-types";
import { assign, merge, keys, random, range, round } from "lodash";
import { fromJS } from "immutable";
import {
VictoryClipContainer,
VictoryLabel,
VictoryTheme,
} from "victory-core";
import { VictoryClipContainer, VictoryLabel, VictoryTheme } from "victory-core";

import { VictoryChart } from "victory-chart";
import { VictoryStack } from "victory-stack";
Expand Down Expand Up @@ -792,7 +788,7 @@ class App extends React.Component {
padding={{ top: 100, bottom: 40, left: 50, right: 50 }}
containerComponent={
<VictoryCursorContainer
cursorLabel={(datum) =>
cursorLabel={({ datum }) =>
`${round(datum.x, 2)} , ${round(datum.y, 2)}`
}
/>
Expand Down
2 changes: 1 addition & 1 deletion demo/ts/components/immutable-demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ export default class ImmutableDemo extends React.Component<
padding={{ top: 100, bottom: 40, left: 50, right: 50 }}
containerComponent={
<VictoryCursorContainer
cursorLabel={(datum) =>
cursorLabel={({ datum }) =>
`${round(datum.x, 2)} , ${round(datum.y, 2)}`
}
/>
Expand Down
12 changes: 6 additions & 6 deletions demo/ts/components/victory-cursor-container-demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ class App extends React.Component<any, VictoryCursorContainerStateInterface> {
parent: { border: "1px solid #ccc", margin: "2%", maxWidth: "40%" },
};

const cursorLabel = (datum: CoordinatesPropType) => round(datum.x, 2);

return (
<div className="demo">
<div style={containerStyle}>
Expand All @@ -80,7 +78,9 @@ class App extends React.Component<any, VictoryCursorContainerStateInterface> {
height={400}
padding={{ top: 100, bottom: 40, left: 50, right: 50 }}
containerComponent={
<VictoryCursorContainer cursorLabel={cursorLabel} />
<VictoryCursorContainer
cursorLabel={({ datum }) => round(datum.x, 2)}
/>
}
>
<VictoryLegend
Expand All @@ -107,7 +107,7 @@ class App extends React.Component<any, VictoryCursorContainerStateInterface> {
domainPadding={{ x: 15 }}
containerComponent={
<VictoryCursorContainer
cursorLabel={cursorLabel}
cursorLabel={({ datum }) => round(datum.x, 2)}
cursorDimension="y"
defaultCursorValue={3}
/>
Expand Down Expand Up @@ -159,7 +159,7 @@ class App extends React.Component<any, VictoryCursorContainerStateInterface> {
}}
containerComponent={
<VictoryCursorContainer
cursorLabel={(datum: CoordinatesPropType) => round(datum.x, 2)}
cursorLabel={({ datum }) => round(datum.x, 2)}
cursorDimension="x"
defaultCursorValue={1}
/>
Expand Down Expand Up @@ -197,7 +197,7 @@ class App extends React.Component<any, VictoryCursorContainerStateInterface> {
<VictoryCursorContainer
defaultCursorValue={2}
cursorDimension="x"
cursorLabel={(datum: CoordinatesPropType) => round(datum.x, 2)}
cursorLabel={({ datum }) => round(datum.x, 2)}
cursorLabelOffset={15}
/>
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
"scripts": {
"version": "pnpm changeset version && pnpm install --no-frozen-lockfile",
"publish": "nps git:tag && pnpm changeset publish --no-git-tag",
"changeset": "changeset",
"start": "concurrently --raw \"pnpm:build:lib:esm --watch\" \"webpack serve --config ./config/webpack/demo/webpack.config.dev.js --static demo/js --entry ./demo/js/app\"",
"start:ts": "concurrently --raw \"pnpm:build:typescript --watch\" \"webpack serve --config ./config/webpack/demo/webpack.config.dev.js --static demo/ts --entry ./demo/ts/app\"",
"check": "wireit",
Expand Down
35 changes: 22 additions & 13 deletions packages/victory-area/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"build:dist": "wireit",
"build:dist:dev": "wireit",
"build:dist:min": "wireit",
"check": "wireit",
"types:check": "wireit",
"types:create": "wireit",
"format": "wireit",
Expand Down Expand Up @@ -150,6 +151,14 @@
"pnpm-lock.yaml"
]
},
"check": {
"dependencies": [
"types:check",
"jest",
"format",
"lint"
]
},
"types:check": {
"command": "nps types:pkg:check",
"files": [
Expand Down Expand Up @@ -204,6 +213,19 @@
"pnpm-lock.yaml"
]
},
"format:fix": {
"command": "pnpm run format || nps format:pkg:fix",
"files": [
"src/**",
"*.json",
"../../.prettierignore",
"../../.prettierrc.json"
],
"output": [],
"packageLocks": [
"pnpm-lock.yaml"
]
},
"lint": {
"command": "nps lint:pkg",
"files": [
Expand All @@ -223,19 +245,6 @@
"pnpm-lock.yaml"
]
},
"format:fix": {
"command": "pnpm run format || nps format:pkg:fix",
"files": [
"src/**",
"*.json",
"../../.prettierignore",
"../../.prettierrc.json"
],
"output": [],
"packageLocks": [
"pnpm-lock.yaml"
]
},
"lint:fix": {
"command": "pnpm run lint || nps lint:pkg:fix",
"files": [
Expand Down
35 changes: 22 additions & 13 deletions packages/victory-axis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"build:dist": "wireit",
"build:dist:dev": "wireit",
"build:dist:min": "wireit",
"check": "wireit",
"types:check": "wireit",
"types:create": "wireit",
"format": "wireit",
Expand Down Expand Up @@ -145,6 +146,14 @@
"pnpm-lock.yaml"
]
},
"check": {
"dependencies": [
"types:check",
"jest",
"format",
"lint"
]
},
"types:check": {
"command": "nps types:pkg:check",
"files": [
Expand Down Expand Up @@ -198,6 +207,19 @@
"pnpm-lock.yaml"
]
},
"format:fix": {
"command": "pnpm run format || nps format:pkg:fix",
"files": [
"src/**",
"*.json",
"../../.prettierignore",
"../../.prettierrc.json"
],
"output": [],
"packageLocks": [
"pnpm-lock.yaml"
]
},
"lint": {
"command": "nps lint:pkg",
"files": [
Expand All @@ -216,19 +238,6 @@
"pnpm-lock.yaml"
]
},
"format:fix": {
"command": "pnpm run format || nps format:pkg:fix",
"files": [
"src/**",
"*.json",
"../../.prettierignore",
"../../.prettierrc.json"
],
"output": [],
"packageLocks": [
"pnpm-lock.yaml"
]
},
"lint:fix": {
"command": "pnpm run lint || nps lint:pkg:fix",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/victory-axis/src/victory-axis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ class VictoryAxisBase extends React.Component<VictoryAxisProps> {
return !!this.props.animate;
}

render() {
render(): React.ReactElement {
const { animationWhitelist } = VictoryAxis;
const props = Axis.modifyProps(this.props, fallbackProps);
const userProps = UserProps.getSafeUserProps(this.props);
Expand Down
35 changes: 22 additions & 13 deletions packages/victory-bar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"build:dist": "wireit",
"build:dist:dev": "wireit",
"build:dist:min": "wireit",
"check": "wireit",
"types:check": "wireit",
"types:create": "wireit",
"format": "wireit",
Expand Down Expand Up @@ -150,6 +151,14 @@
"pnpm-lock.yaml"
]
},
"check": {
"dependencies": [
"types:check",
"jest",
"format",
"lint"
]
},
"types:check": {
"command": "nps types:pkg:check",
"files": [
Expand Down Expand Up @@ -204,6 +213,19 @@
"pnpm-lock.yaml"
]
},
"format:fix": {
"command": "pnpm run format || nps format:pkg:fix",
"files": [
"src/**",
"*.json",
"../../.prettierignore",
"../../.prettierrc.json"
],
"output": [],
"packageLocks": [
"pnpm-lock.yaml"
]
},
"lint": {
"command": "nps lint:pkg",
"files": [
Expand All @@ -223,19 +245,6 @@
"pnpm-lock.yaml"
]
},
"format:fix": {
"command": "pnpm run format || nps format:pkg:fix",
"files": [
"src/**",
"*.json",
"../../.prettierignore",
"../../.prettierrc.json"
],
"output": [],
"packageLocks": [
"pnpm-lock.yaml"
]
},
"lint:fix": {
"command": "pnpm run lint || nps lint:pkg:fix",
"files": [
Expand Down
Loading

0 comments on commit ae4c089

Please sign in to comment.