This commit is contained in:
Yoshua Wuyts
2016-05-11 01:09:53 +07:00
commit c28d37ac84
7 changed files with 157 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
node_modules/
coverage/
tmp/
npm-debug.log*
.DS_Store
+7
View File
@@ -0,0 +1,7 @@
node_js:
- "0.12"
- "4"
sudo: false
language: node_js
script: "npm run test:cov"
after_script: "npm i -g codecov.io && cat ./coverage/lcov.info | codecov"
+21
View File
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Yoshua Wuyts
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:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
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.
+81
View File
@@ -0,0 +1,81 @@
# choo [![stability][0]][1]
[![npm version][2]][3] [![build status][4]][5] [![test coverage][6]][7]
[![downloads][8]][9] [![js-standard-style][10]][11]
A framework for creating sturdy web applications. Built on years of industry
experience and distills the essence of functional architectures into a
productive package.
## Features
- __minimal size:__ weighing under `15kb`, `choo` is a tiny little framework
- __single state:__ immutable single state helps reason about changes
- __minimal tooling:__ built for the cutting edge `browserify` compiler
- __transparent side effects:__ using "effects" and "subscriptions" brings
clarity to IO
- __omakase:__ composed out of a balanced selection of open source packages
- __idempotent:__ renders seemlessly in both Node and browsers
- __very cute:__ choo choo!
## Usage
```js
const choo = require('choo')
const app = choo()
app.model('title', {
state: { title: 'my-demo-app' },
reducers: {
'update': (action, state) => ({ title: action.payload })
},
effects: {
'update': (action, state) => document.title = action.title
}
})
const mainView = choo.view((state, send) => `
<main class="app">
<h1>${state.title}</h1>
<label>Set the title</label>
<input
type="text"
placeholder=${state.title}
oninput=${(e) => send('title:update', { payload: e.target.value })}>
</main>
`)
app.router((route) => [
route('/', mainView)
])
const node = app.start()
document.appendChild(node)
```
## Concepts
- __state:__
- __reducers:__
- __effects:__
- __subscriptions:__
## API
### choo
## Installation
```sh
$ npm install choo
```
## License
[MIT](https://tldrlegal.com/license/mit-license)
[0]: https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square
[1]: https://nodejs.org/api/documentation.html#documentation_stability_index
[2]: https://img.shields.io/npm/v/choo.svg?style=flat-square
[3]: https://npmjs.org/package/choo
[4]: https://img.shields.io/travis/yoshuawuyts/choo/master.svg?style=flat-square
[5]: https://travis-ci.org/yoshuawuyts/choo
[6]: https://img.shields.io/codecov/c/github/yoshuawuyts/choo/master.svg?style=flat-square
[7]: https://codecov.io/github/yoshuawuyts/choo
[8]: http://img.shields.io/npm/dm/choo.svg?style=flat-square
[9]: https://npmjs.org/package/choo
[10]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[11]: https://github.com/feross/standard
+8
View File
@@ -0,0 +1,8 @@
const assert = require('assert')
module.exports = choo
// A framework for creating solid web applications
// null -> null
function choo () {
}
+28
View File
@@ -0,0 +1,28 @@
{
"name": "choo",
"version": "1.0.0",
"description": "A framework for creating solid web applications",
"main": "index.js",
"scripts": {
"deps": "dependency-check . && dependency-check . --extra --no-dev",
"test": "standard && npm run deps && NODE_ENV=test node test",
"test:cov": "standard && npm run deps && NODE_ENV=test istanbul cover test.js"
},
"repository": "yoshuawuyts/choo",
"keywords": [
"client",
"frontend",
"framework",
"minimal",
"composable",
"tiny"
],
"license": "MIT",
"dependencies": {},
"devDependencies": {
"dependency-check": "^2.5.1",
"istanbul": "^0.4.3",
"standard": "^6.0.8",
"tape": "^4.5.1"
}
}
+7
View File
@@ -0,0 +1,7 @@
const test = require('tape')
const choo = require('./')
test('should assert input types', function (t) {
t.plan(1)
t.throws(choo)
})