Comparing version 0.0.5 to 0.0.6
#!/usr/bin/env node | ||
const commander = require('commander'); | ||
const fs = require("fs-extra"); | ||
const path = require("path"); | ||
const chalk = require('chalk'); | ||
const upload = require('./youzanyun-upload'); | ||
const save = require('./youzanyun-save'); | ||
const { promiseExec } = require('../src/utils/run'); | ||
const { logger } = require('../src/utils/logger'); | ||
const package = require('../package.json'); | ||
const checkVersion = require('../src/version'); | ||
commander | ||
.version(package.version) | ||
.usage('<command> [options]'); | ||
commander | ||
.command('upload') | ||
@@ -21,28 +22,7 @@ .action(upload); | ||
async function checkVersion () { | ||
try { | ||
const versions = await promiseExec('npm view youzanyun versions --json', { | ||
cwd: '', | ||
}); | ||
const versionList = JSON.parse(versions); | ||
const leatestVersion = versionList.pop(); | ||
const packagePath = path.resolve(__dirname, '../package.json'); | ||
const packageInfo = await fs.readFile(packagePath, "utf8"); | ||
const currentVersion = JSON.parse(packageInfo).version; | ||
if (currentVersion !== leatestVersion) { | ||
logger.warn('version update:'); | ||
console.log(' ┌---------------------------------------------┐') | ||
console.log(` ├ Update aviailable ${currentVersion} -> ` + chalk.blue(leatestVersion) + ' ┤') | ||
console.log(' ├ Run ' + chalk.yellow('npm i -g youzanyun') + ' to update ┤') | ||
console.log(' └---------------------------------------------┘') | ||
} | ||
commander.parse(process.argv); | ||
} catch (error) { | ||
console.log(error) | ||
checkVersion(() => { | ||
commander.parse(process.argv); | ||
if(commander.args.length==0){ | ||
commander.help(); | ||
} | ||
} | ||
checkVersion(); | ||
}); |
{ | ||
"name": "youzanyun", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "有赞云工具", | ||
@@ -18,2 +18,3 @@ "main": "./lib/index.js", | ||
"lodash": "^4.17.4", | ||
"ora": "^3.2.0", | ||
"path": "^0.12.7", | ||
@@ -20,0 +21,0 @@ "qiniu": "^7.2.1", |
@@ -50,9 +50,2 @@ const path = require("path"); | ||
/* const info = await promiseSpawm('git', ['remote', '-v'], { | ||
cwd: process.cwd(), | ||
}); | ||
console.log('info', info) | ||
const appNameArr = info.split('/').pop().split('.'); | ||
const appName = appNameArr.slice(0, appNameArr.length - 1).join('/'); | ||
console.log('appName', appName) */ | ||
const appName = getGitInfo().appName; | ||
@@ -59,0 +52,0 @@ |
16544
15
526
7
10
+ Addedora@^3.2.0
+ Addedcli-spinners@2.9.2(transitive)
+ Addedclone@1.0.4(transitive)
+ Addeddefaults@1.0.4(transitive)
+ Addedlog-symbols@2.2.0(transitive)
+ Addedora@3.4.0(transitive)
+ Addedwcwidth@1.0.1(transitive)