mirror of https://github.com/codefeathers/w
Muthu Kumar
7 years ago
7 changed files with 127 additions and 19 deletions
@ -1,10 +1,19 @@ |
|||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||
|
|
||||
var program = require('commander'); |
const program = require('commander'); |
||||
|
|
||||
program |
const wordbox = require('./lib/api'); |
||||
.version('0.1.0') |
|
||||
.option('-h, --help', 'Show w-cli help') |
|
||||
.parse(process.argv); |
|
||||
|
|
||||
if (program.help) console.log('w -v for version number'); |
program.version('1.0.2'); |
||||
|
|
||||
|
program.command('new <appname> [options...]') |
||||
|
.description('Create new WordBox app') |
||||
|
.action((appname, options) => { |
||||
|
wordbox.newapp(appname, options) |
||||
|
}); |
||||
|
|
||||
|
program.command('-h, --help') |
||||
|
.description('Show w-cli help') |
||||
|
.action(() => console.log('Show w-cli help')); |
||||
|
|
||||
|
program.parse(process.argv); |
||||
|
@ -0,0 +1,27 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
const fs = require('fs'); |
||||
|
const normalize = require('path').normalize; |
||||
|
|
||||
|
const axios = require('axios'); |
||||
|
|
||||
|
const extract = require('../utils/extract'); |
||||
|
|
||||
|
const newapp = async (appname, options) => { |
||||
|
console.log(`Spinning up a new WordBox app at ${appname}...`); |
||||
|
|
||||
|
//const stream = fs.createWriteStream;
|
||||
|
// const stream = normalize(process.cwd() + '/temp.zip');
|
||||
|
// console.log(stream)
|
||||
|
// const responseStream = await axios({
|
||||
|
// method: 'get',
|
||||
|
// url: 'https://github.com/codefeathers/up-serve/archive/master.zip',
|
||||
|
// responseType: 'stream'
|
||||
|
// })
|
||||
|
// await responseStream.data.pipe(fs.createWriteStream(stream))
|
||||
|
// const extractResponse = await extract(stream, normalize(process.cwd() + '/' + appname))
|
||||
|
// console.log(extractResponse)
|
||||
|
// fs.unlink(stream, (err, res) => console.log(err, res))
|
||||
|
}; |
||||
|
|
||||
|
module.exports.newapp = newapp; |
@ -0,0 +1,67 @@ |
|||||
|
{ |
||||
|
"name": "w", |
||||
|
"version": "1.0.2", |
||||
|
"lockfileVersion": 1, |
||||
|
"requires": true, |
||||
|
"dependencies": { |
||||
|
"axios": { |
||||
|
"version": "0.17.1", |
||||
|
"resolved": "https://registry.npmjs.org/axios/-/axios-0.17.1.tgz", |
||||
|
"integrity": "sha1-LY4+XQvb1zJ/kbyBT1xXZg+Bgk0=", |
||||
|
"requires": { |
||||
|
"follow-redirects": "1.4.1", |
||||
|
"is-buffer": "1.1.6" |
||||
|
} |
||||
|
}, |
||||
|
"commander": { |
||||
|
"version": "2.13.0", |
||||
|
"resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", |
||||
|
"integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==" |
||||
|
}, |
||||
|
"debug": { |
||||
|
"version": "3.1.0", |
||||
|
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", |
||||
|
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", |
||||
|
"requires": { |
||||
|
"ms": "2.0.0" |
||||
|
} |
||||
|
}, |
||||
|
"follow-redirects": { |
||||
|
"version": "1.4.1", |
||||
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.4.1.tgz", |
||||
|
"integrity": "sha512-uxYePVPogtya1ktGnAAXOacnbIuRMB4dkvqeNz2qTtTQsuzSfbDolV+wMMKxAmCx0bLgAKLbBOkjItMbbkR1vg==", |
||||
|
"requires": { |
||||
|
"debug": "3.1.0" |
||||
|
} |
||||
|
}, |
||||
|
"is-buffer": { |
||||
|
"version": "1.1.6", |
||||
|
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", |
||||
|
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" |
||||
|
}, |
||||
|
"ms": { |
||||
|
"version": "2.0.0", |
||||
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", |
||||
|
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" |
||||
|
}, |
||||
|
"node-7z": { |
||||
|
"version": "0.4.0", |
||||
|
"resolved": "https://registry.npmjs.org/node-7z/-/node-7z-0.4.0.tgz", |
||||
|
"integrity": "sha1-OQEkxYAYPKvTiNE38wsjm0S9Wag=", |
||||
|
"requires": { |
||||
|
"when": "3.7.8", |
||||
|
"win-spawn": "2.0.0" |
||||
|
} |
||||
|
}, |
||||
|
"when": { |
||||
|
"version": "3.7.8", |
||||
|
"resolved": "https://registry.npmjs.org/when/-/when-3.7.8.tgz", |
||||
|
"integrity": "sha1-xxMLan6gRpPoQs3J56Hyqjmjn4I=" |
||||
|
}, |
||||
|
"win-spawn": { |
||||
|
"version": "2.0.0", |
||||
|
"resolved": "https://registry.npmjs.org/win-spawn/-/win-spawn-2.0.0.tgz", |
||||
|
"integrity": "sha1-OXopEw7JjQqgvIa6pGITk+/9Cwc=" |
||||
|
} |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue