diff --git a/package.json b/package.json index 7760dbbf..09157a75 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "scripts": { "bootstrap": "lerna bootstrap && yarn tsc", "boot": "node scripts/bootstrap.js", + "remote-version": "node scripts/remote-version.js", "dev": "yarn tsc && yarn workspace docs dev", "build": "yarn tsc && yarn workspace docs build", "show-help": "yarn workspace docs show-help", diff --git a/scripts/remote-version.js b/scripts/remote-version.js new file mode 100644 index 00000000..5ef2b1a8 --- /dev/null +++ b/scripts/remote-version.js @@ -0,0 +1,21 @@ +const { join } = require('path') +const { readdirSync } = require('fs') +const chalk = require('chalk') +const execa = require('execa') + +const PRIVATE_PACKAGES = ['theme-vue', 'theme-blog', '.DS_Store'] + +const scopePackages = readdirSync( + join(__dirname, '../packages/@vuepress') +) + .filter(n => !PRIVATE_PACKAGES.includes(n)) + .map(n => `@vuepress/${n}`) + +async function log () { + await Promise.all(['vuepress', ...scopePackages].map(async pkg => { + const version = (await execa('npm', ['view', `${pkg}@next`, 'version'])).stdout.toString() + console.log(`${pkg}: ${chalk.cyan(version)}`) + })) +} + +log()