Migrate to AOT compiled babel.

pull/25/head
Alex Kern 10 years ago
parent fac5cc372c
commit f0cd569d8a

1
.gitignore vendored

@ -29,6 +29,7 @@ node_modules/*
.lock-wscript .lock-wscript
# Compiled assets # Compiled assets
dist
css/index.css css/index.css
# New Relic # New Relic

@ -36,7 +36,7 @@ If you'd like to use [Twilio's STUN/TURN service](https://www.twilio.com/stun-tu
$ git clone https://github.com/kern/filepizza.git $ git clone https://github.com/kern/filepizza.git
$ npm install $ npm install
$ npm start $ npm run watch
FilePizza is an isomorphic React application which uses the Flux application architecture. ES6 features are used liberally and compiled using Babel. Views are rendered on the server, store data is serialized and sent to the client, which then picks up where the server left off. FilePizza is an isomorphic React application which uses the Flux application architecture. ES6 features are used liberally and compiled using Babel. Views are rendered on the server, store data is serialized and sent to the client, which then picks up where the server left off.

@ -7,9 +7,4 @@ try {
// Don't load New Relic if the configuration file doesn't exist. // Don't load New Relic if the configuration file doesn't exist.
} }
require('babel/register')({ module.exports = require('./dist/server')
only: new RegExp(__dirname + '/lib' + '|' +
__dirname + '/node_modules/filepizza')
})
module.exports = require('./lib/server')

@ -1,9 +1,7 @@
var browserify = require('browserify-middleware')
var express = require('express')
var path = require('path') var path = require('path')
var CLIENT_MODULE_PATH = path.resolve(__dirname, '../client.js') var CLIENT_MODULE_PATH = path.resolve(__dirname, '../client.js')
module.exports = browserify(CLIENT_MODULE_PATH, { module.exports = function (req, res) {
transform: 'babelify' res.sendFile(CLIENT_MODULE_PATH)
}) }

@ -26,7 +26,12 @@ winston.add(winston.transports.File, {
json: false json: false
}) })
server.listen(process.env.PORT || 3000, function () { server.on('error', function (err) {
console.error(err.message)
process.exit(1)
})
server.listen(process.env.PORT || 3000, function (err) {
var host = server.address().address var host = server.address().address
var port = server.address().port var port = server.address().port
console.log('FilePizza listening on %s:%s', host, port) console.log('FilePizza listening on %s:%s', host, port)

@ -1,9 +1,17 @@
{ {
"name": "filepizza", "name": "filepizza",
"version": "0.2.0", "version": "0.2.1",
"description": "Free peer-to-peer file transfers in your browser.", "description": "Free peer-to-peer file transfers in your browser.",
"main": "index.js",
"scripts": { "scripts": {
"clean": "rm -rf dist && mkdir -p dist",
"build": "npm run build:server && npm run build:client",
"build:server": "./node_modules/.bin/babel lib -d dist -s inline",
"build:client": "./node_modules/.bin/browserify lib/client.js -t babelify -o dist/client.js -d",
"watch": "./node_modules/.bin/nodemon -w lib --exec 'npm run build && npm run start'",
"publish": "npm run clean && npm run publish:build && npm publish",
"publish:build": "npm run publish:build:server && npm run publish:build:client",
"publish:build:server": "./node_modules/.bin/babel lib -d dist",
"publish:build:client": "./node_modules/.bin/browserify lib/client.js -t babelify -t uglifyify | ./node_modules/.bin/uglifyjs -c > dist/client.js",
"start": "node index.js" "start": "node index.js"
}, },
"repository": { "repository": {
@ -18,10 +26,6 @@
"homepage": "https://github.com/kern/filepizza", "homepage": "https://github.com/kern/filepizza",
"dependencies": { "dependencies": {
"alt": "^0.14.4", "alt": "^0.14.4",
"babel": "^5.5.8",
"babelify": "^6.1.3",
"browserify": "^11.0.1",
"browserify-middleware": "^7.0.0",
"classnames": "^1.2.0", "classnames": "^1.2.0",
"express": "^4.12.0", "express": "^4.12.0",
"express-winston": "^0.3.1", "express-winston": "^0.3.1",
@ -46,5 +50,13 @@
"node": "0.12.x" "node": "0.12.x"
}, },
"preferGlobal": "true", "preferGlobal": "true",
"bin": "./index.js" "bin": "./index.js",
"devDependencies": {
"babel": "^5.8.23",
"babelify": "^6.3.0",
"browserify": "^11.0.1",
"nodemon": "^1.4.1",
"uglify-js": "^2.4.24",
"uglifyify": "^3.0.1"
}
} }

Loading…
Cancel
Save