Skip to content

Commit

Permalink
fix: Issues related to typos in the templates folder + issue related …
Browse files Browse the repository at this point in the history
…to badly determining when to start the emulator
  • Loading branch information
nicolasdao committed Jul 14, 2017
1 parent 0727c87 commit 192f51e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"scripts": {
"test": "mocha",
"eslint": "eslint index.js src/ test/",
"release": "standard-version"
"release": "standard-version --prerelease alpha"
},
"repository": {
"type": "git",
Expand Down
17 changes: 12 additions & 5 deletions src/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,19 @@ const deploy = (env = 'default') => {
}

if (env == 'default') { // Local environment. Make Sure the Google function emulator is running.
const emulatorsRunning = shell.exec('ps -ax | grep functions-emulator | wc -l', {silent:true}).stdout * 1
const functionsNotInstalled = !shell.exec('which functions', {silent:true}).stdout
if (functionsNotInstalled) {
console.log(`${'Google Function Emulator'.italic} seems to not be installed on your machine.
if (emulatorsRunning < 3) {
You cannot run this project on your local machine. To install it globally, simply run the following:
${'npm install -g @google-cloud/functions-emulator'.bold.italic}`.red)
process.exit(1)
}

const functionStatus = shell.exec('functions status', {silent:true}).stdout
const functionsStopped = functionStatus.indexOf('│ STOPPED') > 0

if (functionsStopped) {
console.log('No emulator running. Time to start one!'.cyan)
shell.exec('functions start')
}
Expand Down Expand Up @@ -98,9 +108,6 @@ const deploy = (env = 'default') => {
}

console.log(`Deployment successful (${(Date.now() - startClock)/1000} sec.)`.green)
/*eslint-disable */
process.exit(1)
/*eslint-enable */
}

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion templates/simpleWebApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"logs": "webfunc logs"
},
"dependencies": {
"webfunc": "^0.1.0",
"webfunc": "^0.1.0-alpha"
},
"devDependencies": {
"chai": "^4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion templates/simpleWebApp/webconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"headers": {
"Access-Control-Allow-Methods": "GET, HEAD, OPTIONS, POST",
"Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept",
"Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept"
},
"env": {
"default": {
Expand Down

0 comments on commit 192f51e

Please sign in to comment.