Skip to content

Commit

Permalink
Merge pull request #134 from postlight/api-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharygolba authored Jun 12, 2016
2 parents 7e4a38c + 07bdc43 commit e5387c0
Show file tree
Hide file tree
Showing 214 changed files with 6,174 additions and 3,105 deletions.
8 changes: 4 additions & 4 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"presets": [
"es2015",
"stage-1"
"lux"
],
"plugins": [
"transform-runtime",
"transform-decorators-legacy"
"syntax-flow",
"syntax-trailing-function-commas",
"transform-flow-strip-types"
]
}
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ test/*
node_modules/*

# misc
decl/*
examples/*
4 changes: 4 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
"node": true
},
"globals": {
"T": true,
"Map": true,
"Set": true,
"Promise": true,
"Proxy": true,
"Symbol": true,
"WeakMap": true,
"Iterable": true,
"Module": true,
"before": true,
"after": true,
"describe": true,
Expand Down
15 changes: 15 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[libs]
decl

[ignore]
.*/dist/.*
.*/docs/.*
.*/examples/.*
.*/node_modules/.*
.*/test/.*

[options]
esproposal.class_instance_fields=enable
esproposal.class_static_fields=enable

unsafe.enable_getters_and_setters=true
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
dist/
docs/

# dependencies
node_modules/
Expand Down
11 changes: 1 addition & 10 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
# source
/src

# dependencies
/node_modules

# misc
.git
.babelrc
.eslintrc
.editorconfig
.travis.yml
*.DS_Store
webpack.config.babel.js
/examples

# docs
CHANGELOG.md
ROADMAP.md
/docs

# logs
/log
Expand Down
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ sudo: true
language: node_js

node_js:
- '4'
- '5'
- '6'

services:
Expand Down
155 changes: 155 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,160 @@
# Lux Changelog

### 0.0.1-beta.11 (June 12, 2016)

This is the last big set of breaking changes before a stable `1.0.0` release
and moving forward we will strictly follow semantic versioning.

If all goes well in this release the next release will be `1.0.0-rc` and will
only contain a few more features geared towards application profiling.

##### Commits

* [[`30f962c003`](https://github.com/postlight/lux/commit/30f962c003)] - **deps**: update dependencies (Zachary Golba)
* [[`b6700be793`](https://github.com/postlight/lux/commit/b6700be793)] - **refactor**: move query proxy to initializer function (Zachary Golba)
* [[`b53c58a06f`](https://github.com/postlight/lux/commit/b53c58a06f)] - **chore**: update examples (Zachary Golba)
* [[`2d0f2ef941`](https://github.com/postlight/lux/commit/2d0f2ef941)] - **feat**: support n:m relationships (Zachary Golba)
* [[`93e3c0a14b`](https://github.com/postlight/lux/commit/93e3c0a14b)] - **feat**: add chainable query interface (Zachary Golba)
* [[`425b8de4cc`](https://github.com/postlight/lux/commit/425b8de4cc)] - **feat**: use watchman for file watcher with fs.watch fallback (Zachary Golba)
* [[`97bed29798`](https://github.com/postlight/lux/commit/97bed29798)] - **refactor**: remove all decorators from private and public APIs (Zachary Golba)
* [[`53e257ae66`](https://github.com/postlight/lux/commit/53e257ae66)] - **refactor**: use lux babel preset (Zachary Golba)
* [[`2512e857b2`](https://github.com/postlight/lux/commit/2512e857b2)] - **refactor**: use streams for Logger (Zachary Golba)
* [[`4341f5cebd`](https://github.com/postlight/lux/commit/4341f5cebd)] - **refactor**: use rollup for build (Zachary Golba)
* [[`6bc225ac87`](https://github.com/postlight/lux/commit/6bc225ac87)] - **feat**: add file watcher (Zachary Golba)
* [[`5425c512e8`](https://github.com/postlight/lux/commit/5425c512e8)] - **feat**: add process manager (Zachary Golba)
* [[`7d0463a3f0`](https://github.com/postlight/lux/commit/7d0463a3f0)] - **feat**: tree-shaking, native es6, and start of HMR work (Zachary Golba)
* [[`82eab320d2`](https://github.com/postlight/lux/commit/82eab320d2)] - **docs**: start api documentation (Zachary Golba)
* [[`7e4a38c781`](https://github.com/postlight/lux/commit/7e4a38c781)] - **deps**: update eslint to version 2.12.0 (#140) (Greenkeeper)
* [[`6b8b29aea3`](https://github.com/postlight/lux/commit/6b8b29aea3)] - **deps**: update eslint to version 2.11.1 (#139) (Greenkeeper)
* [[`ef8b36cb2f`](https://github.com/postlight/lux/commit/ef8b36cb2f)] - **deps**: update babel-core to version 6.9.1 (#137) (Greenkeeper)
* [[`c5c812dc62`](https://github.com/postlight/lux/commit/c5c812dc62)] - **deps**: update eslint to version 2.11.0 (#135) (Greenkeeper)
* [[`24033dcfb3`](https://github.com/postlight/lux/commit/24033dcfb3)] - **chore**: update eslint config (#133) (Zachary Golba)
* [[`ed58e7a685`](https://github.com/postlight/lux/commit/ed58e7a685)] - **deps**: update mocha to version 2.5.3 (#132) (Greenkeeper)
* [[`c76c51b802`](https://github.com/postlight/lux/commit/c76c51b802)] - **deps**: update mocha to version 2.5.2 (#130) (Greenkeeper)

##### Upgrading

##### Models

For the sake of proper namespacing, Lux no longer exports the `Application`
class as a `default` export. To upgrade simply use a named import of
`Application` within your `./app/index.js` file.

```javascript
import { Application } from 'lux-framework';

class MyApp extends Application {

}

export default MyApp;
```

You could also use a namespaced import of Lux if you are worried about
collisions.

```javascript
import Lux from 'lux-framework';

class MyApp extends Lux.Application {

}

export default MyApp;
```

##### Models

Models now support scopes and have a chainable query interface. More docs will
soon be available on this but for now it should be as simple as replacing calls
to `Model.findAll` with `Model.where`.

##### Controllers

Decorators are no longer used to declare custom actions on your controller. For
an easy upgrade simply remove the `@action` at the top of your custom actions.

```javascript
import { Controller } from 'lux-framework';

import Post from '../models/post';

class PostsController extends Controller {
drafts() {
return Post.drafts();
}
}

export default PostsController;
```

##### Routes

Route declarations no longer support an arrow function export since arrow
functions do not have a `name` property.

```javascript
// ./app/routes.js

export default function routes(route, resource) {
resource('posts');
}
```

##### Seed

The db seed function no longer support an arrow function export since arrow
functions do not have a `name` property.

```javascript
// ./db/seed.js

export default function seed() {
resource('posts');
}
```

##### Config

Config files found in `./config/environments` now only require a single option
`log`.

```javascript
// ./config/environments/development.js

export default {
log: true
};
```

##### .babelrc

Lux now uses a special babel [preset](https://github.com/zacharygolba/babel-preset-lux)
to only transpile features that are missing from Node 6.X. That means that ~95%
of ES2015 syntax is actually using a native implementation. You can expect a
performance boost in this release 🐇.

```json
{
"presets": ["lux"]
}
```

##### package.json

Update your `package.json` to only include the following base packages required
for a Lux application (plus the ones you installed yourself).

```json
{
"babel-core": "6.9.1",
"babel-preset-lux": "1.0.0",
"knex": "0.11.5",
"lux-framework": "0.0.1-beta.11",
"sqlite3": "3.1.4"
}
```

### 0.0.1-beta.10 (May 23, 2016)

* [[`f2b63501c9`](https://github.com/postlight/lux/commit/f2b63501c9)] - **chore**: bump version to 0.0.1-beta.10 (Zachary Golba)
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ This isn't another wrapper around [Express](http://expressjs.com/) or a framewor
* Optimized database queries based on serialized attributes and associations
* Highly extensible - just write reusable JavaScript functions
* Pairs nicely with client-side JavaScript applications 🍷
* Easy to contribute (source is ~2,000 lines of readable JavaScript)
* Easy to contribute
* Routes are stored and accessed via a `Map` not an `Array`
* Embraces ES2015 and beyond
* Classes
* Modules
* Promises & async/await
* Decorators
* Arrow Functions
* etc.

Expand Down Expand Up @@ -96,9 +95,8 @@ With Lux your code from before can now look like this:

```javascript
class PostsController extends Controller {
@action
index(req, res) {
return Post.findAll();
return Post.all();
}
}
```
Expand Down
10 changes: 2 additions & 8 deletions bin/lux
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@
const PWD = process.env.PWD;

try {
const Lux = require(`${PWD}/node_modules/lux-framework`);

if (typeof Lux.CLI === 'function') {
Lux.CLI();
} else {
require(`${PWD}/node_modules/lux-framework/dist/packages/cli`);
}
require(`${PWD}/node_modules/lux-framework/dist/cli`).call(null);
} catch (err) {
require('../dist').CLI();
require('../dist/cli').call(null);
}
40 changes: 40 additions & 0 deletions build/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import json from 'rollup-plugin-json';
import babel from 'rollup-plugin-babel';
import eslint from 'rollup-plugin-eslint';
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import { readdirSync } from 'fs';
import { join as joinPath } from 'path';

export default {
external: readdirSync(joinPath(__dirname, '../node_modules')),
sourceMap: true,

banner:
'require(\'source-map-support\').install();\n' +
'const external = require;\n',

plugins: [
json(),

commonjs({
include: joinPath(__dirname, '../node_modules/**'),
ignoreGlobal: true
}),

nodeResolve({
preferBuiltins: true
}),

eslint({
throwError: true,

exclude: [
joinPath(__dirname, '../node_modules/**'),
joinPath(__dirname, '../package.json')
]
}),

babel()
],
};
39 changes: 39 additions & 0 deletions build/config.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import multiEntry from 'rollup-plugin-multi-entry';
import nodeResolve from 'rollup-plugin-node-resolve';
import { readdirSync } from 'fs';
import { join as joinPath } from 'path';

export default {
banner: 'require(\'source-map-support\').install();\n',
sourceMap: true,

entry: [
joinPath(__dirname, '../test/index.js'),
joinPath(__dirname, '../test/unit/**/*.js'),
joinPath(__dirname, '../test/integration/**/*.js'),
],

external: [
...readdirSync(joinPath(__dirname, '../node_modules')),
...readdirSync(joinPath(__dirname, '../test/test-app/node_modules')),
joinPath(__dirname, '../test/test-app/dist/boot.js'),
joinPath(__dirname, '../test/test-app/dist/bundle.js')
],

plugins: [
commonjs({
include: joinPath(__dirname, '../node_modules/**'),
ignoreGlobal: true
}),

nodeResolve({
preferBuiltins: true
}),

babel(),

multiEntry()
],
};
4 changes: 4 additions & 0 deletions decl/ansi-regex.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module 'ansi-regex' {
declare function ansiregex(): RegExp;
declare var exports: ansiregex;
}
3 changes: 3 additions & 0 deletions decl/bluebird.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module 'bluebird' {
declare var exports: typeof Promise;
}
7 changes: 7 additions & 0 deletions decl/chalk.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
declare module 'chalk' {
declare function cyan(source: string): string;
declare function dim(source: string): string;
declare function green(source: string): string;
declare function red(source: string): string;
declare function yellow(source: string): string;
}
Loading

0 comments on commit e5387c0

Please sign in to comment.