mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
ci: add autoInstall
添加更新vuepress相关依赖脚本
This commit is contained in:
parent
29d1705da5
commit
3fdc41ccb5
@ -9,11 +9,11 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@vuepress-plume/vuepress-theme-plume": "workspace:*",
|
||||
"@vuepress/bundler-vite": "^2.0.0-beta.41",
|
||||
"@vuepress/bundler-webpack": "^2.0.0-beta.41",
|
||||
"@vuepress/cli": "^2.0.0-beta.41",
|
||||
"@vuepress/client": "^2.0.0-beta.41",
|
||||
"@vuepress/utils": "^2.0.0-beta.41",
|
||||
"@vuepress/bundler-vite": "2.0.0-beta.41",
|
||||
"@vuepress/bundler-webpack": "2.0.0-beta.41",
|
||||
"@vuepress/cli": "2.0.0-beta.41",
|
||||
"@vuepress/client": "2.0.0-beta.41",
|
||||
"@vuepress/utils": "2.0.0-beta.41",
|
||||
"anywhere": "^1.5.0",
|
||||
"sass-loader": "^12.6.0",
|
||||
"vue": "^3.2.33"
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
"license": "MIT",
|
||||
"author": "pengzhanbo",
|
||||
"scripts": {
|
||||
"autoUpdate": "node scripts/autoInstall.js",
|
||||
"build": "pnpm run build:package",
|
||||
"build:package": "pnpm --filter=!vuepress-theme-plume run -r --stream build",
|
||||
"commit": "cz",
|
||||
@ -15,7 +16,6 @@
|
||||
"docs:clean": "pnpm --filter=docs docs:clean",
|
||||
"docs:serve": "pnpm --filter=docs docs:serve",
|
||||
"lint": "eslint --ext .js,.ts,.vue .",
|
||||
"package:update": "node scripts/dependencies.js",
|
||||
"prepare": "husky install",
|
||||
"release": "pnpm release:check && pnpm release:version && pnpm release:publish",
|
||||
"release:changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
|
||||
|
||||
@ -24,10 +24,10 @@
|
||||
"ts:watch": "tsc -b tsconfig.build.json --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vuepress/cli": "^2.0.0-beta.41",
|
||||
"@vuepress/client": "^2.0.0-beta.41",
|
||||
"@vuepress/core": "^2.0.0-beta.41",
|
||||
"@vuepress/utils": "^2.0.0-beta.41",
|
||||
"@vuepress/cli": "2.0.0-beta.41",
|
||||
"@vuepress/client": "2.0.0-beta.41",
|
||||
"@vuepress/core": "2.0.0-beta.41",
|
||||
"@vuepress/utils": "2.0.0-beta.41",
|
||||
"markdown-it-container": "^3.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
||||
@ -29,21 +29,21 @@
|
||||
"dependencies": {
|
||||
"@types/lodash.merge": "^4.6.6",
|
||||
"@vuepress-plume/vuepress-plugin-caniuse": "1.0.0-beta.8",
|
||||
"@vuepress/client": "^2.0.0-beta.41",
|
||||
"@vuepress/core": "^2.0.0-beta.41",
|
||||
"@vuepress/plugin-active-header-links": "^2.0.0-beta.41",
|
||||
"@vuepress/plugin-container": "^2.0.0-beta.41",
|
||||
"@vuepress/plugin-docsearch": "^2.0.0-beta.41",
|
||||
"@vuepress/plugin-external-link-icon": "^2.0.0-beta.41",
|
||||
"@vuepress/plugin-medium-zoom": "^2.0.0-beta.41",
|
||||
"@vuepress/plugin-nprogress": "^2.0.0-beta.41",
|
||||
"@vuepress/plugin-palette": "^2.0.0-beta.41",
|
||||
"@vuepress/plugin-prismjs": "^2.0.0-beta.41",
|
||||
"@vuepress/plugin-search": "^2.0.0-beta.41",
|
||||
"@vuepress/plugin-theme-data": "^2.0.0-beta.41",
|
||||
"@vuepress/plugin-toc": "^2.0.0-beta.41",
|
||||
"@vuepress/shared": "^2.0.0-beta.41",
|
||||
"@vuepress/utils": "^2.0.0-beta.41",
|
||||
"@vuepress/client": "2.0.0-beta.41",
|
||||
"@vuepress/core": "2.0.0-beta.41",
|
||||
"@vuepress/plugin-active-header-links": "2.0.0-beta.41",
|
||||
"@vuepress/plugin-container": "2.0.0-beta.41",
|
||||
"@vuepress/plugin-docsearch": "2.0.0-beta.41",
|
||||
"@vuepress/plugin-external-link-icon": "2.0.0-beta.41",
|
||||
"@vuepress/plugin-medium-zoom": "2.0.0-beta.41",
|
||||
"@vuepress/plugin-nprogress": "2.0.0-beta.41",
|
||||
"@vuepress/plugin-palette": "2.0.0-beta.41",
|
||||
"@vuepress/plugin-prismjs": "2.0.0-beta.41",
|
||||
"@vuepress/plugin-search": "2.0.0-beta.41",
|
||||
"@vuepress/plugin-theme-data": "2.0.0-beta.41",
|
||||
"@vuepress/plugin-toc": "2.0.0-beta.41",
|
||||
"@vuepress/shared": "2.0.0-beta.41",
|
||||
"@vuepress/utils": "2.0.0-beta.41",
|
||||
"@vueuse/core": "^8.2.3",
|
||||
"chokidar": "^3.5.3",
|
||||
"date-fns": "^2.28.0",
|
||||
@ -55,12 +55,12 @@
|
||||
"sass-loader": "^12.6.0",
|
||||
"vue": "^3.2.33",
|
||||
"vue-router": "^4.0.14",
|
||||
"vuepress-plugin-comment2": "^2.0.0-beta.47",
|
||||
"vuepress-plugin-copy-code2": "^2.0.0-beta.47",
|
||||
"vuepress-plugin-md-enhance": "^2.0.0-beta.47",
|
||||
"vuepress-plugin-reading-time2": "^2.0.0-beta.47",
|
||||
"vuepress-plugin-seo2": "^2.0.0-beta.47",
|
||||
"vuepress-plugin-sitemap2": "^2.0.0-beta.47"
|
||||
"vuepress-plugin-comment2": "2.0.0-beta.47",
|
||||
"vuepress-plugin-copy-code2": "2.0.0-beta.47",
|
||||
"vuepress-plugin-md-enhance": "2.0.0-beta.47",
|
||||
"vuepress-plugin-reading-time2": "2.0.0-beta.47",
|
||||
"vuepress-plugin-seo2": "2.0.0-beta.47",
|
||||
"vuepress-plugin-sitemap2": "2.0.0-beta.47"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"sass-loader": "^12.6.0"
|
||||
|
||||
60
pnpm-lock.yaml
generated
60
pnpm-lock.yaml
generated
@ -59,11 +59,11 @@ importers:
|
||||
docs:
|
||||
specifiers:
|
||||
'@vuepress-plume/vuepress-theme-plume': workspace:*
|
||||
'@vuepress/bundler-vite': ^2.0.0-beta.41
|
||||
'@vuepress/bundler-webpack': ^2.0.0-beta.41
|
||||
'@vuepress/cli': ^2.0.0-beta.41
|
||||
'@vuepress/client': ^2.0.0-beta.41
|
||||
'@vuepress/utils': ^2.0.0-beta.41
|
||||
'@vuepress/bundler-vite': 2.0.0-beta.41
|
||||
'@vuepress/bundler-webpack': 2.0.0-beta.41
|
||||
'@vuepress/cli': 2.0.0-beta.41
|
||||
'@vuepress/client': 2.0.0-beta.41
|
||||
'@vuepress/utils': 2.0.0-beta.41
|
||||
anywhere: ^1.5.0
|
||||
sass-loader: ^12.6.0
|
||||
vue: ^3.2.33
|
||||
@ -80,10 +80,10 @@ importers:
|
||||
|
||||
packages/plugin-caniuse:
|
||||
specifiers:
|
||||
'@vuepress/cli': ^2.0.0-beta.41
|
||||
'@vuepress/client': ^2.0.0-beta.41
|
||||
'@vuepress/core': ^2.0.0-beta.41
|
||||
'@vuepress/utils': ^2.0.0-beta.41
|
||||
'@vuepress/cli': 2.0.0-beta.41
|
||||
'@vuepress/client': 2.0.0-beta.41
|
||||
'@vuepress/core': 2.0.0-beta.41
|
||||
'@vuepress/utils': 2.0.0-beta.41
|
||||
markdown-it-container: ^3.0.0
|
||||
dependencies:
|
||||
'@vuepress/cli': 2.0.0-beta.41
|
||||
@ -96,21 +96,21 @@ importers:
|
||||
specifiers:
|
||||
'@types/lodash.merge': ^4.6.6
|
||||
'@vuepress-plume/vuepress-plugin-caniuse': 1.0.0-beta.8
|
||||
'@vuepress/client': ^2.0.0-beta.41
|
||||
'@vuepress/core': ^2.0.0-beta.41
|
||||
'@vuepress/plugin-active-header-links': ^2.0.0-beta.41
|
||||
'@vuepress/plugin-container': ^2.0.0-beta.41
|
||||
'@vuepress/plugin-docsearch': ^2.0.0-beta.41
|
||||
'@vuepress/plugin-external-link-icon': ^2.0.0-beta.41
|
||||
'@vuepress/plugin-medium-zoom': ^2.0.0-beta.41
|
||||
'@vuepress/plugin-nprogress': ^2.0.0-beta.41
|
||||
'@vuepress/plugin-palette': ^2.0.0-beta.41
|
||||
'@vuepress/plugin-prismjs': ^2.0.0-beta.41
|
||||
'@vuepress/plugin-search': ^2.0.0-beta.41
|
||||
'@vuepress/plugin-theme-data': ^2.0.0-beta.41
|
||||
'@vuepress/plugin-toc': ^2.0.0-beta.41
|
||||
'@vuepress/shared': ^2.0.0-beta.41
|
||||
'@vuepress/utils': ^2.0.0-beta.41
|
||||
'@vuepress/client': 2.0.0-beta.41
|
||||
'@vuepress/core': 2.0.0-beta.41
|
||||
'@vuepress/plugin-active-header-links': 2.0.0-beta.41
|
||||
'@vuepress/plugin-container': 2.0.0-beta.41
|
||||
'@vuepress/plugin-docsearch': 2.0.0-beta.41
|
||||
'@vuepress/plugin-external-link-icon': 2.0.0-beta.41
|
||||
'@vuepress/plugin-medium-zoom': 2.0.0-beta.41
|
||||
'@vuepress/plugin-nprogress': 2.0.0-beta.41
|
||||
'@vuepress/plugin-palette': 2.0.0-beta.41
|
||||
'@vuepress/plugin-prismjs': 2.0.0-beta.41
|
||||
'@vuepress/plugin-search': 2.0.0-beta.41
|
||||
'@vuepress/plugin-theme-data': 2.0.0-beta.41
|
||||
'@vuepress/plugin-toc': 2.0.0-beta.41
|
||||
'@vuepress/shared': 2.0.0-beta.41
|
||||
'@vuepress/utils': 2.0.0-beta.41
|
||||
'@vueuse/core': ^8.2.3
|
||||
chokidar: ^3.5.3
|
||||
date-fns: ^2.28.0
|
||||
@ -122,12 +122,12 @@ importers:
|
||||
sass-loader: ^12.6.0
|
||||
vue: ^3.2.33
|
||||
vue-router: ^4.0.14
|
||||
vuepress-plugin-comment2: ^2.0.0-beta.47
|
||||
vuepress-plugin-copy-code2: ^2.0.0-beta.47
|
||||
vuepress-plugin-md-enhance: ^2.0.0-beta.47
|
||||
vuepress-plugin-reading-time2: ^2.0.0-beta.47
|
||||
vuepress-plugin-seo2: ^2.0.0-beta.47
|
||||
vuepress-plugin-sitemap2: ^2.0.0-beta.47
|
||||
vuepress-plugin-comment2: 2.0.0-beta.47
|
||||
vuepress-plugin-copy-code2: 2.0.0-beta.47
|
||||
vuepress-plugin-md-enhance: 2.0.0-beta.47
|
||||
vuepress-plugin-reading-time2: 2.0.0-beta.47
|
||||
vuepress-plugin-seo2: 2.0.0-beta.47
|
||||
vuepress-plugin-sitemap2: 2.0.0-beta.47
|
||||
dependencies:
|
||||
'@types/lodash.merge': 4.6.7
|
||||
'@vuepress-plume/vuepress-plugin-caniuse': link:../plugin-caniuse
|
||||
|
||||
@ -1,17 +1,19 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import { execa } from 'execa'
|
||||
import ora from 'ora'
|
||||
import chalk from 'chalk'
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const execa = require('execa')
|
||||
const ora = require('ora')
|
||||
const chalk = require('chalk')
|
||||
|
||||
const packages = fs.readdirSync(new URL('../packages', import.meta.url))
|
||||
const packages = [
|
||||
...fs.readdirSync(path.join(__dirname, '../packages')).map(dir => path.join('../packages', dir)),
|
||||
'../docs'
|
||||
]
|
||||
|
||||
const dependencies = packages.map(dir => {
|
||||
const dirname = new URL(path.join('../packages', dir), import.meta.url)
|
||||
const pkg = fs.readFileSync(path.join(dirname.pathname, 'package.json'))
|
||||
const pkg = fs.readFileSync(path.join(__dirname, dir, 'package.json'))
|
||||
const { dependencies, devDependencies } = JSON.parse(pkg)
|
||||
return {
|
||||
dirname: dirname.pathname,
|
||||
dirname: path.join(__dirname, dir),
|
||||
dependencies: filterVuePress(Object.keys(dependencies || {})),
|
||||
devDependencies: filterVuePress(Object.keys(devDependencies || {}))
|
||||
}
|
||||
@ -31,28 +33,29 @@ function filterVuePress(dependencies) {
|
||||
const options = []
|
||||
dependencies.forEach(({ dirname, dependencies, devDependencies }) => {
|
||||
if (dependencies.length) {
|
||||
options.push(['yarn', ['add', ...dependencies], { cwd: dirname }])
|
||||
options.push(['pnpm', ['add', ...dependencies], { cwd: dirname }])
|
||||
}
|
||||
if (devDependencies.length) {
|
||||
options.push(['yarn', ['add', '-D', ...devDependencies], { cwd: dirname }])
|
||||
options.push(['pnpm', ['add', '-D', ...devDependencies], { cwd: dirname }])
|
||||
}
|
||||
})
|
||||
|
||||
async function install(index = 0) {
|
||||
if (index >= options.length) return
|
||||
const spinner = ora()
|
||||
const opt = options[index]
|
||||
console.log(chalk.cyan(opt[2].cwd.split('/').slice(-2).join('/')));
|
||||
const dir = opt[2].cwd.split('/').slice(-2).join('/')
|
||||
console.log('Installing ', chalk.cyan(dir));
|
||||
console.log(chalk.gray(opt[0], opt[1].join(' ')));
|
||||
console.log('\n');
|
||||
const spinner = ora('installing').start()
|
||||
const current = execa(opt[0], opt[1], opt[2])
|
||||
current.stdout.pipe(process.stdout)
|
||||
try {
|
||||
await current;
|
||||
spinner.succeed()
|
||||
spinner.succeed('Installed.')
|
||||
await install(index + 1)
|
||||
} catch(e) {
|
||||
spinner.fail()
|
||||
spinner.fail('Install Fail.')
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user