forked from dcloudio/uni-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(cli): add check-version.js dist-tag-latest.js
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const fs = require('fs') | ||
const path = require('path') | ||
|
||
const request = require('request') | ||
|
||
const registry = 'https://registry.npmjs.org/@dcloudio/' | ||
|
||
const pkgs = fs.readdirSync(path.resolve(__dirname, 'packages')) | ||
|
||
const tag = process.argv[2] || 'alpha' | ||
|
||
pkgs.forEach(pkg => { | ||
request(registry + pkg, function(error, response, body) { | ||
if (error) { | ||
console.log(pkg, error) | ||
} else { | ||
const version = JSON.parse(body)['dist-tags'][tag] | ||
console.log(pkg + ':' + (' '.repeat(80 - (pkg + ':' + version).length)) + version) | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const fs = require('fs') | ||
const path = require('path') | ||
const shellExec = require('shell-exec') | ||
|
||
const pkgs = fs.readdirSync(path.resolve(__dirname, 'packages')) | ||
|
||
const version = process.argv[2] | ||
if (!version) { | ||
throw new Error('必须传入 version') | ||
} | ||
|
||
(async function() { | ||
for (let i = 0; i < pkgs.length; i++) { | ||
console.log(`npm dist-tag add @dcloudio/${pkgs[i]}@${version} latest`); | ||
await shellExec(`npm dist-tag add @dcloudio/${pkgs[i]}@${version} latest`) | ||
} | ||
})(); |