Created
March 15, 2017 17:43
-
-
Save agustinhaller/f026e8c41cb132b0b7045f5112b4bded to your computer and use it in GitHub Desktop.
deploy a heroku
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "mobile-ui-design-client", | |
"version": "1.0.0", | |
"description": "A simple starter Angular2 project", | |
"scripts": { | |
"build": "rimraf dist && webpack --progress", | |
"watch": "npm run build -- --watch", | |
"server": "webpack-dev-server --inline --progress --port 3000 --content-base src", | |
"start-dev": "npm run server", | |
"prestart": "npm run build", | |
"start": "node src/server.js" | |
}, | |
"dependencies": { | |
"@angular/animations": "4.0.0-rc.1", | |
"@angular/common": "4.0.0-rc.1", | |
"@angular/compiler": "4.0.0-rc.1", | |
"@angular/compiler-cli": "4.0.0-rc.1", | |
"@angular/core": "4.0.0-rc.1", | |
"@angular/forms": "4.0.0-rc.1", | |
"@angular/http": "4.0.0-rc.1", | |
"@angular/platform-browser": "4.0.0-rc.1", | |
"@angular/platform-browser-dynamic": "4.0.0-rc.1", | |
"@angular/platform-server": "4.0.0-rc.1", | |
"@angular/router": "4.0.0-rc.1", | |
"bootstrap": "^3.3.7", | |
"bootstrap-sass": "^3.3.7", | |
"core-js": "^2.4.1", | |
"express": "^4.15.2", | |
"ie-shim": "^0.1.0", | |
"node-sass": "^4.5.0", | |
"reflect-metadata": "^0.1.9", | |
"rxjs": "^5.0.3", | |
"underscore": "^1.8.3", | |
"zone.js": "^0.7.2", | |
"@types/node": "^6.0.48", | |
"angular2-router-loader": "^0.3.4", | |
"angular2-template-loader": "^0.6.0", | |
"awesome-typescript-loader": "^3.0.0-beta.9", | |
"raw-loader": "^0.5.1", | |
"css-loader": "^0.26.2", | |
"html-webpack-plugin": "^2.28.0", | |
"rimraf": "^2.5.4", | |
"sass-loader": "^4.1.1", | |
"to-string-loader": "^1.1.4", | |
"typescript": "^2.1.6", | |
"webpack": "2.2.0", | |
"webpack-dev-server": "2.2.0", | |
"webpack-merge": "^2.6.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const path = require('path'); | |
const app = express(); | |
const ROOT = path.join(path.resolve(__dirname, '../dist')); | |
app.set('port', process.env.PORT || 3000); | |
// app.set('views', __dirname); | |
app.set('view engine', 'html'); | |
app.set('json spaces', 2); | |
app.use(express.static(ROOT)); | |
// Server | |
var server = app.listen(app.get('port'), function(){ | |
console.log(`Listening on: http://localhost:${server.address().port}`); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var webpack = require('webpack'); | |
var path = require('path'); | |
var webpackMerge = require('webpack-merge'); | |
var HtmlWebpackPlugin = require('html-webpack-plugin'); | |
// Webpack Config | |
var webpackConfig = { | |
entry: { | |
'main': './src/main.browser.ts', | |
}, | |
output: { | |
publicPath: '', | |
path: path.resolve(__dirname, './dist'), | |
}, | |
plugins: [ | |
new webpack.ContextReplacementPlugin( | |
// The (\\|\/) piece accounts for path separators in *nix and Windows | |
/angular(\\|\/)core(\\|\/)src(\\|\/)linker/, | |
path.resolve(__dirname, './src'), | |
{ | |
// your Angular Async Route paths relative to this root directory | |
} | |
), | |
new HtmlWebpackPlugin({ | |
template: 'src/index.html' | |
}), | |
], | |
module: { | |
loaders: [ | |
// .ts files for TypeScript | |
{ | |
test: /\.ts$/, | |
loaders: [ | |
'awesome-typescript-loader', | |
'angular2-template-loader', | |
'angular2-router-loader' | |
] | |
}, | |
{ test: /\.css$/, loaders: ['to-string-loader', 'css-loader'] }, | |
{ test: /\.html$/, loader: 'raw-loader' }, | |
{ test: /\.scss$/, loaders: ['raw-loader', 'sass-loader?sourceMap'] } | |
] | |
} | |
}; | |
// Our Webpack Defaults | |
var defaultConfig = { | |
devtool: 'source-map', | |
output: { | |
filename: '[name].bundle.js', | |
sourceMapFilename: '[name].map', | |
chunkFilename: '[id].chunk.js' | |
}, | |
resolve: { | |
extensions: [ '.ts', '.js' ], | |
modules: [ path.resolve(__dirname, 'node_modules') ] | |
}, | |
devServer: { | |
historyApiFallback: true, | |
watchOptions: { aggregateTimeout: 300, poll: 1000 }, | |
headers: { | |
"Access-Control-Allow-Origin": "*", | |
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS", | |
"Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization" | |
} | |
}, | |
node: { | |
global: true, | |
crypto: 'empty', | |
__dirname: true, | |
__filename: true, | |
process: true, | |
Buffer: false, | |
clearImmediate: false, | |
setImmediate: false | |
} | |
}; | |
module.exports = webpackMerge(defaultConfig, webpackConfig); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment