Do not use Babel's register hook in production

This commit is contained in:
Michael Jackson 2016-05-16 15:12:49 -07:00
parent 9a3f72f3a6
commit 5f2615f2ed
10 changed files with 19 additions and 15 deletions

1
Procfile Normal file
View File

@ -0,0 +1 @@
web: node lib/server/start.js

1
Procfile.local Normal file
View File

@ -0,0 +1 @@
web: NODE_ENV=development node -r ./modules/register.js modules/server/start.js

3
modules/register.js Normal file
View File

@ -0,0 +1,3 @@
require('babel-register')({
only: __dirname
})

View File

@ -1,8 +1,4 @@
require('babel-register')({
only: require('path').resolve(__dirname, './modules')
})
const createServer = require('./modules/ServerUtils').createServer
import { createServer } from './index'
const port = process.env.PORT || 5000
const registryURL = process.env.REGISTRY_URL || 'https://registry.npmjs.org'
@ -12,11 +8,11 @@ const autoIndex = !process.env.DISABLE_INDEX
const redisURL = process.env.REDIS_URL
const server = createServer({
registryURL: registryURL,
bowerBundle: bowerBundle,
redirectTTL: redirectTTL,
autoIndex: autoIndex,
redisURL: redisURL
registryURL,
bowerBundle,
redirectTTL,
autoIndex,
redisURL
})
server.listen(port, () => {

View File

@ -1,7 +1,13 @@
{
"description": "The website for npmcdn.com",
"author": "Michael Jackson",
"scripts": {
"start": "heroku local -f Procfile.local",
"build": "rimraf lib && babel ./modules -d lib",
"heroku-postbuild": "npm run build"
},
"dependencies": {
"babel-cli": "^6.8.0",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babel-register": "^6.7.2",
@ -13,11 +19,8 @@
"on-finished": "^2.3.0",
"react": "^15.0.2",
"react-dom": "^15.0.2",
"redis": "^2.6.0-1"
},
"repository": {
"type": "git",
"url": "https://github.com/mjackson/npmcdn.com.git"
"redis": "^2.6.0-1",
"rimraf": "^2.5.2"
},
"engines": {
"node": "5.8.x"