ci: support pnpm
切换到pnpm作为管理工具 BREAKING CHANGE: support pnpm
This commit is contained in:
parent
e04e2a1973
commit
29d1705da5
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,10 +1,11 @@
|
|||||||
node_modules
|
**/node_modules/
|
||||||
|
|
||||||
docs/.vuepress/.cache
|
docs/.vuepress/.cache
|
||||||
docs/.vuepress/.temp
|
docs/.vuepress/.temp
|
||||||
docs/.vuepress/dist
|
docs/.vuepress/dist
|
||||||
|
|
||||||
lib
|
lib/
|
||||||
|
dist/
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
|||||||
17
.vscode/launch.json
vendored
Normal file
17
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "docs:dev",
|
||||||
|
"type": "node-terminal",
|
||||||
|
"request": "launch",
|
||||||
|
"command": "pnpm run docs"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "docs:build",
|
||||||
|
"type": "node-terminal",
|
||||||
|
"request": "launch",
|
||||||
|
"command": "pnpm docs:build"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
19
.vscode/settings.json
vendored
19
.vscode/settings.json
vendored
@ -17,13 +17,16 @@
|
|||||||
"vue"
|
"vue"
|
||||||
],
|
],
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"caniuse",
|
"bumpp",
|
||||||
"composables",
|
"caniuse",
|
||||||
"Docsearch",
|
"commitlint",
|
||||||
"nprogress",
|
"composables",
|
||||||
"tsbuildinfo",
|
"Docsearch",
|
||||||
"vite",
|
"nprogress",
|
||||||
"vuepress",
|
"pnpm",
|
||||||
"vueuse"
|
"tsbuildinfo",
|
||||||
|
"vite",
|
||||||
|
"vuepress",
|
||||||
|
"vueuse"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import { themePlume } from '@vuepress-plume/vuepress-theme-plume'
|
import { themePlume } from '@vuepress-plume/vuepress-theme-plume'
|
||||||
|
import { viteBundler } from '@vuepress/bundler-vite'
|
||||||
|
import { webpackBundler } from '@vuepress/bundler-webpack'
|
||||||
import { defineUserConfig } from '@vuepress/cli'
|
import { defineUserConfig } from '@vuepress/cli'
|
||||||
|
|
||||||
export default defineUserConfig({
|
export default defineUserConfig({
|
||||||
@ -8,6 +10,10 @@ export default defineUserConfig({
|
|||||||
title: 'Plume Theme',
|
title: 'Plume Theme',
|
||||||
description: '',
|
description: '',
|
||||||
public: path.resolve(__dirname, 'public'),
|
public: path.resolve(__dirname, 'public'),
|
||||||
|
|
||||||
|
bundler:
|
||||||
|
process.env.DOCS_BUNDLER === 'webpack' ? webpackBundler() : viteBundler(),
|
||||||
|
|
||||||
theme: themePlume({
|
theme: themePlume({
|
||||||
logo: 'https://pengzhanbo.cn/g.gif',
|
logo: 'https://pengzhanbo.cn/g.gif',
|
||||||
hostname: 'https://pengzhanbo.cn',
|
hostname: 'https://pengzhanbo.cn',
|
||||||
|
|||||||
21
docs/package.json
Normal file
21
docs/package.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"name": "docs",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"docs:build": "vuepress . build --clean-cache",
|
||||||
|
"docs:clean": "rimraf . .vuepress/.temp .vuepress/.cache .vuepress/dist",
|
||||||
|
"docs:dev": "vuepress dev --clean-cache",
|
||||||
|
"docs:serve": "anywhere -s -h localhost -d .vuepress/dist"
|
||||||
|
},
|
||||||
|
"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",
|
||||||
|
"anywhere": "^1.5.0",
|
||||||
|
"sass-loader": "^12.6.0",
|
||||||
|
"vue": "^3.2.33"
|
||||||
|
}
|
||||||
|
}
|
||||||
14
lerna.json
14
lerna.json
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"useWorkspaces": true,
|
|
||||||
"npmClient": "yarn",
|
|
||||||
"version": "1.0.0-beta.26",
|
|
||||||
"command": {
|
|
||||||
"version": {
|
|
||||||
"allowBranch": "main",
|
|
||||||
"conventionalCommits": true,
|
|
||||||
"exact": true,
|
|
||||||
"ignoreChanges": ["**/*.md"],
|
|
||||||
"message": "build: publish %s"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
84
package.json
84
package.json
@ -1,30 +1,27 @@
|
|||||||
{
|
{
|
||||||
"name": "vuepress-theme-plume",
|
"name": "vuepress-theme-plume",
|
||||||
|
"version": "1.0.0.beta.26",
|
||||||
"private": true,
|
"private": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "pengzhanbo",
|
"author": "pengzhanbo",
|
||||||
"workspaces": [
|
|
||||||
"packages/*"
|
|
||||||
],
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "yarn build:package",
|
"build": "pnpm run build:package",
|
||||||
"build:package": "lerna run build --stream",
|
"build:package": "pnpm --filter=!vuepress-theme-plume run -r --stream build",
|
||||||
"commit": "cz",
|
"commit": "cz",
|
||||||
"dev": "concurrently \"yarn dev:package\" \"yarn docs:vite-serve\"",
|
"dev": "concurrently \"pnpm run dev:package\" \"pnpm run docs\"",
|
||||||
"dev:package": "lerna run dev --parallel",
|
"dev:package": "pnpm --filter=!vuepress-theme-plume --parallel dev",
|
||||||
"docs": "yarn docs:vite-serve",
|
"docs": "pnpm --filter=docs docs:dev",
|
||||||
"docs:clean": "rimraf docs/.vuepress/.cache docs/.vuepress/.temp docs/.vuepress/dist",
|
"docs:build": "pnpm --filter=docs docs:build",
|
||||||
"docs:vite-build": "vuepress-vite build docs",
|
"docs:clean": "pnpm --filter=docs docs:clean",
|
||||||
"docs:vite-serve": "vuepress-vite dev docs",
|
"docs:serve": "pnpm --filter=docs docs:serve",
|
||||||
"docs:webpack-build": "vuepress-webpack build docs",
|
|
||||||
"docs:webpack-serve": "vuepress-webpack dev docs",
|
|
||||||
"lerna": "lerna clean && lerna bootstrap",
|
|
||||||
"lerna:publish": "node scripts/release/index.mjs",
|
|
||||||
"lint": "eslint --ext .js,.ts,.vue .",
|
"lint": "eslint --ext .js,.ts,.vue .",
|
||||||
"package:clean": "lerna run clean",
|
|
||||||
"package:update": "node scripts/dependencies.js",
|
"package:update": "node scripts/dependencies.js",
|
||||||
"prepare": "husky install",
|
"prepare": "husky install",
|
||||||
"release": "yarn lint && yarn build && lerna publish --registry https://registry.npmjs.org/"
|
"release": "pnpm release:check && pnpm release:version && pnpm release:publish",
|
||||||
|
"release:changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
|
||||||
|
"release:check": "pnpm lint && pnpm build",
|
||||||
|
"release:publish": "pnpm -r publish",
|
||||||
|
"release:version": "bumpp package.json packages/*/package.json --execute=\"pnpm release:changelog\" --commit \"build: publish v%s\" --all --tag --push"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.{js,ts,vue}": "eslint --fix",
|
"*.{js,ts,vue}": "eslint --fix",
|
||||||
@ -37,38 +34,51 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"prettier": "prettier-config-vuepress",
|
"prettier": "prettier-config-vuepress",
|
||||||
"dependencies": {
|
|
||||||
"@types/inquirer": "^8.2.1",
|
|
||||||
"@types/semver": "^7.3.9",
|
|
||||||
"chalk": "^5.0.1",
|
|
||||||
"execa": "^6.1.0",
|
|
||||||
"inquirer": "^8.2.2",
|
|
||||||
"ora": "^6.1.0",
|
|
||||||
"semver": "^7.3.5",
|
|
||||||
"sort-package-json": "^1.55.0",
|
|
||||||
"ts-node": "^10.7.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "^16.2.3",
|
"@commitlint/cli": "^16.2.3",
|
||||||
"@commitlint/config-conventional": "^16.2.1",
|
"@commitlint/config-conventional": "^16.2.1",
|
||||||
"@vuepress/cli": "^2.0.0-beta.41",
|
"@types/node": "^17.0.30",
|
||||||
|
"@types/webpack-env": "^1.16.4",
|
||||||
|
"bumpp": "^7.1.1",
|
||||||
|
"chalk": "^4.1.2",
|
||||||
"commitizen": "^4.2.4",
|
"commitizen": "^4.2.4",
|
||||||
"concurrently": "^7.0.0",
|
"concurrently": "^7.0.0",
|
||||||
|
"conventional-changelog-cli": "^2.2.2",
|
||||||
"cpx2": "^4.2.0",
|
"cpx2": "^4.2.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"cz-conventional-changelog": "^3.3.0",
|
"cz-conventional-changelog": "^3.3.0",
|
||||||
"eslint": "^8.13.0",
|
"eslint": "^8.14.0",
|
||||||
"eslint-config-vuepress": "^3.5.0",
|
"eslint-config-vuepress": "^3.7.1",
|
||||||
"eslint-config-vuepress-typescript": "^2.6.0",
|
"eslint-config-vuepress-typescript": "^2.7.1",
|
||||||
|
"execa": "^5.1.1",
|
||||||
"husky": "^7.0.4",
|
"husky": "^7.0.4",
|
||||||
"lerna": "^4.0.0",
|
|
||||||
"lint-staged": "^12.4.0",
|
"lint-staged": "^12.4.0",
|
||||||
"prettier": "^2.6.1",
|
"ora": "^5.4.1",
|
||||||
|
"prettier": "^2.6.2",
|
||||||
"prettier-config-vuepress": "^1.4.0",
|
"prettier-config-vuepress": "^1.4.0",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
|
"sort-package-json": "^1.55.0",
|
||||||
"typescript": "^4.6.3",
|
"typescript": "^4.6.3",
|
||||||
"vuepress-vite": "^2.0.0-beta.41",
|
"vite": "^2.9.6"
|
||||||
"vuepress-webpack": "^2.0.0-beta.41",
|
},
|
||||||
"webpack-env": "^0.8.0"
|
"engines": {
|
||||||
|
"node": ">=14",
|
||||||
|
"pnpm": ">=6"
|
||||||
|
},
|
||||||
|
"pnpm": {
|
||||||
|
"peerDependencyRules": {
|
||||||
|
"ignoreMissing": [
|
||||||
|
"@algolia/client-search",
|
||||||
|
"eslint-plugin-import",
|
||||||
|
"eslint-plugin-n",
|
||||||
|
"eslint-plugin-promise",
|
||||||
|
"react",
|
||||||
|
"react-dom",
|
||||||
|
"webpack",
|
||||||
|
"cypress",
|
||||||
|
"postcss",
|
||||||
|
"jest"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,9 +17,9 @@
|
|||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "yarn clean && yarn ts",
|
"build": "pnpm run clean && pnpm run ts",
|
||||||
"clean": "rimraf lib *.tsbuildinfo",
|
"clean": "rimraf lib *.tsbuildinfo",
|
||||||
"dev": "yarn ts:watch",
|
"dev": "pnpm run ts:watch",
|
||||||
"ts": "tsc -b tsconfig.build.json",
|
"ts": "tsc -b tsconfig.build.json",
|
||||||
"ts:watch": "tsc -b tsconfig.build.json --watch"
|
"ts:watch": "tsc -b tsconfig.build.json --watch"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -15,9 +15,13 @@ export const readFileList = (
|
|||||||
const filepath = path.join(sourceDir, file)
|
const filepath = path.join(sourceDir, file)
|
||||||
const stat = fs.statSync(filepath)
|
const stat = fs.statSync(filepath)
|
||||||
if (stat.isDirectory()) {
|
if (stat.isDirectory()) {
|
||||||
if (file !== '.vuepress') readFileList(filepath, fileList)
|
if (file !== '.vuepress' && file !== 'node_modules')
|
||||||
|
readFileList(filepath, fileList)
|
||||||
} else {
|
} else {
|
||||||
fileList.push(readFile(filepath, stat))
|
const extname = path.extname(file)
|
||||||
|
if (extname === '.md' || extname === '.MD') {
|
||||||
|
fileList.push(readFile(filepath, stat))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return fileList
|
return fileList
|
||||||
|
|||||||
8466
pnpm-lock.yaml
generated
Normal file
8466
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
3
pnpm-workspace.yaml
Normal file
3
pnpm-workspace.yaml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
packages:
|
||||||
|
- docs
|
||||||
|
- packages/*
|
||||||
@ -1,6 +0,0 @@
|
|||||||
import { release } from './release.mjs'
|
|
||||||
|
|
||||||
release().catch((err) => {
|
|
||||||
console.error(err)
|
|
||||||
process.exit(1)
|
|
||||||
})
|
|
||||||
@ -1,101 +0,0 @@
|
|||||||
import chalk from 'chalk'
|
|
||||||
import inquirer from 'inquirer'
|
|
||||||
import inc from 'semver/functions/inc.js'
|
|
||||||
import { getNpmTags, getVersion, versions } from './version.mjs'
|
|
||||||
import { execa } from 'execa'
|
|
||||||
import ora from 'ora'
|
|
||||||
import fs from 'fs'
|
|
||||||
import path from 'path'
|
|
||||||
|
|
||||||
const { green, red } = chalk
|
|
||||||
const { prompt } = inquirer
|
|
||||||
|
|
||||||
const lerna = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'lerna.json')))
|
|
||||||
const { version: currentVersion } = lerna
|
|
||||||
|
|
||||||
export const release = async () => {
|
|
||||||
const buildSpinner = ora('Building project').start()
|
|
||||||
await execa('yarn', ['run', 'lint'])
|
|
||||||
await execa('yarn', ['run', 'build'])
|
|
||||||
|
|
||||||
buildSpinner.succeed()
|
|
||||||
|
|
||||||
ora(`Current version: ${green(currentVersion)}`).info()
|
|
||||||
|
|
||||||
const bumps = [
|
|
||||||
'prerelease',
|
|
||||||
'patch',
|
|
||||||
'minor',
|
|
||||||
'major',
|
|
||||||
'premajor',
|
|
||||||
]
|
|
||||||
|
|
||||||
bumps.forEach((bump) => {
|
|
||||||
versions[bump] = inc(currentVersion, bump)
|
|
||||||
})
|
|
||||||
|
|
||||||
const bumpChoices = bumps.map((bump) => ({
|
|
||||||
name: `${bump} (${versions[bump]})`,
|
|
||||||
value: bump,
|
|
||||||
}))
|
|
||||||
|
|
||||||
const { bump, customVersion, npmTag } = await prompt([
|
|
||||||
{
|
|
||||||
name: 'bump',
|
|
||||||
message: 'Select release type:',
|
|
||||||
type: 'list',
|
|
||||||
choices: [...bumpChoices, { name: 'custom', value: 'custom' }],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'customVersion',
|
|
||||||
message: 'Input version:',
|
|
||||||
type: 'input',
|
|
||||||
when: (answers) => answers.bump === 'custom',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'npmTag',
|
|
||||||
message: 'Input npm tag:',
|
|
||||||
type: 'list',
|
|
||||||
default: answers => getNpmTags(getVersion(answers))[0],
|
|
||||||
choices: answers => getNpmTags(getVersion(answers)),
|
|
||||||
},
|
|
||||||
])
|
|
||||||
|
|
||||||
const version = customVersion || versions[bump]
|
|
||||||
|
|
||||||
const { confirm } = await prompt([
|
|
||||||
{
|
|
||||||
name: 'confirm',
|
|
||||||
message: `Confirm releasing ${version} (${npmTag})?`,
|
|
||||||
type: 'list',
|
|
||||||
choices: ['N', 'Y'],
|
|
||||||
},
|
|
||||||
])
|
|
||||||
|
|
||||||
if (confirm === 'N') {
|
|
||||||
ora(red('Release canceled.')).fail()
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const releaseArguments = [
|
|
||||||
'publish',
|
|
||||||
version,
|
|
||||||
'--dist-tag',
|
|
||||||
npmTag,
|
|
||||||
'--registry',
|
|
||||||
'https://registry.npmjs.org/',
|
|
||||||
]
|
|
||||||
const lerna = await import('lerna/cli.js')
|
|
||||||
await execa(lerna, releaseArguments, {
|
|
||||||
stdio: 'inherit',
|
|
||||||
})
|
|
||||||
|
|
||||||
const npmmirrorSpinner = ora('Syncing npmmirror.com').start()
|
|
||||||
|
|
||||||
await sync()
|
|
||||||
|
|
||||||
npmmirrorSpinner.succeed()
|
|
||||||
|
|
||||||
ora('Release complete').succeed()
|
|
||||||
}
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
import { readdirSync } from 'fs'
|
|
||||||
import { get } from 'https'
|
|
||||||
import { resolve } from 'path'
|
|
||||||
|
|
||||||
const packages = readdirSync(resolve(__dirname, '../../packages'))
|
|
||||||
|
|
||||||
export const sync = () => {
|
|
||||||
const promises = packages.map(packageName => {
|
|
||||||
return import(`../../packages/${packageName}/package.json`)
|
|
||||||
.then(content =>
|
|
||||||
new Promise((resolve) => {
|
|
||||||
get(`https://npmmirror.com/sync/${content.name}`).on(
|
|
||||||
'finish',
|
|
||||||
() => resolve()
|
|
||||||
)
|
|
||||||
})
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
return Promise.all(promises)
|
|
||||||
}
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
|
|
||||||
import prerelease from 'semver/functions/prerelease.js'
|
|
||||||
|
|
||||||
|
|
||||||
export const versions = {}
|
|
||||||
|
|
||||||
export const getVersion = answers =>
|
|
||||||
answers.customVersion || versions[answers.bump]
|
|
||||||
|
|
||||||
export const isPreRelease = version =>
|
|
||||||
Boolean(prerelease(version))
|
|
||||||
|
|
||||||
export const getNpmTags = version => {
|
|
||||||
if (isPreRelease(version)) return ['next', 'alpha', 'beta', 'latest']
|
|
||||||
|
|
||||||
return ['latest', 'beta', 'alpha', 'next']
|
|
||||||
}
|
|
||||||
@ -10,7 +10,7 @@
|
|||||||
"@vuepress-plume/vuepress-*": ["./packages/*/src"],
|
"@vuepress-plume/vuepress-*": ["./packages/*/src"],
|
||||||
"@vuepress-plume/vuepress-theme-plume": ["./packages/theme/src"]
|
"@vuepress-plume/vuepress-theme-plume": ["./packages/theme/src"]
|
||||||
},
|
},
|
||||||
"types": ["webpack-env", "vite/client", "@vuepress/client/types"]
|
"types": ["webpack-env", "vite/client"]
|
||||||
},
|
},
|
||||||
"vueCompilerOptions": {
|
"vueCompilerOptions": {
|
||||||
"experimentalDisableTemplateSupport": true
|
"experimentalDisableTemplateSupport": true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user