From 16b6a64ef9560e2919d944f19c3b7b4c5943d9f1 Mon Sep 17 00:00:00 2001 From: TJ Holowaychuk Date: Sat, 18 Feb 2012 12:50:16 -0800 Subject: [PATCH] refactored express(1) package.json generation --- bin/express | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/bin/express b/bin/express index ac57d10e8a..0d39c6bc67 100755 --- a/bin/express +++ b/bin/express @@ -294,19 +294,19 @@ function createApplicationAt(path) { app = app.replace(':TEMPLATE', program.template); // package.json - var json = '{' + eol; - json += ' "name": "application-name"' + eol; - json += ' , "version": "0.0.1"' + eol; - json += ' , "private": true' + eol; - json += ' , "dependencies": {' + eol; - json += ' "express": "' + express.version + '"' + eol; - if (program.css) json += ' , "' + program.css + '": "*"' + eol; - if (program.template) json += ' , "' + program.template + '": "*"' + eol; - json += ' }' + eol; - json += '}'; - - - write(path + '/package.json', json); + var pkg = { + name: 'application-name' + , version: '0.0.1' + , private: true + , dependencies: { + express: express.version + } + } + + if (program.css) pkg.dependencies[program.css] = '*'; + if (program.template) pkg.dependencies[program.template] = '*'; + + write(path + '/package.json', JSON.stringify(pkg, null, 2)); write(path + '/app.js', app); }); }