Skip to content

Commit 4c87c86

Browse files
committed
feat(core): Rewrite in TypeScript
1 parent 4ad64dd commit 4c87c86

24 files changed

+675
-1777
lines changed

.babelrc

-3
This file was deleted.

.editorconfig

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
root = true
22

33
[*]
4-
indent_style = space
5-
indent_size = 2
6-
trim_trailing_whitespace = true
74
end_of_line = lf
85
insert_final_newline = true
6+
indent_style = space
7+
indent_size = 2

.eslintignore

-1
This file was deleted.

.eslintrc

-11
This file was deleted.

.github/ISSUE_TEMPLATE.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!--
2+
Do you need help or have a question? Please ensure your question is thorough.
3+
Found a bug? Please fill out the sections below 👍.
4+
Show some empathy to the person reading your issue. They are volunteers.
5+
-->
6+
7+
**Code to reproduce the issue:**
8+
9+
10+
**Expected behavior:**
11+
12+
13+
**Actual behavior:**
14+
15+
16+
**Versions of packages used:**

.github/PULL_REQUEST_TEMPLATE.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!--
2+
Thank you for your contribution!
3+
To help speed up the process of merging your code, check the following:
4+
-->
5+
6+
- [ ] I added new tests for the issue I fixed or the feature I built
7+
- [ ] I ran `npm test` for the package I'm modifying
8+
- [ ] I used `npm run commit` instead of `git commit`
9+
10+
<!--
11+
Please Continue to describe your fix / change citing an issue if possible.
12+
13+
If there are BREAKING CHANGES, please use one of the following to
14+
communicate the changes that have occured.
15+
16+
17+
This change absolutely will affect users:
18+
![yes](https://img.shields.io/badge/will%20it%20affect%20me%3F-yes-red.svg)
19+
20+
High probability of affecting users:
21+
![probably will](https://img.shields.io/badge/will%20it%20affect%20me%3F-probably%20will-orange.svg)
22+
23+
Will affect more users than not:
24+
![maybe will](https://img.shields.io/badge/will%20it%20affect%20me%3F-maybe%20will-yellow.svg)
25+
26+
Will *not* affect more users than not:
27+
![maybe won't](https://img.shields.io/badge/will%20it%20affect%20me%3F-maybe%20won't-yellowgreen.svg)
28+
29+
Will only affect a few people
30+
![probably won't](https://img.shields.io/badge/will%20it%20affect%20me%3F-probably%20won't-green.svg)
31+
32+
Though breaking, it will almost definitely *not* affect users:
33+
![no](https://img.shields.io/badge/will%20it%20affect%20me%3F-no-brightgreen.svg)
34+
-->

.gitignore

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.idea/
2-
*.sublime*
3-
41
node_modules
5-
npm-debug.log
6-
7-
lib/
2+
lib
3+
*.log

.testem.json

-18
This file was deleted.

.travis.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
language: node_js
22
node_js:
3-
- "4.1"
4-
before_script:
5-
- "export DISPLAY=:99.0"
6-
- "sh -e /etc/init.d/xvfb start"
7-
- sleep 3 # give xvfb some time to start
3+
- 7
4+
- 6

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"typescript.tsdk": "./node_modules/typescript/lib"
3+
}

CONTRIBUTING.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
# Contributing to MotorcycleJS
1+
# Contributing
22

3-
We'd highly appreciate your contribution to our source code
4-
and making MotorcycleJS even better.
5-
[Please read our contributing guidelines](https://github.com/motorcyclejs/motorcycle/blob/master/CONTRIBUTING.md).
3+
First of all, thank you so much, we need your help.
4+
5+
## Contributing a fix or feature
6+
7+
1. Fork the repository
8+
2. Switch to a new branch `git checkout -b [branchName]`
9+
3. Produce your fix or feature
10+
4. Use `npm run commit` instead of `git commit` PLEASE!
11+
5. Submit a pull request for review

LICENSE.md

+5-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
1+
12
The MIT License (MIT)
23

3-
Copyright (c) 2015 Tylor Steinberger
4+
Copyright (c) 2016 Tylor Steinberger
45

5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
6+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
117

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
8+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
149

15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
10+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+8-50
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,16 @@
11
# Motorcycle.js
22

3-
An official subproject of [Cycle.js](http://cycle.js.org) built
4-
on top [most.js](https://github.com/cujojs/most) instead of RxJS
5-
for its Observable/Stream implementation, and using
6-
[Snabbdom](https://github.com/paldepind/snabbdom) to interact
7-
with the DOM.
8-
93
[![Join the chat at https://gitter.im/cyclejs/core](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/cyclejs/core?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/motorcyclejs/core.svg?branch=develop)](https://travis-ci.org/motorcyclejs/core)
104

5+
This is the core of Motorcycle.js creating your applicaton loop tied together with `most.js`.
6+
It separates your application logic into a pure (as much as JavaScript can be) function, and your
7+
side-effectful code into drivers.
8+
119
## Install
1210
```
13-
$ npm install @motorcycle/core // you can but don't ;)
14-
$ npm install @cycle/most-run
11+
$ npm install @motorcycle/core
1512
```
1613

17-
## Merging with Cycle.js
18-
We are in the process of merging this project with [Cycle.js](https://github.com/cyclejs). But Why?
19-
20-
21-
We get to merge two wonderful communities together and focus on solving problems rather than duplicating efforts.
22-
Stream conversions are also now done in a mostly automatic way!
23-
Want to use a driver written in xstream or Rx 5? No problem if the driver is written for Cycle.js Diversity. It will be entirely seamless for you :)
24-
25-
#### Libraries that will continue to be maintained for most.js *only*
26-
27-
##### **DOM Driver**
28-
@motorcycle/dom will continue to be the speed king that it currently is. It is at 100% feature parity with the latest Cycle.js Diversity version of @cycle/dom as of v2.0.0. However, it will **not** do any stream conversion like @cycle/dom to maximize performance to its greatest potential. @motorcycle/html has be rolled into this library for ease of maintanence going forward as well. Now imported as
29-
30-
```js
31-
import {makeHTMLDriver} from '@motorcycle/dom'
32-
```
33-
34-
##### **HTTP Driver**
35-
@motorcycle/http will soon be at feature parity with the newest version of @cycle/http and will be maintained to avoid the need to import xstream as a dependency.
36-
37-
##### **What about everything else that used to be here?**
38-
- @motorcycle/core - Please use [@cycle/most-run](https://github.com/cyclejs/most-run)
39-
- @motorcycle/history - Please use [@cycle/history](https://github.com/cyclejs/history), it is 100% stream library agnostic and will not add any unneeded dependencies.
40-
- @motorcycle/router - Please use [cyclic-router](https://github.com/cyclejs-community/cyclic-router), it is also 100% stream agnostic and will not andd any unneeded dependencies.
41-
- @motorcycle/local-storage - This was a poorly done library to begin with, and I don't wish for anyone to reach for it. There is the very great [@cycle/storage](https://github.com/cyclejs/storage) driver, which with v3 can do stream conversions when used with @cycle/most-run. However it is written in xstream, and will require the xstream library to also be imported. local-storage as driver is very easily implemented per individual needs, please stop by the [Cycle.js gitter](https://gitter.im/cyclejs/core) or open an issue to discuss [here](https://github.com/cyclejs-community/cyclejs-community/issues/new).
42-
43-
4414
## Want to Contribute?
4515

4616
If you found an issue or want to contribute code, please read
@@ -52,25 +22,20 @@ duplication of effort and further the possibility of your work being accepted.
5222
Afterwards, please refer to our [repository guidelines](REPOSITORIES.md).
5323

5424
## Useful Utilities
55-
- [most-subject](https://github.com/TylorS/most-subject) - A subject
25+
- [most-subject](https://github.com/mostjs-community/most-subject) - A subject
5626
implementation for most.js
57-
- [most-proxy](https://github.com/Tylors/most-proxy) - Declarative circular dependencies for most.js
27+
- [most-proxy](https://github.com/mostjs-community/most-proxy) - Declarative circular dependencies for most.js
5828

5929
## API
6030

6131
### run(main, drivers)
6232

6333
###### Importing
6434
```js
65-
// Why are you still using @motorcycle/core
66-
import Motorcycle from '@motorcycle/core'
35+
import * as Motorcycle from '@motorcycle/core'
6736

6837
Motorcycle.run(main, drivers)
6938

70-
// What you should be doing
71-
import Cycle from '@cycle/most-run'
72-
73-
Cycle.run(main, drivers)
7439
```
7540

7641
Takes a `main` function and circularly connects it to the given
@@ -90,10 +55,6 @@ and outputs a collection of sinks Observables/Streams.
9055
**drivers** :: Object - an object where keys are driver names
9156
and values are driver functions.
9257

93-
**{onError}** :: Object - an object which currently only accepts an `onError()`
94-
function. The optional `onError()` function allows for defining a custom Function
95-
to be called when an error occurs in a stream from your application.
96-
9758
###### Return:
9859

9960
(Object) an object containing *sources*, *sinks*, and *dispose()* that
@@ -105,8 +66,5 @@ can be used for debugging or testing.
10566

10667
*dispose :: Function* - A function that will dispose of streams from sinks and sources.
10768

108-
109-
11069
[motorcycle-dom]: https://github.com/motorcyclejs/motorcycle-dom
111-
[snabbdom]: https://github.com/paldepind/snabbdom
11270
[contributing]: https://github.com/motorcyclejs/motorcycle/blob/master/CONTRIBUTING.md

0 commit comments

Comments
 (0)