-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace ajv with zod; simplified plugin API (#1441)
* Create zod schema for 1.0.16 * Move to separate package * Revert main package.json changes * Use builder functions * wip: previous versions * Upgrade functions * Initial tests * VitS as controlled component * Upgrade in <Vitessce/> * WIP: plugins registered via props (instead of window) * Update schemas * Joint file type schemas and via new plugin mechanism * Refactor plugin classes * Cleanup * Update * More cleanup * Cleanup register functions * Remove plugins file, use default coordination values from plugin objects * Comment * Use superRefine to check for deprecated coordination types * Revert * Fix tests * Extra imports * Try env.d.ts * Update * Update plugin examples * Linting for obsSets view * Comment * Allow ts in vite bundling config * Fix e2e tests * Update * Fix import * Allow empty props * Update * Remove ajv * Update * Update deps * Lint * Fix tests * Implement plugin classes with typescript * Add config uid property * use .length * Fix docs * Update plugin docs * Add config schema versioning docs * Add useCallback calls to obsSetsManager * Remove unnecessary fromEntries * Implement getSourceAndLoader function * Remove extra import * Eslint comment * Demo * Update dev-config-versioning.md * Update docusaurus.config.js * Lint * Make json schemas * Tsconfig * Lockfile * Update deploy script and readme * Simplify pnpm command * Update pnpm lock * Respond to PR feedback * Fix type issues, update docs * Refactor base plugins * Update * Pnpm install * Types in package.json * Fix tsconfig project references * Pnpm lock * Add dev-docs * Working types and linting * pnpm lock * Update * Fix test * Lint * Pnpm lock * React import * React import * More react imports * Update package.json exports in sub-packages, add new test for dynamic importmap * Add comment * Comment * Dev-docs * Add comment * Use dynamic-importmap * Try compressed-size-action * Update * Node options * env * Clean cmd * Revert unrelated github action change * Fix typo * Revert changed ObsSetsManager * Use .js extensions for imports to so that source is ESM (#1519) * Use .js * Comments * Revert webpack plugin * Update cypress e2e tests * Add/move dev-docs * Update design-guidelines.md * Fix meta-updater * Revert config * Update design-guidelines.md * Update README.md * Update design-guidelines.md * Update design-guidelines.md * Update design-guidelines.md * Update rollup.config.js * Revert unrelated change * WIP: clean up lodash, mui, uuid imports * More import fixes * De-duplicate imports * Dev-docs about js imports * Use publint * isEqual * Fix tests * Dev-docs * Dev-docs linked from main README * Demo * Feedback * Use same terminology in docs as code * Troubleshooting note * Upgrade guide
- Loading branch information
1 parent
5d69698
commit 33c30b5
Showing
417 changed files
with
8,766 additions
and
4,279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Developer documentation | ||
|
||
The developer documentation here is meant for usage by the internal development team, external contributors, and plugin developers. | ||
|
||
## For plugin developers | ||
|
||
- [View type implementation](./plugin-view-types.md) | ||
- [File type implementation](./plugin-file-types.md) | ||
|
||
## For internal developers | ||
|
||
We not only want to document implementation details, but also higher-level architectural details and development processes. | ||
However, documentation that would be relevant to a wider audience than noted above should instead be included in the main documentation website that is hosted at http://vitessce.io. | ||
|
||
### Architecture | ||
|
||
The diagram below highlights how Vitessce is composed of a top-level `<Vitessce/>` React component which encapsulates several individual visualization or control views such as `<Scatterplot/>` and `<Spatial/>`. | ||
|
||
<a href="https://docs.google.com/drawings/d/1vS6wP1vs5QepLhXGDRww7LR505HJ-aIqnGn9O19f6xg/edit" target="_blank"> | ||
<img | ||
src="https://docs.google.com/drawings/d/e/2PACX-1vSoB3YGPxOTKnFOpYHeHX4JruHnibGXruM36uAZtuvPQNM3a7F4uS3q4b5jwGNQ6TJ7bQ9IPB32rdle/pub?w=650" | ||
alt="Architecture diagram" | ||
className="ar-16x9" | ||
/> | ||
</a> | ||
|
||
### Table of contents | ||
|
||
- [Design guidelines](./design-guidelines.md) | ||
- [Monorepo and bundling](./monorepo-and-bundling.md) | ||
- [Config schema versioning](./config-schema-versioning.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Config schema versioning | ||
|
||
## Motivation | ||
|
||
In Vitessce, we make the following commitment related to backwards compatibility: JSON configurations defined against a particular config schema version must be compatible with the version of the JavaScript package in which that schema version was defined __and all future package versions__. | ||
|
||
|
||
In addition, we need to allow the config schema to continue to evolve as development continues in the form of new and improved file types, coordination types, and view types. Sometimes, we will even need to modify the behavior of particular views, file types, or coordination types (e.g., to fix bugs). | ||
|
||
For example, the developers of the HuBMAP Portal have written many Vitessce configs, which must remain valid despite updating the Vitessce JS package version to pull in new features or bug fixes. | ||
|
||
__Versioning of the config schema enables us (as developers in the present) to infer the behavior of Vitessce that was assumed by the author of a particular config (as users in the past).__ | ||
|
||
## When | ||
|
||
A new config schema version should be added when: | ||
- behavior of a coordination type changes significantly | ||
- the value schema for a coordination type changes | ||
- coordination type(s) are added, removed, or renamed | ||
- view type(s) are added, removed, or renamed | ||
|
||
## How | ||
|
||
Config schemas are defined using [Zod](https://zod.dev/) in the `@vitessce/schemas` sub-package of the Vitessce monorepo. | ||
|
||
See the [README](../packages/schemas/README.md) for detailed instructions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<!-- Inspired by https://github.com/visgl/deck.gl/blob/a58191a83c7d06526d9a7419db76d8442e83849c/dev-docs/deckgl-api-guidelines.md --> | ||
|
||
# Vitessce Design Guidelines | ||
|
||
An evolving set of guidelines to ensure that features remain maintainable, scalable, and consistent. | ||
|
||
## Design Guidelines | ||
|
||
### User experience decisions | ||
- When making decisions that affect user experience, prefer [consistency](http://vis.pku.edu.cn/research/publication/consistency.pdf). | ||
|
||
### Tests | ||
|
||
- Prefer unit tests over end-to-end tests - Keep React components relatively "dumb" and put complex logic into utility functions that can be easily unit-tested. | ||
- Test in [portal-ui](https://github.com/hubmapconsortium/portal-ui) with diverse data modalities prior to major releases | ||
|
||
### Data types | ||
|
||
- Prefer minimal data types - If you can imagine reasonably storing data in multiple files (e.g., using formats like CSV or JSON), then consider splitting into multiple simpler data types. [Joint file types](http://vitessce.io/docs/data-types-file-types/#joint-file-types) can be used in cases where data is stored in the same file. | ||
|
||
### Scripting for development | ||
|
||
- Prefer NodeJS scripts over complex Shell scripts. | ||
|
||
### Monorepo organization | ||
|
||
- Avoid [circular dependencies](https://github.com/vitessce/vitessce/issues/1490) - If you find the need to import functions across view type- or file type- sub-packages, consider moving to a utility sub-package (i.e., `packages/utils/`). | ||
- Avoid complex dependencies in utility sub-packages - Where possible keep dependencies in utility sub-packages small and simple (e.g., `lodash`). If a large/complex dependency is needed for a utility function, consider refactoring that function into a new utility sub-package. | ||
|
||
### TypeScript | ||
|
||
- Implement new sub-packages using TypeScript to avoid creating tech debt. | ||
|
||
### Parsing and validation of user input | ||
- Prefer [Zod](https://zod.dev/) schema over JSON schema - This improves the TypeScript development experience and follows the ["parse, don't validate"](https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate/) mantra. | ||
|
||
### Coordination type schemas | ||
- Prefer primitive values like numbers and strings over objects and arrays - Coordination values must be used entirely. Therefore, usage of objects and arrays prevent linking views on a subset of the object/array values. | ||
|
||
|
||
## Code style guide | ||
|
||
> A good style guide defines not only superficial elements like naming conventions or whitespace rules but also how to use the features of the given programming language. JavaScript and Perl, for example, are packed with functionality — they offer many ways to implement the same logic. A style guide defines The One True Way of doing things so that you don’t end up with half your team using one set of language features while the other half uses a totally different set of features. -- [How to Do Code Reviews Like a Human](https://mtlynch.io/human-code-reviews-1/). | ||
This section contains an evolving set of code style guidelines that are not currently automated via linting. | ||
|
||
- Use MUI style utilities to define styles ([makeStyles](https://v4.mui.com/styles/api/#makestyles-styles-options-hook), at least until we migrate to MUI v5). | ||
- Use `false`, `null`, and `undefined` as false-y values unless the corresponding truth-y value is a number (to align with [JSX boolean handling](https://legacy.reactjs.org/docs/jsx-in-depth.html#booleans-null-and-undefined-are-ignored)). | ||
- Use `lodash/isEqual` for set path equality checks and comparisons. | ||
- Prefer more specific naming for utility functions (despite length/verbosity) to help readability. | ||
- Prefer event handlers to side effects (from React docs: [You Might Not Need an Effect](https://react.dev/learn/you-might-not-need-an-effect)) | ||
- Related: exercise caution when removing effect dependencies (from React docs: [Removing Effect Dependencies](https://react.dev/learn/removing-effect-dependencies)) | ||
- Web workers should be [inlined](../packages/workers/rollup.config.js) so that they do not depend on relative paths that consumer applications and libraries would need to configure. | ||
- Use `.js` extensions for relative imports, [even in TypeScript contexts](https://github.com/microsoft/TypeScript/issues/42151#issuecomment-914472944). | ||
- Do not use `.js` extensions for third-party packages, unless either: | ||
- The function or variable that needs to be accessed is not exported from the main entrypoint of the package. | ||
- The package is published as CommonJS or UMD rather than ESM (or the ESM build is broken as with [json2csv](https://github.com/zemirco/json2csv/issues/539) and [react-virtualized](https://github.com/bvaughn/react-virtualized/issues/1632)). | ||
|
||
|
File renamed without changes.
Oops, something went wrong.