1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-22 16:17:17 +01:00
slate/docs/general/contributing.md

141 lines
5.7 KiB
Markdown
Raw Normal View History

2016-07-12 22:23:27 -07:00
# Contributing
Want to contribute to Slate? That would be awesome!
2021-04-01 18:13:48 -07:00
- [Contributing](contributing.md#contributing)
- [Reporting Bugs](contributing.md#reporting-bugs)
- [Asking Questions](contributing.md#asking-questions)
- [Submitting Pull Requests](contributing.md#submitting-pull-requests)
- [Repository Setup](contributing.md#repository-setup)
- [Running Examples](contributing.md#running-examples)
- [Running Tests](contributing.md#running-tests)
- [Testing Input Methods](contributing.md#testing-input-methods)
- [Publishing Releases](contributing.md#publishing-releases)
- [Publishing Normal `@latest` Release](contributing.md#publishing-normal-latest-release)
- [Publishing `@next` Release](contributing.md#publishing-next-release)
- [Publishing `@experimental` Release](contributing.md#publishing-experimental-release)
- [Running Prerelease Script](contributing.md#running-prerelease-script)
2016-07-28 13:09:29 -07:00
## Reporting Bugs
If you run into any weird behavior while using Slate, feel free to open a new issue in this repository! Please run a **search before opening** a new issue, to make sure that someone else hasn't already reported or solved the bug you've found.
2017-08-15 10:36:10 -07:00
Any issue you open must include:
2019-12-29 05:52:32 +01:00
- A [JSFiddle](https://jsfiddle.net/01pLxfzu/) that reproduces the bug with a minimal setup.
2021-04-01 18:13:48 -07:00
- A GIF showing the issue in action. \(Using something like [RecordIt](http://recordit.co/).\)
Next (#3093) * remove some key usage from core, refactor Operations.apply * undeprecate some methods * convert more key usage to paths * update deprecations * convert selection commands to use all paths * refactor word boundary selection logic * convert many at-range commands to use paths * convert wrapBlock and wrapInline to not use keys * cleanup * remove chainability from editor * simplify commands, queries and middleware * convert deleteAtRange * remove key usage from schema, deprecate *ByKey methods * migrate *ByKey tests, remove index from *ByPath signatures * rename at-current-range tests * deprecate mode key usage, migrate more tests away from keys * deprecate range and point methods which rely on keys to work * refactor insertBlock, without fixing warnings * add pathRef/pointRef, fix insertBlock/Inline deprecations, work on insertFragment * refactor insertFragment * get rich-text example rendering * fix lint * refactor query files, fix more tests * remove unused queries, refactor others * deprecate splitDescendantsByPath * merge master * add typescript, convert slate, slate-hyperscript, slate-plain-serializer * add Point, Path, Range, Annotation tests * add Annotation, Change, Element, Fragment, Mark, Range, Selection, Value interfaces tests * add Operation and Text tests * add Node tests * get operations and normalization tests working for slate * get *AtPath command tests passing * rename *AtPath command tests * rename * get *AtPoint tests working * rename * rename * add value queries tests * add element, mark and path queries tests * convert most on-selection tests * convert on-selection commands * rename * get addMarks and delete commands working * rename * rename * rename * refactor value.positions(), work on delete tests * progress on delete tests * more delete work * finish delete tests * start converting to at-based commands * restructure query tests * restructure operations tests * more work converting to multi-purpose commands * lots of progress on converting to at-based commands * add unwrapNodes * remove setValue * more progress * refactor node commands to use consistent matching logic * cleanup, get non-fragment commands passing * remove annotations and isAtomic * rename surround/pluck to cover/uncover * add location concept, change at-path to from-path for iterables * refactor batches * add location-based queries * refactor hanging logic * more location query work * renaming * use getMatch more * add split to wrap/unwrap * flip levels/ancestors ordering * switch splitNodes to use levels * change split to always:false by default * fix tests * add more queries tests * fixing more delete logic * add more splitNodes tests * get rest of delete tests passing * fix location-based logic in some commands * cleanup * get previous packages tests passing again * add slate-history package * start slate-schema work * start of react working * rendering fixes * get rich and plain text examples working * get image example working with hooks and dropping * refactor onDrop to be internal * inline more event handlers * refactor lots of event-related logic * change rendering to use render props * delete unused stuff * cleanup dom utils * remove unused deps * remove unnecessary packages, add placeholder * remove slate-react-placeholder package * remove unused dep * remove unnecessary tests, fix readonly example * convert checklists example * switch to next from webpack * get link example working * convert more examples * preserve keys, memoized leafs/texts, fix node lookup * fix to always useLayoutEffect for ordering * fix annotations to be maps, memoize elements * remove Change interface * remove String interface * rename Node.entries to Node.nodes * remove unnecessary value queries * default to selection when iterating, cleanup * remove unused files * update scroll into view logic * fix undoing, remove constructor types * dont sync selection while composing * add workflows * remove unused deps * convert mentions example * tweaks * convert remaining examples * rename h to jsx, update schema * fix schema tests * fix slate-schema logic and tests * really fix slate-schema and forced-layout example * get start of insertFragment tests working * remove Fragment interface * remove debugger * get all non-skipped tests passing * cleanup deps * run prettier * configure eslint for typescript * more eslint fixes... * more passing * update some docs * fix examples * port windows undo hotkey change * fix deps, add basic firefox support * add event overriding, update walkthroughs * add commands, remove classes, cleanup examples * cleanup rollup config * update tests * rename queries tests * update other tests * update walkthroughs * cleanup interface exports * cleanup, change mark transforms to require location * undo mark transform change * more * fix tests * fix example * update walkthroughs * update docs * update docs * remove annotations * remove value, move selection and children to editor * add migrating doc * fix lint * fix tests * fix DOM types aliasing * add next export * update deps, fix prod build * fix prod build * update scripts * update docs and changelogs * update workflow and pull request template
2019-11-27 20:54:42 -05:00
- A clear explanation of what the issue is.
2016-07-28 13:09:29 -07:00
2019-12-29 05:52:32 +01:00
Here's a [JSFiddle template for Slate](https://jsfiddle.net/01pLxfzu/) to get you started:
2016-07-28 13:09:29 -07:00
[![](../.gitbook/assets/jsfiddle.png)](https://jsfiddle.net/01pLxfzu/)
2016-07-28 13:09:29 -07:00
## Asking Questions
2016-07-28 13:13:44 -07:00
We've also got a [Slate Slack team](https://slate-slack.herokuapp.com) where you can ask questions and get answers from other people using Slate:
2016-07-28 13:09:29 -07:00
[![](../.gitbook/assets/slack.png)](https://slate-slack.herokuapp.com)
2016-07-28 13:13:44 -07:00
Please use the Slack instead of asking questions in issues, since we want to reserve issues for keeping track of bugs and features. We close questions in issues so that maintaining the project isn't overwhelming.
2016-07-28 13:13:44 -07:00
## Submitting Pull Requests
2016-07-28 13:09:29 -07:00
All pull requests are super welcomed and greatly appreciated! Issues in need of a solution are marked with a [`♥ help`](https://github.com/ianstormtaylor/slate/issues?q=is%3Aissue+is%3Aopen+label%3A%22%E2%99%A5+help%22) label if you're looking for somewhere to start.
2016-07-28 13:09:29 -07:00
Please include tests and docs with every pull request!
## Repository Setup
The slate repository is a monorepo that is managed with [lerna](https://github.com/lerna/lerna). Unlike more traditional repositories, this means that the repository must be built in order for tests, linting, or other common development activities to function as expected.
To run the build, you need to have the Slate repository cloned to your computer. After that, you need to `cd` into the directory where you cloned it, and install the dependencies with `yarn` and build the monorepo:
```text
yarn install
2018-04-27 15:39:33 -07:00
yarn build
```
## Running Examples
To run the examples, start by building the monorepo as described in the [Repository Setup](contributing.md#repository-setup) section.
2019-11-27 20:57:55 -05:00
Then you can start the examples server with:
2016-07-12 22:26:57 -07:00
```text
2019-11-27 20:57:55 -05:00
yarn start
2016-07-12 22:26:57 -07:00
```
2016-07-12 22:23:27 -07:00
2019-11-27 20:57:55 -05:00
## Running Tests
To run the tests, start by building the monorepo as described in the [Repository Setup](contributing.md#repository-setup) section.
Then you can rerun the tests with:
2016-07-12 22:23:27 -07:00
```text
2019-11-27 20:57:55 -05:00
yarn test
2016-07-12 22:23:27 -07:00
```
2019-12-03 00:07:11 -05:00
If you need to debug something, you can add a `debugger` line to the source, and then run `yarn test:inspect`.
If you only want to run a specific test or tests, you can run `yarn test --fgrep="slate-react rendering"` flag which will filter the tests being run by grepping for the string in each test. \(This is a Mocha flag that gets passed through.\)
2021-04-01 01:20:51 -04:00
In addition to tests you should also run the linter:
```text
2021-04-01 01:20:51 -04:00
yarn lint
```
This will catch TypeScript, Prettier, and Eslint errors.
## Running integration tests
To run integrations with [cypress](https://github.com/cypress-io/cypress), first run `yarn start` to run the examples website, then run `yarn cypress:open` in a separate session to open the cypress GUI.
## Testing Input Methods
[Here's a helpful page](https://github.com/Microsoft/vscode/wiki/IME-Test) detailing how to test various input scenarios on Windows, Mac and Linux.
2017-09-11 19:30:04 -07:00
## Publishing Releases
**Important**: When creating releases using Lerna with the instructions below, you will be given choices around how to increase version numbers. You should always use a `major`, `minor` or `patch` release and must never use a `prerelease`. If a prerelease is used, the root package will not link to the packages in the `packages` directory creating hard to diagnose issues.
### Publishing Normal `@latest` Release
Since we use [Lerna](https://lerna.js.org) to manage the Slate packages this is fairly easy, just run:
2017-09-11 19:30:04 -07:00
```text
yarn release:latest
2017-09-11 19:30:04 -07:00
```
And follow the prompts Lerna gives you.
Note that this will automatically run the prelease script first that will build, test and lint before attempting to publish.
### Publishing `@next` Release
If we are unsure as to the stability of a release because there are significant changes and/or particularly complex changes, release with the `@next` tag.
```text
yarn release:next
```
And follow the prompts Lerna gives you.
### Publishing `@experimental` Release
If you need to create an experimental release to see how a published package will behave during an actual publish, release with the `@experimental` tag. End users should have no expectation that an `@experimental` release will be usable.
```text
yarn release:experimental
```
### Running Prerelease Script
If we want to make sure that Slate code follows the preparations for a release but without actually publishing, run:
```text
yarn prerelease
```
Which will build, test and lint Slate code.