Skip to content

Commit

Permalink
start indexeddb adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
gr0uch authored and 0x8890 committed Jun 23, 2015
1 parent ae8ae17 commit 40b773b
Show file tree
Hide file tree
Showing 16 changed files with 53 additions and 21 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
@@ -1,4 +1,10 @@
sudo: false

before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"

language: node_js

node_js:
- "0.12"
4 changes: 4 additions & 0 deletions doc/CHANGELOG.md
@@ -1,6 +1,10 @@
# Changelog


##### 1.0.0-alpha.13 (2015-06-27)
- Implemented IndexedDB adapter for browser build.


##### 1.0.0-alpha.12 (2015-06-19)
- Change how `inflectType` option works for JSON API serializer. Now it inflects types everywhere, not just the URI.
- Rename `inflectType` to `inflectPath` in the Micro API serializer to reflect this difference.
Expand Down
3 changes: 2 additions & 1 deletion doc/TODO.md
Expand Up @@ -2,9 +2,9 @@

*This file is marked for deletion after 1.0.*

- Consider writing default adapter with Loki.js (?)
- Website layout redux (?)
- Consider using ES7 features (?)
- IndexedDB adapter.
- Test create/update payloads that link to each other within the payload.
- Improve inflection to also use dasherize.
- Test the default serializer.
Expand All @@ -14,6 +14,7 @@

### Done

- Consider writing default adapter with Loki.js (decided: go straight for IndexedDB).
- There are some validations that could be added to record field definitions since Fortune is already concerned with them, such as `isUnique` and `isNullable` (decided: this should be done on a per adapter basis).
- Core build.
- Support record types with arbitrary fields (decided: no)
Expand Down
1 change: 1 addition & 0 deletions lib/adapter/adapters/index.js
@@ -1 +1,2 @@
export { default as NeDB } from './nedb'
export { default as IndexedDB } from './indexeddb'
7 changes: 7 additions & 0 deletions lib/adapter/adapters/indexeddb/index.js
@@ -0,0 +1,7 @@
/**
* IndexedDB adapter, optimized for browser.
*/
export default Adapter => class IndexedDBAdapter extends Adapter {


}
13 changes: 8 additions & 5 deletions package.json
@@ -1,7 +1,7 @@
{
"name": "fortune",
"description": "An I/O library for web applications.",
"version": "1.0.0-alpha.12",
"version": "1.0.0-alpha.13",
"license": "MIT",
"author": "Dali Zheng <d@liwa.li> (http://daliwa.li)",
"contributors": [],
Expand All @@ -22,13 +22,15 @@
"build:website": "babel-node website/build",
"prepublish": "npm run build && npm run build:core",
"postpublish": "npm run deploy:website",
"test": "npm run test:lint && npm run build && node dist/test | tap-dot",
"test": "npm run test:server && npm run test:browser",
"test:server": "npm run test:lint && npm run build && node dist/test | tap-dot",
"test:browser": "browserify test/browser.js -t babelify | tape-run -b firefox | tap-dot",
"test:lint": "eslint lib test website",
"test:coverage": "npm run build && istanbul cover dist/test",
"test:website": "npm run build:website && http-server -p 8890 dist/web"
},
"dependencies": {
"babel-runtime": "5.6.1",
"babel-runtime": "5.6.3",
"chalk": "1.0.0",
"inflection": "1.7.1",
"nedb": "1.1.2",
Expand All @@ -37,7 +39,7 @@
"uri-templates": "0.1.7"
},
"devDependencies": {
"babel": "5.6.1",
"babel": "5.6.3",
"babelify": "6.1.2",
"browserify": "10.2.4",
"docchi": "0.10.2",
Expand All @@ -52,7 +54,8 @@
"myth": "1.4.0",
"node-fetch": "1.3.0",
"rimraf": "2.4.0",
"tap-dot": "1.0.0"
"tap-dot": "1.0.0",
"tape-run": "1.0.0"
},
"files": [
"dist/lib",
Expand Down
1 change: 1 addition & 0 deletions test/browser.js
@@ -0,0 +1 @@
import './integration/adapters/indexeddb'
2 changes: 1 addition & 1 deletion test/index.js
@@ -1,5 +1,4 @@
// Unit tests.
import './unit/adapters'
import './unit/record_type'

// Integration tests.
Expand All @@ -9,3 +8,4 @@ import './integration/methods/update'
import './integration/methods/delete'
import './integration/serializers/micro_api'
import './integration/serializers/json_api'
import './integration/adapters/nedb'
5 changes: 5 additions & 0 deletions test/integration/adapters/indexeddb.js
@@ -0,0 +1,5 @@
import testAdapter from '../../unit/adapter'
import IndexedDB from '../../../lib/adapter/adapters/indexeddb'


testAdapter(IndexedDB, {})
5 changes: 5 additions & 0 deletions test/integration/adapters/nedb.js
@@ -0,0 +1,5 @@
import testAdapter from '../../unit/adapter'
import NeDB from '../../../lib/adapter/adapters/nedb'


testAdapter(NeDB, {})
Binary file modified website/assets/piggu_logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions website/assets/piggu_logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion website/stylesheets/media.css
@@ -1,4 +1,4 @@
@media screen and (max-width: 1140px) {
@media screen and (max-width: 1172px) {
body {
padding-left: 0;
}
Expand Down
2 changes: 1 addition & 1 deletion website/stylesheets/page.css
Expand Up @@ -67,7 +67,7 @@ main:before {
right: 100%;
width: 200%;
height: 100%;
background-color: var(--color-offside);
background-color: var(--color-menu);
}

section {
Expand Down
12 changes: 6 additions & 6 deletions website/stylesheets/variables.css
@@ -1,13 +1,13 @@
:root {

/* colors */
--color-background: #ffffff;
--color-background: #FFFFFF;
--color-menu: rgba(0, 0, 0, 0.03);
--color-offside: rgba(0, 0, 0, 0.09);
--color-primary: rgba(0, 0, 0, 0.75);
--color-secondary: rgba(0, 0, 0, 0.45);
--color-tertiary: rgba(0, 0, 0, 0.21);
--color-accent: #ed7041;
--color-accent: #ED7041;

--color-attribute: #9E559D;
--color-value: #C56752;
Expand All @@ -18,13 +18,13 @@
--mono-font: 'Inconsolata', monospace;

/* measurements */
--max-width: 68em;
--menu-width: 14em;
--max-width: 70em;
--menu-width: 15em;
--body-size: 16px;
--small-size: calc(14 / 16);
--big-size: calc(18 / 16);
--line-height: calc(1em * 28 / 16);
--line-height: calc(1em * 29 / 16);
--border-radius: 6px;
--fade-speed: 0.1s;
--fade-speed: 0.15s;

}
3 changes: 1 addition & 2 deletions website/templates/page.mustache
Expand Up @@ -44,8 +44,7 @@ https://github.com/fortunejs/fortune/tree/master/website
<section>
<header>
<a href="https://www.npmjs.com/package/fortune">Package</a><!--
--><a href="https://github.com/fortunejs/fortune">Repository</a><!--
--><a href="https://github.com/fortunejs/fortune/issues">Issues</a>
--><a href="https://github.com/fortunejs/fortune">Repository</a>
</header>
<article>
{{{content}}}
Expand Down

0 comments on commit 40b773b

Please sign in to comment.