Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ci): fix heroku, deploy only demo/dist #3441

Merged
merged 1 commit into from
Jan 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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