diff --git a/boilerplate/package.json b/boilerplate/package.json index ea576d0ae..b0de52d62 100644 --- a/boilerplate/package.json +++ b/boilerplate/package.json @@ -1,10 +1,9 @@ { - "name": "app_name", + "name": "%APP_NAME%", "version": "0.0.1", "description": "", - "main": "Gruntfile.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "embark test" }, "author": "", "license": "ISC", diff --git a/lib/cmds/template_generator.js b/lib/cmds/template_generator.js index 102b465ed..a0aa482f9 100644 --- a/lib/cmds/template_generator.js +++ b/lib/cmds/template_generator.js @@ -11,6 +11,7 @@ TemplateGenerator.prototype.generate = function(destinationFolder, name) { fs.copySync(templatePath, destinationFolder + name); utils.cd(destinationFolder + name); + utils.sed('package.json', '%APP_NAME%', name); console.log('Installing packages.. this can take a few seconds'.green); utils.runCmd('npm install'); diff --git a/lib/core/utils.js b/lib/core/utils.js index 2c1bbf7df..0870374ea 100644 --- a/lib/core/utils.js +++ b/lib/core/utils.js @@ -45,6 +45,10 @@ function cd(folder) { shelljs.cd(folder); } +function sed(file, pattern, replace) { + shelljs.sed('-i', pattern, replace, file); +} + function exit(code) { process.exit(code); } @@ -57,6 +61,7 @@ module.exports = { checkIsAvailable: checkIsAvailable, runCmd: runCmd, cd: cd, + sed: sed, exit: exit };