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

Added "express --paas heroku" option which adds package.json entries for heroku deployment to work out-of-the-box #1483

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions bin/express
Expand Up @@ -21,6 +21,7 @@ program
.option('-J, --jshtml', 'add jshtml engine support (defaults to jade)')
.option('-H, --hogan', 'add hogan.js engine support')
.option('-c, --css <engine>', 'add stylesheet <engine> support (less|stylus) (defaults to plain css)')
.option('-p, --paas [platform]', 'add <platform> support (heroku) (defaults to generic support)')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// generate with heroku support
express -p
express --paas

// generates with heroku support
express -p heroku
express --paas heroku
express -p heroku path/to/my/app
express --paas heroku path/to/my/app

// fail to generate in surprising ways (they write to the current directory)
express -p path/to/my/app
express --paas path/to/my/app

This is because this line in bin/express consumes it:

var path = program.args.shift() || '.';

Thoughts?

.option('-f, --force', 'force on non-empty directory')
.parse(process.argv);

Expand All @@ -39,6 +40,8 @@ if (program.ejs) program.template = 'ejs';
if (program.jshtml) program.template = 'jshtml';
if (program.hogan) program.template = 'hjs';

if (program.heroku) program.paas = 'heroku';

/**
* Routes index template.
*/
Expand Down Expand Up @@ -364,6 +367,13 @@ function createApplicationAt(path) {
}
}

if (program.paas == 'heroku') {
pkg.engines = {
node: '0.8.x'
, npm: '1.1.x'
}
}

write(path + '/package.json', JSON.stringify(pkg, null, 2));
write(path + '/app.js', app);
});
Expand Down