Skip to content

Commit

Permalink
refactor: use rollup for build
Browse files Browse the repository at this point in the history
fix: update npm scripts

fix: get new build working and prep lux for stable production use
  • Loading branch information
zacharygolba committed Jun 12, 2016
1 parent 6bc225a commit 4341f5c
Show file tree
Hide file tree
Showing 98 changed files with 1,115 additions and 1,084 deletions.
3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"plugins": [
"external-helpers-2",
"syntax-flow",
"syntax-trailing-function-commas",
"transform-decorators-legacy",
"transform-flow-strip-types",
"transform-class-properties",
"transform-decorators",
"transform-es2015-destructuring",
"transform-es2015-parameters",
"transform-es2015-spread",
"syntax-trailing-function-commas",
"transform-object-rest-spread",
"transform-async-to-generator",
"transform-exponentiation-operator"
Expand Down
2 changes: 1 addition & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[libs]
interfaces
decl

[ignore]
.*/dist/.*
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# compiled output
dist/
/docs
docs/

# dependencies
node_modules/
Expand Down
11 changes: 0 additions & 11 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
# source
/src

# dependencies
/node_modules

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

# docs
CHANGELOG.md
ROADMAP.md
/docs

# logs
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
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);
}
39 changes: 39 additions & 0 deletions build/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
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')),

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()
],
};
36 changes: 36 additions & 0 deletions build/config.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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 {
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()
],
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
54 changes: 54 additions & 0 deletions decl/http.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import {
Server as http$Server,
IncomingMessage as http$IncomingMessage,
ServerResponse as http$ServerResponse
} from 'http';

import { Model } from '../src/packages/database';

type params = {
data?: {
id: number | string | Buffer;
type: string;
attributes?: Object;
relationships?: Object;
};

fields: Object;
filter: Object;
id?: number | string | Buffer;
include: Array<string>;
limit: number;
page: number;
sort: string;
};

declare module 'http' {
declare class Server extends http$Server {}

declare class IncomingMessage extends http$IncomingMessage {
params: params;
record?: Model;

parsedURL: {
protocol?: string;
slashes?: boolean;
auth?: string;
host?: string;
port?: string;
hostname?: string;
hash?: string;
search?: string;
query?: any;
pathname?: string;
path?: string;
href: string;
};
}

declare class ServerResponse extends http$ServerResponse {}

declare function createServer(
handler: (req: IncomingMessage, res: ServerResponse) => void
): Server;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
57 changes: 57 additions & 0 deletions decl/rollup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
type rollupOptions = {
entry: string;
onwarn?: Function;
plugins?: Array<{}>;
external?: Array<string>;
};

type writeOptions = {
dest: string;
intro?: string;
outro?: string;
indent?: string | boolean;
format?: 'amd' | 'cjs' | 'es6' | 'iife' | 'umd';
banner?: string;
footer?: string;
exports?: 'auto' | 'default' | 'named' | 'none';
globals?: {};
useStrict: boolean;
sourceMap?: boolean;
moduleId?: string;
moduleName?: string;
sourceMapFile?: string;
};

declare function rollupPlugin(options?: {}): {};

declare module 'rollup' {
declare class Bundle {
write(options: writeOptions): Promise<void>;
}

declare function rollup(options: rollupOptions): Promise<Bundle>;
}

declare module 'rollup-plugin-alias' {
declare var exports: rollupPlugin;
}

declare module 'rollup-plugin-babel' {
declare var exports: rollupPlugin;
}

declare module 'rollup-plugin-commonjs' {
declare var exports: rollupPlugin;
}

declare module 'rollup-plugin-eslint' {
declare var exports: rollupPlugin;
}

declare module 'rollup-plugin-json' {
declare var exports: rollupPlugin;
}

declare module 'rollup-plugin-node-resolve' {
declare var exports: rollupPlugin;
}
49 changes: 0 additions & 49 deletions interfaces/http.js

This file was deleted.

25 changes: 0 additions & 25 deletions interfaces/webpack.js

This file was deleted.

Loading

0 comments on commit 4341f5c

Please sign in to comment.