From c28d37ac84813bd6c17f7f2c44bc045f91fde83c Mon Sep 17 00:00:00 2001 From: Yoshua Wuyts Date: Tue, 10 May 2016 23:23:33 +0700 Subject: [PATCH] . --- .gitignore | 5 ++++ .travis.yml | 7 +++++ LICENSE | 21 ++++++++++++++ README.md | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++ index.js | 8 ++++++ package.json | 28 ++++++++++++++++++ test.js | 7 +++++ 7 files changed, 157 insertions(+) create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 LICENSE create mode 100644 README.md create mode 100644 index.js create mode 100644 package.json create mode 100644 test.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5c49d4c --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +node_modules/ +coverage/ +tmp/ +npm-debug.log* +.DS_Store diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..e533238 --- /dev/null +++ b/.travis.yml @@ -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" diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c03ab53 --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..6f55177 --- /dev/null +++ b/README.md @@ -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) => ` +
+

${state.title}

+ + send('title:update', { payload: e.target.value })}> +
+`) + +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 diff --git a/index.js b/index.js new file mode 100644 index 0000000..e68f610 --- /dev/null +++ b/index.js @@ -0,0 +1,8 @@ +const assert = require('assert') + +module.exports = choo + +// A framework for creating solid web applications +// null -> null +function choo () { +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..54f83d5 --- /dev/null +++ b/package.json @@ -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" + } +} diff --git a/test.js b/test.js new file mode 100644 index 0000000..0fe45ac --- /dev/null +++ b/test.js @@ -0,0 +1,7 @@ +const test = require('tape') +const choo = require('./') + +test('should assert input types', function (t) { + t.plan(1) + t.throws(choo) +})