Skip to content

Commit

Permalink
fix(ci): fix heroku, deploy only demo/dist (#3441)
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaSurmay authored and valorkin committed Jan 11, 2018
1 parent 7346a5a commit 321f9ae
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ jobs:
on: development
- stage: deploy
script: npm run build:dynamic
before_deploy:
- cd ./demo/dist
deploy:
provider: heroku
api_key: $HEROKU_API_KEY
Expand Down
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@
"e2e-cross": "SAUCE=true npm run e2e",
"e2e-bdd": "protractor ./protractor.cucumber.js",
"view-stats": "webpack-bundle-analyzer demo/dist/stats.json",
"build:dynamic": "run-s build link build:client-and-server-bundles webpack:server",
"build:dynamic": "run-s build link build:client-and-server-bundles webpack:server configure-heroku",
"serve:dynamic": "node demo/dist/server.js",
"build:client-and-server-bundles": "ng build -bh / --prod --env=server && ng build -bh / --prod --env=server --app 1 --output-hashing=false",
"webpack:server": "webpack --config ./scripts/universal/webpack.server.config.js --progress --colors"
"webpack:server": "webpack --config ./scripts/universal/webpack.server.config.js --progress --colors",
"configure-heroku": "node scripts/universal/configure-heroku.js"
},
"main": "bundles/ngx-bootstrap.umd.js",
"module": "index.js",
Expand Down
5 changes: 5 additions & 0 deletions scripts/universal/configure-heroku.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const fs = require('fs-extra');
const path = require('path');

fs.writeFileSync(path.join(process.cwd(), 'demo/dist/Procfile'), 'web: node server.js', 'utf8');
fs.writeFileSync(path.join(process.cwd(), 'demo/dist/package.json'), '{"name": "ngx-universal", "version": "1.0.0" }', 'utf8');
2 changes: 1 addition & 1 deletion scripts/universal/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const app = express();
app.use(compression());

const PORT = process.env.PORT || 3000;
const DIST_FOLDER = join(process.cwd(), 'demo/dist');
const DIST_FOLDER = join(process.cwd(), process.env.DYNO ? './' : 'demo/dist');

// Our index.html we'll use as our template
const template = readFileSync(join(DIST_FOLDER, 'browser', 'index.html')).toString();
Expand Down

0 comments on commit 321f9ae

Please sign in to comment.