From 7bb57882a048244f9a224ab51ebd5fe36a5cc7a7 Mon Sep 17 00:00:00 2001 From: titay2 Date: Tue, 20 Sep 2016 20:20:26 +0300 Subject: [PATCH 1/2] initial commit --- index.js | 14 ++++++++++++++ package.json | 17 +++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 index.js create mode 100644 package.json diff --git a/index.js b/index.js new file mode 100644 index 0000000..c952149 --- /dev/null +++ b/index.js @@ -0,0 +1,14 @@ +console.log('hello world') +var exec = require('child_process').exec; +var child; + +// get exec from that utily, give the command you want to run as it's first argument + child = exec('npm install ffi', + function (error, stdout, stderr) { + // these are the result, somehow, it's devided to when there's error, or output etc. + console.log('stdout: ' + stdout); + console.log('stderr: ' + stderr); + if (error !== null) { + console.log('exec error: ' + error); + } + }); diff --git a/package.json b/package.json new file mode 100644 index 0000000..7b66346 --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "name": "create-hoodie-app-cli", + "version": "1.0.0", + "description": "Initial release ", + "main": "index.js", + "scripts": {"start": "node index.js"}, + "repository": { + "type": "git", + "url": "git+https://github.com/Rookies-RGSOC2016/create-hoodie-app-cli.git" + }, + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/Rookies-RGSOC2016/create-hoodie-app-cli/issues" + }, + "homepage": "https://github.com/Rookies-RGSOC2016/create-hoodie-app-cli#readme" +} From 74baa6aa38747c51c48aa3d146d96b1b8c9c18ca Mon Sep 17 00:00:00 2001 From: titay2 Date: Fri, 23 Sep 2016 19:30:01 +0300 Subject: [PATCH 2/2] npm start noe working --- index.js | 62 ++++++++++++++++++++++++++++++++++++++---------- package.json | 17 ------------- tmp/package.json | 14 +++++++++++ 3 files changed, 64 insertions(+), 29 deletions(-) delete mode 100644 package.json create mode 100644 tmp/package.json diff --git a/index.js b/index.js index c952149..ddf6974 100644 --- a/index.js +++ b/index.js @@ -1,14 +1,52 @@ -console.log('hello world') + +var fs = require('fs') +var child = require('child_process').exec; var exec = require('child_process').exec; -var child; - -// get exec from that utily, give the command you want to run as it's first argument - child = exec('npm install ffi', - function (error, stdout, stderr) { - // these are the result, somehow, it's devided to when there's error, or output etc. - console.log('stdout: ' + stdout); - console.log('stderr: ' + stderr); - if (error !== null) { - console.log('exec error: ' + error); - } +var dir = './tmp'; +if (!fs.existsSync(dir)){ + fs.mkdirSync(dir); +} + fs.writeFile("tmp/package.json",JSON.stringify({ + name: "tmp", + script: "tmp", + version: "1.0.0", + description: "", + main: "index.js", + keywords: [], + author: "", + license: "ISC", + scripts: { + start: "hoodie", + test: "echo \"Error: no test specified\" && exit 1" + } + }, + null,2), function(err) { + if(err) { + console.log("error"+err) + } else { + console.log("The file was saved!"); + } + }) + + exec('npm install hoodie --save', { + cwd: 'tmp' + }, function(error, stdout, stderr) { + console.log('stdout: ' + stdout); + console.log('stderr: ' + stderr); + if (error !== null) { + console.log('exec error: ' + error); + } }); + +// child('npm start', { +// cwd: 'tmp' +// }, function(error, stdout, stderr) { +// console.log('stdout: ' + stdout); +// console.log('stderr: ' + stderr); +// if (error !== null) { +// console.log('exec error: ' + error); +// } +// }); +// + +console.log('hello world') diff --git a/package.json b/package.json deleted file mode 100644 index 7b66346..0000000 --- a/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "create-hoodie-app-cli", - "version": "1.0.0", - "description": "Initial release ", - "main": "index.js", - "scripts": {"start": "node index.js"}, - "repository": { - "type": "git", - "url": "git+https://github.com/Rookies-RGSOC2016/create-hoodie-app-cli.git" - }, - "author": "", - "license": "ISC", - "bugs": { - "url": "https://github.com/Rookies-RGSOC2016/create-hoodie-app-cli/issues" - }, - "homepage": "https://github.com/Rookies-RGSOC2016/create-hoodie-app-cli#readme" -} diff --git a/tmp/package.json b/tmp/package.json new file mode 100644 index 0000000..01abbf8 --- /dev/null +++ b/tmp/package.json @@ -0,0 +1,14 @@ +{ + "name": "tmp", + "script": "tmp", + "version": "1.0.0", + "description": "", + "main": "index.js", + "keywords": [], + "author": "", + "license": "ISC", + "scripts": { + "start": "hoodie", + "test": "echo \"Error: no test specified\" && exit 1" + } +} \ No newline at end of file