Skip to content

Commit

Permalink
refactor: use webpack for build
Browse files Browse the repository at this point in the history
fix: NODE_ENV is not being passed down to child processes (#122)

feat: provide backwards compatibility for older versions

refactor: external declaration in webpack banner plugin

chore: add CHANGELOG.md (#123)

docs: update code sample in README.md (#124)

docs: fix broken links in CHANGELOG.md (#125)

chore: move ROADMAP.md to docs section of .npmignore
  • Loading branch information
zacharygolba committed May 22, 2016
1 parent c9f2aef commit 26347ca
Show file tree
Hide file tree
Showing 20 changed files with 361 additions and 240 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"before": true,
"after": true,
"describe": true,
"it": true
"it": true,
"external": true
},
"parser": "babel-eslint",
"rules": {
Expand Down
10 changes: 8 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@
# misc
.git
.babelrc
.eslint
.eslintrc
.editorconfig
.travis.yml
*.DS_Store
gulpfile.babel.js
webpack.config.babel.js
/examples

# docs
CHANGELOG.md
ROADMAP.md

# logs
/log
npm-debug.log
Expand Down
76 changes: 76 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Lux Changelog

### 0.0.1-beta.9 (May 18, 2016)

* [[`4002a5a64d`](https://github.com/postlight/lux/commit/4002a5a64d)] - **chore**: bump version to 0.0.1-beta.9 (#97) (Zachary Golba)
* [[`a7e54aa4da`](https://github.com/postlight/lux/commit/a7e54aa4da)] - **fix**: middleware functions added in 'beforeAction' not executing (#95) (Zachary Golba)
* [[`b16557647e`](https://github.com/postlight/lux/commit/b16557647e)] - **fix**: migration generator does not change - to _ (#96) (Zachary Golba)
* [[`81cdd2108b`](https://github.com/postlight/lux/commit/81cdd2108b)] - **fix**: remove short -db flag from lux new cmd (#93) (Zachary Golba)
* [[`71f4593fbb`](https://github.com/postlight/lux/commit/71f4593fbb)] - **refactor**: use chalk instead of colors (#92) (Zachary Golba)
* [[`786872becb`](https://github.com/postlight/lux/commit/786872becb)] - **fix**: config generator uses double quotes (#89) (Zachary Golba)
* [[`2fb314ad1b`](https://github.com/postlight/lux/commit/2fb314ad1b)] - **deps**: update bluebird to version 3.4.0 (#91) (Zachary Golba)
* [[`d95fb392c2`](https://github.com/postlight/lux/commit/d95fb392c2)] - **deps**: update babel-preset-es2015 to version 6.9.0 (#90) (Zachary Golba)
* [[`6c7b42ddad`](https://github.com/postlight/lux/commit/6c7b42ddad)] - **deps**: update babel-runtime to version 6.9.0 (#88) (Greenkeeper)
* [[`095d12a100`](https://github.com/postlight/lux/commit/095d12a100)] - **deps**: update babel-plugin-transform-runtime to version 6.9.0 (#87) (Greenkeeper)
* [[`9ef804ecd9`](https://github.com/postlight/lux/commit/9ef804ecd9)] - **deps**: update babel-core to version 6.9.0 (#86) (Greenkeeper)
* [[`23251651e9`](https://github.com/postlight/lux/commit/23251651e9)] - **chore**: add keywords to package.json (#81) (Zachary Golba)
* [[`418cadb662`](https://github.com/postlight/lux/commit/418cadb662)] - **chore**: add dependencies badge to README.md (#80) (Zachary Golba)
* [[`af3e72b73e`](https://github.com/postlight/lux/commit/af3e72b73e)] - **deps**: Update all dependencies 🌴 (#79) (Greenkeeper)
* [[`2560584a4f`](https://github.com/postlight/lux/commit/2560584a4f)] - **chore**: update roadmap to reflect changes in #65 (#78) (Zachary Golba)

### 0.0.1-beta.8 (May 14, 2016)

* [[`6416c6c309`](https://github.com/postlight/lux/commit/6416c6c309)] - **feat**: implement custom orm on top of knex.js (#65) (Zachary Golba)
* [[`d117376a46`](https://github.com/postlight/lux/commit/d117376a46)] - **test**: add sudo and correct g++ version for node 4+ in .travis.yml (#70) (Zachary Golba)
* [[`9a293bd117`](https://github.com/postlight/lux/commit/9a293bd117)] - **feat**: use js instead of json for config files (#67) (John-Henry Liberty)
* [[`720f0e1323`](https://github.com/postlight/lux/commit/720f0e1323)] - **test**: update travis to use npm link (#68) (John-Henry Liberty)
* [[`2fc214c045`](https://github.com/postlight/lux/commit/2fc214c045)] - **feat**: use local lux install if one exists (#66) (Zachary Golba)

### 0.0.1-beta.7 (May 01, 2016)

* [[`e35c430cdc`](https://github.com/postlight/lux/commit/e35c430cdc)] - **chore**: bump version to 0.0.1-beta.7 (#64) (Zachary Golba)
* [[`ec0b60b191`](https://github.com/postlight/lux/commit/ec0b60b191)] - **fix**: HEAD and OPTIONS request result in a 404 (#63) (Zachary Golba)

### 0.0.1-beta.6 (April 28, 2016)

* [[`4079b07269`](https://github.com/postlight/lux/commit/4079b07269)] - **chore**: bump version to 0.0.1-beta.6 (#61) (Zachary Golba)
* [[`b94c526e87`](https://github.com/postlight/lux/commit/b94c526e87)] - **fix**: serialize hasMany relationships (#60) (Zachary Golba)
* [[`2f5aa41c1a`](https://github.com/postlight/lux/commit/2f5aa41c1a)] - **chore**: test on node 6 (#58) (Zachary Golba)
* [[`e26a900e43`](https://github.com/postlight/lux/commit/e26a900e43)] - **docs**: add ROADMAP.md (#57) (Zachary Golba)

### 0.0.1-beta.5 (April 22, 2016)

* [[`8a21b472e0`](https://github.com/postlight/lux/commit/8a21b472e0)] - **chore**: bump version to 0.0.1-beta.5 (#55) (Zachary Golba)
* [[`909e732b9a`](https://github.com/postlight/lux/commit/909e732b9a)] - **chore**: update dependencies (#54) (Zachary Golba)
* [[`47ef4b87a8`](https://github.com/postlight/lux/commit/47ef4b87a8)] - **fix**: miss-match session key/secret error (#53) (Zachary Golba)
* [[`e70a032c0f`](https://github.com/postlight/lux/commit/e70a032c0f)] - **fix**: strings w/ commas interpreted as an array for POST/PATCH (#49) (Zachary Golba)
* [[`23da23d74d`](https://github.com/postlight/lux/commit/23da23d74d)] - **docs**: add npm package badge to README (#47) (Zachary Golba)
* [[`0788e468a6`](https://github.com/postlight/lux/commit/0788e468a6)] - **test**: add unit/integration tests (#39) (Zachary Golba)
* [[`498c951917`](https://github.com/postlight/lux/commit/498c951917)] - **chore**: add Gitter badge (#46) (The Gitter Badger)

### 0.0.1-beta.4 (April 21, 2016)

* [[`77dcdbe03b`](https://github.com/postlight/lux/commit/77dcdbe03b)] - **chore**: bump version to 0.0.1-beta.4 (#45) (Zachary Golba)
* [[`7c529fa235`](https://github.com/postlight/lux/commit/7c529fa235)] - **fix**: correct typo in README (#44) (Nic Young)
* [[`0880a71d89`](https://github.com/postlight/lux/commit/0880a71d89)] - **fix**: globally disable orm2 cache (Zachary Golba)
* [[`0bd7c8dfde`](https://github.com/postlight/lux/commit/0bd7c8dfde)] - **fix**: make ora a runtime dependency (#40) (Zachary Golba)
* [[`30ca0c27d5`](https://github.com/postlight/lux/commit/30ca0c27d5)] - **feat**: add spinner for long running task (#38) (Albert Yu)

### 0.0.1-beta.3 (April 18, 2016)

* [[`03958b98d1`](https://github.com/postlight/lux/commit/03958b98d1)] - **chore**: bump version to 0.0.1-beta.3 (#37) (Zachary Golba)
* [[`18199d6993`](https://github.com/postlight/lux/commit/18199d6993)] - Merge pull request #36 from postlight/database-missing-port (kev5873)
* [[`10b782be1f`](https://github.com/postlight/lux/commit/10b782be1f)] - **fix**: logger date incorrect (#35) (kev5873)
* [[`e9897371be`](https://github.com/postlight/lux/commit/e9897371be)] - **chore**: Link to Medium Article in Readme (#33) (Zachary Golba)

### 0.0.1-beta.2 (April 18, 2016)

* [[`c073253cd0`](https://github.com/postlight/lux/commit/c073253cd0)] - **fix**: listening message dispatched before workers are ready (#34) (Zachary Golba)

### 0.0.1-beta.1 (April 17, 2016)

* [[`5a734e79ce`](https://github.com/postlight/lux/commit/5a734e79ce)] - **fix**: shebang line not finding node on linux (#32) (Zachary Golba)

### 0.0.1-beta (April 07, 2016)

* [[`4a193b86d2`](https://github.com/postlight/lux/commit/4a193b86d2)] - Initial Commit (Zachary Golba)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ With Lux your code from before can now look like this:
class PostsController extends Controller {
@action
index(req, res) {
return this.store.query('post', req.params);
return Post.findAll();
}
}
```
Expand Down
14 changes: 12 additions & 2 deletions bin/lux
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
#!/usr/bin/env node
'use strict';

const PWD = process.env.PWD;

try {
require(`${process.env.PWD}/node_modules/lux-framework/dist/packages/cli`);
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`);
}
} catch (err) {
require('../dist/packages/cli');
require('../dist').CLI();
}
38 changes: 0 additions & 38 deletions gulpfile.babel.js

This file was deleted.

21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
"lux": "bin/lux"
},
"scripts": {
"build": "npm run lint && gulp build",
"lint": "eslint ./src/**",
"build": "npm run lint && npm run clean && webpack",
"clean": "rm -rf dist",
"lint": "eslint src/**",
"start": "lux serve",
"test": "npm run lint && gulp test"
"test": "npm run build && mocha --timeout 60000 --compilers=js:babel-core/register test/helper.js test/unit/**/*.js test/integration/**/*.js"
},
"author": "Zachary Golba",
"license": "MIT",
Expand All @@ -35,22 +36,22 @@
"commander": "2.9.0",
"inflection": "1.10.0",
"moment": "2.13.0",
"ora": "0.2.3"
"ora": "0.2.3",
"source-map-support": "0.4.0"
},
"devDependencies": {
"babel-core": "6.9.0",
"babel-eslint": "6.0.4",
"babel-loader": "6.2.4",
"babel-plugin-transform-decorators-legacy": "1.3.4",
"babel-plugin-transform-runtime": "6.9.0",
"babel-preset-es2015": "6.9.0",
"babel-preset-stage-1": "6.5.0",
"chai": "3.5.0",
"gulp": "3.9.1",
"gulp-babel": "6.1.2",
"gulp-eslint": "2.0.0",
"gulp-mocha": "2.2.0",
"gulp-uglify": "1.5.3",
"eslint": "2.10.2",
"isomorphic-fetch": "2.2.1",
"mocha": "2.4.5"
"json-loader": "0.5.4",
"mocha": "2.4.5",
"webpack": "1.13.1"
}
}
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export CLI from './packages/cli';

export { Model } from './packages/database';
export Serializer from './packages/serializer';
export Controller, { action } from './packages/controller';
Expand Down
2 changes: 1 addition & 1 deletion src/packages/application/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Application {
const store = new Database({
path,
logger,
config: require(`${path}/config/database`).default
config: external(`${path}/config/database`).default
});

defineProperties(this, {
Expand Down
4 changes: 2 additions & 2 deletions src/packages/cli/commands/db-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { connect } from '../../database';
const { env: { PWD, NODE_ENV = 'development' } } = process;

export default async function dbCreate() {
require(`${PWD}/node_modules/babel-core/register`);
external(`${PWD}/node_modules/babel-core/register`);

const {
default: {
Expand All @@ -14,7 +14,7 @@ export default async function dbCreate() {
...config
}
}
} = require(`${PWD}/config/database`);
} = external(`${PWD}/config/database`);

if (driver === 'sqlite3') {
await fs.writeFileAsync(`${PWD}/db/${database}_${NODE_ENV}.sqlite`, '');
Expand Down
4 changes: 2 additions & 2 deletions src/packages/cli/commands/db-drop.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { rmrf } from '../../fs';
const { env: { PWD, NODE_ENV = 'development' } } = process;

export default async function dbDrop() {
require(`${PWD}/node_modules/babel-core/register`);
external(`${PWD}/node_modules/babel-core/register`);

const {
default: {
Expand All @@ -14,7 +14,7 @@ export default async function dbDrop() {
...config
}
}
} = require(`${PWD}/config/database`);
} = external(`${PWD}/config/database`);

if (driver === 'sqlite3') {
await rmrf(`${PWD}/db/${database}_${NODE_ENV}.sqlite`);
Expand Down
6 changes: 3 additions & 3 deletions src/packages/cli/commands/db-migrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import Logger, { sql } from '../../logger';
const { env: { PWD } } = process;

export default async function dbMigrate() {
require(`${PWD}/node_modules/babel-core/register`);
external(`${PWD}/node_modules/babel-core/register`);

const { connection, schema } = new Database({
path: PWD,
config: require(`${PWD}/config/database`).default,
config: external(`${PWD}/config/database`).default,

logger: await Logger.create({
appPath: PWD,
Expand All @@ -25,7 +25,7 @@ export default async function dbMigrate() {
await Promise.all(
pending.map(async (migration) => {
const version = migration.replace(/^(\d{16})-.+$/g, '$1');
let { up } = require(`${PWD}/db/migrate/${migration}`);
let { up } = external(`${PWD}/db/migrate/${migration}`);

up = up(schema());

Expand Down
6 changes: 3 additions & 3 deletions src/packages/cli/commands/db-rollback.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import fs from '../../fs';
const { env: { PWD } } = process;

export default async function dbRollback() {
require(`${PWD}/node_modules/babel-core/register`);
external(`${PWD}/node_modules/babel-core/register`);

const { connection, schema } = new Database({
path: PWD,
config: require(`${PWD}/config/database`).default,
config: external(`${PWD}/config/database`).default,

logger: await Logger.create({
appPath: PWD,
Expand All @@ -35,7 +35,7 @@ export default async function dbRollback() {
});

if (target) {
let { down } = require(`${PWD}/db/migrate/${target}`);
let { down } = external(`${PWD}/db/migrate/${target}`);

down = down(schema());

Expand Down
6 changes: 3 additions & 3 deletions src/packages/cli/commands/db-seed.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import loader from '../../loader';
const { env: { PWD } } = process;

export default async function dbSeed() {
require(`${PWD}/node_modules/babel-core/register`);
external(`${PWD}/node_modules/babel-core/register`);

await new Database({
path: PWD,
config: require(`${PWD}/config/database`).default,
config: external(`${PWD}/config/database`).default,

logger: await Logger.create({
appPath: PWD,
enabled: false
})
}).define(await loader(PWD, 'models'));

await require(`${PWD}/db/seed`).default();
await external(`${PWD}/db/seed`).default();
}
6 changes: 3 additions & 3 deletions src/packages/cli/commands/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const {
} = process;

export default async function serve(port = 4000) {
const Application = require(`${PWD}/bin/app`);
const config = require(`${PWD}/config/environments/${NODE_ENV}`).default;
const Application = external(`${PWD}/bin/app`);
const config = external(`${PWD}/config/environments/${NODE_ENV}`).default;

const logger = await Logger.create({
enabled: config.log,
Expand All @@ -32,7 +32,7 @@ export default async function serve(port = 4000) {
logger.log(`Starting Lux Server with ${cyan(`${total}`)} worker processes`);

for (let i = 0; i < total; i++) {
cluster.fork().once('message', msg => {
cluster.fork({ NODE_ENV }).once('message', msg => {
if (msg === 'ready') {
current++;
if (current === total) {
Expand Down
Loading

0 comments on commit 26347ca

Please sign in to comment.