workflow: switch to pnpm (#401)

pull/421/head
Anthony Fu 3 years ago committed by GitHub
parent 4d4be24a7e
commit 49ddb1f120
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,15 +9,25 @@ jobs:
matrix: matrix:
node-version: [14, 16] node-version: [14, 16]
steps: steps:
- uses: actions/checkout@v1 - name: Checkout
- name: Use Node.js ${{ matrix.node-version }} uses: actions/checkout@v2
uses: actions/setup-node@v1
- name: Install pnpm
uses: pnpm/action-setup@v2.0.1
with:
version: 6.15.1
- name: Set node version to ${{ matrix.node_version }}
uses: actions/setup-node@v2
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node_version }}
- name: install and test cache: "pnpm"
run: |
yarn install - name: Install deps
yarn test run: pnpm install
- name: build
run: | - name: Build
yarn build run: pnpm run build
- name: Test
run: pnpm run test

@ -2,8 +2,11 @@
"private": true, "private": true,
"name": "vitepress-example-minimal", "name": "vitepress-example-minimal",
"scripts": { "scripts": {
"dev": "node ../../bin/vitepress dev", "dev": "vitepress dev",
"build": "node ../../bin/vitepress build", "build": "vitepress build",
"serve": "node ../../bin/vitepress serve" "serve": "vitepress serve"
},
"devDependencies": {
"vitepress": "workspace:*"
} }
} }

@ -0,0 +1,7 @@
[build.environment]
NODE_VERSION = "16"
NPM_FLAGS = "--version" # prevent Netlify npm install
[build]
publish = "docs/.vitepress/dist"
command = "npx pnpm i --store=node_modules/.pnpm-store && npm run ci-docs"

@ -13,20 +13,20 @@
"types" "types"
], ],
"scripts": { "scripts": {
"dev": "yarn dev-shared && yarn dev-start", "dev": "pnpm run dev-shared && pnpm run dev-start",
"dev-start": "run-p dev-client dev-node dev-watch", "dev-start": "run-p dev-client dev-node dev-watch",
"dev-client": "tsc -w -p src/client", "dev-client": "tsc -w -p src/client",
"dev-node": "tsc -w -p src/node", "dev-node": "tsc -w -p src/node",
"dev-shared": "node scripts/copyShared", "dev-shared": "node scripts/copyShared",
"dev-watch": "node scripts/watchAndCopy", "dev-watch": "node scripts/watchAndCopy",
"prebuild": "rimraf -rf dist && node scripts/copyShared", "build": "run-s build-prepare build-client build-node build-types",
"build": "run-s build-client build-node build-types", "build-prepare": "rimraf -rf dist && node scripts/copyShared",
"build-client": "tsc -p src/client && node scripts/copyClient", "build-client": "tsc -p src/client && node scripts/copyClient",
"build-node": "rollup -c scripts/rollup.config.js", "build-node": "rollup -c scripts/rollup.config.js",
"build-types": "run-s build-types-client build-types-node", "build-types": "run-s build-types-client build-types-node",
"build-types-client": "tsc -p src/client --declaration --emitDeclarationOnly --outDir dist/temp && api-extractor run -c api-extractor.client.json && rimraf dist/temp", "build-types-client": "tsc -p src/client --declaration --emitDeclarationOnly --outDir dist/temp && api-extractor run -c api-extractor.client.json && rimraf dist/temp",
"build-types-node": "tsc -p src/node --declaration --emitDeclarationOnly --outDir dist/temp && api-extractor run -c api-extractor.node.json && rimraf dist/temp", "build-types-node": "tsc -p src/node --declaration --emitDeclarationOnly --outDir dist/temp && api-extractor run -c api-extractor.node.json && rimraf dist/temp",
"lint": "yarn lint:js && yarn lint:ts", "lint": "pnpm run lint:js && pnpm run lint:ts",
"lint:js": "prettier --check --write \"{bin,docs,scripts,src}/**/*.js\"", "lint:js": "prettier --check --write \"{bin,docs,scripts,src}/**/*.js\"",
"lint:ts": "prettier --check --write --parser typescript \"{__tests__,src,docs,types}/**/*.ts\"", "lint:ts": "prettier --check --write --parser typescript \"{__tests__,src,docs,types}/**/*.ts\"",
"test": "jest", "test": "jest",
@ -35,8 +35,9 @@
"docs": "run-p dev docs-dev", "docs": "run-p dev docs-dev",
"docs-dev": "node ./bin/vitepress dev docs", "docs-dev": "node ./bin/vitepress dev docs",
"docs-debug": "node --inspect-brk ./bin/vitepress dev docs", "docs-debug": "node --inspect-brk ./bin/vitepress dev docs",
"docs-build": "yarn build && node ./bin/vitepress build docs", "docs-build": "pnpm run build && node ./bin/vitepress build docs",
"docs-serve": "node ./bin/vitepress serve docs" "docs-serve": "node ./bin/vitepress serve docs",
"ci-docs": "run-s build docs-build"
}, },
"engines": { "engines": {
"node": ">=12.0.0" "node": ">=12.0.0"
@ -71,9 +72,10 @@
"@docsearch/css": "^1.0.0-alpha.28", "@docsearch/css": "^1.0.0-alpha.28",
"@docsearch/js": "^1.0.0-alpha.28", "@docsearch/js": "^1.0.0-alpha.28",
"@vitejs/plugin-vue": "^1.9.0", "@vitejs/plugin-vue": "^1.9.0",
"@vue/runtime-dom": "^3.2.18",
"prismjs": "^1.23.0",
"vite": "^2.5.0", "vite": "^2.5.0",
"vue": "^3.2.13", "vue": "^3.2.13"
"prismjs": "^1.23.0"
}, },
"devDependencies": { "devDependencies": {
"@microsoft/api-extractor": "^7.18.9", "@microsoft/api-extractor": "^7.18.9",
@ -117,6 +119,7 @@
"minimist": "^1.2.5", "minimist": "^1.2.5",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"ora": "^5.4.0", "ora": "^5.4.0",
"pnpm": "^6.15.1",
"polka": "^0.5.2", "polka": "^0.5.2",
"prettier": "^2.3.0", "prettier": "^2.3.0",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",

File diff suppressed because it is too large Load Diff

@ -0,0 +1,3 @@
packages:
- examples/*
- docs

@ -57,12 +57,12 @@ async function main() {
// Build the package. // Build the package.
step('\nBuilding the package...') step('\nBuilding the package...')
await run('yarn', ['build']) await run('pnpm', ['build'])
// Generate the changelog. // Generate the changelog.
step('\nGenerating the changelog...') step('\nGenerating the changelog...')
await run('yarn', ['changelog']) await run('pnpm', ['changelog'])
await run('yarn', ['prettier', '--write', 'CHANGELOG.md']) await run('pnpm', ['prettier', '--write', 'CHANGELOG.md'])
const { yes: changelogOk } = await prompt({ const { yes: changelogOk } = await prompt({
type: 'confirm', type: 'confirm',
@ -82,13 +82,7 @@ async function main() {
// Publish the package. // Publish the package.
step('\nPublishing the package...') step('\nPublishing the package...')
await run('yarn', [ await run('pnpm', ['publish', '--ignore-scripts', '--no-git-checks'])
'publish',
'--new-version',
targetVersion,
'--no-commit-hooks',
'--no-git-tag-version'
])
// Push to GitHub. // Push to GitHub.
step('\nPushing to GitHub...') step('\nPushing to GitHub...')

@ -12,7 +12,7 @@ import { preWrapperPlugin } from './plugins/preWrapper'
import { linkPlugin } from './plugins/link' import { linkPlugin } from './plugins/link'
import { extractHeaderPlugin } from './plugins/header' import { extractHeaderPlugin } from './plugins/header'
import { Header } from '../shared' import { Header } from '../shared'
import anchor, { AnchorOptions } from 'markdown-it-anchor' import anchor from 'markdown-it-anchor'
import attrs from 'markdown-it-attrs' import attrs from 'markdown-it-attrs'
import emoji from 'markdown-it-emoji' import emoji from 'markdown-it-emoji'
import toc from 'markdown-it-table-of-contents' import toc from 'markdown-it-table-of-contents'
@ -21,7 +21,7 @@ export interface MarkdownOptions extends MarkdownIt.Options {
lineNumbers?: boolean lineNumbers?: boolean
config?: (md: MarkdownIt) => void config?: (md: MarkdownIt) => void
anchor?: { anchor?: {
permalink?: AnchorOptions['permalink'] permalink?: anchor.AnchorOptions['permalink']
} }
attrs?: { attrs?: {
leftDelimiter?: string leftDelimiter?: string

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save