Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade to pnpm v7 #8041

Merged
merged 21 commits into from
May 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ jobs:
# node_version: 18
fail-fast: false

env:
# Install playwright's binray under node_modules so it will be cached together
PLAYWRIGHT_BROWSERS_PATH: "0"

name: "Build&Test: node-${{ matrix.node_version }}, ${{ matrix.os }}"
steps:
- name: Checkout
Expand All @@ -59,6 +63,9 @@ jobs:
- name: Install deps
run: pnpm install

- name: Install Playwright
run: pnpm playwright install

- name: Build vite
run: pnpm run ci-build-vite

Expand Down Expand Up @@ -97,6 +104,8 @@ jobs:

- name: Install deps
run: pnpm install
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1"

- name: Prepare
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:

- name: Install deps
run: pnpm install
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1"

- name: Publish package
run: pnpm run ci-publish -- ${{ github.ref_name }}
Expand Down
1 change: 0 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
hoist-pattern[]=*eslint*
hoist-pattern[]=*babel*
hoist-pattern[]=*jest*
hoist-pattern[]=@emotion/*
hoist-pattern[]=postcss
hoist-pattern[]=pug
Expand Down
8 changes: 5 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ To develop and test the core `vite` package:

You can alternatively use [Vite.js Docker Dev](https://github.com/nystudio107/vitejs-docker-dev) for a containerized Docker setup for Vite.js development.

> Vite uses pnpm v7. If you are working on multiple projects with different versions of pnpm, it's recommend to enable [Corepack](https://github.com/nodejs/corepack) by running `corepack enable`.

## Debugging

If you want to use break point and explore code execution you can use the ["Run and debug"](https://code.visualstudio.com/docs/editor/debugging) feature from vscode.
Expand All @@ -36,7 +38,7 @@ Some errors are masked and hidden away because of the layers of abstraction and

1. Add a `debugger` statement to the `playground/vitestSetup.ts` -> `afterAll` hook. This will pause execution before the tests quit and the Playwright browser instance exits.

1. Run the tests with the `debug-serve` script command which will enable remote debugging: `pnpm run debug-serve -- --runInBand resolve`.
1. Run the tests with the `debug-serve` script command which will enable remote debugging: `pnpm run debug-serve resolve`.

1. Wait for inspector devtools to open in your browser and the debugger to attach.

Expand Down Expand Up @@ -81,7 +83,7 @@ Each integration test can be run under either dev server mode or build mode.

- `pnpm run test-build` runs tests only under build mode.

- You can also use `pnpm run test-serve -- [match]` or `pnpm run test-build -- [match]` to run tests in a specific playground package, e.g. `pnpm run test-serve -- asset` will run tests for both `playground/asset` and `vite/src/node/__tests__/asset` under serve mode and `vite/src/node/__tests__/**/*` just run in serve mode.
- You can also use `pnpm run test-serve [match]` or `pnpm run test-build [match]` to run tests in a specific playground package, e.g. `pnpm run test-serve asset` will run tests for both `playground/asset` and `vite/src/node/__tests__/asset` under serve mode and `vite/src/node/__tests__/**/*` just run in serve mode.

Note package matching is not available for the `pnpm test` script, which always runs all tests.

Expand All @@ -91,7 +93,7 @@ Other than tests under `playground/` for integration tests, packages might conta

- `pnpm run test-unit` runs unit tests under each package.

- You can also use `pnpm run test-unit -- [match]` to run related tests.
- You can also use `pnpm run test-unit [match]` to run related tests.

### Test Env and Helpers

Expand Down
18 changes: 16 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,23 @@
"devDependencies": {
"@microsoft/api-extractor": "^7.23.1",
"@types/babel__core": "^7.1.19",
"@types/convert-source-map": "^1.5.2",
"@types/cross-spawn": "^6.0.2",
"@types/debug": "^4.1.7",
"@types/estree": "^0.0.51",
"@types/etag": "^1.8.1",
"@types/fs-extra": "^9.0.13",
"@types/hash-sum": "^1.0.0",
"@types/less": "^3.0.3",
"@types/micromatch": "^4.0.2",
"@types/mime": "^2.0.3",
"@types/node": "^17.0.31",
"@types/prompts": "^2.4.0",
"@types/resolve": "^1.20.2",
"@types/sass": "~1.43.1",
"@types/semver": "^7.3.9",
"@types/stylus": "^0.48.37",
"@types/ws": "^8.5.3",
"@typescript-eslint/eslint-plugin": "^5.22.0",
"@typescript-eslint/parser": "^5.22.0",
"conventional-changelog-cli": "^2.2.2",
Expand Down Expand Up @@ -71,7 +84,8 @@
"typescript": "^4.6.4",
"vite": "workspace:*",
"vitepress": "^0.22.4",
"vitest": "^0.12.4"
"vitest": "^0.12.4",
"vue": "^3.2.33"
},
"simple-git-hooks": {
"pre-commit": "pnpm exec lint-staged --concurrent false",
Expand All @@ -91,7 +105,7 @@
"eslint --fix"
]
},
"packageManager": "pnpm@6.32.11",
"packageManager": "pnpm@7.0.1",
antfu marked this conversation as resolved.
Show resolved Hide resolved
"pnpm": {
"overrides": {
"vite": "workspace:*",
Expand Down
1 change: 0 additions & 1 deletion packages/plugin-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
},
"devDependencies": {
"@rollup/pluginutils": "^4.2.1",
"@types/hash-sum": "^1.0.0",
"debug": "^4.3.4",
"hash-sum": "^2.0.0",
"rollup": "^2.72.1",
Expand Down
13 changes: 0 additions & 13 deletions packages/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,6 @@
"@rollup/plugin-node-resolve": "13.2.1",
"@rollup/plugin-typescript": "^8.3.2",
"@rollup/pluginutils": "^4.2.1",
"@types/convert-source-map": "^1.5.2",
"@types/cross-spawn": "^6.0.2",
"@types/debug": "^4.1.7",
"@types/estree": "^0.0.51",
"@types/etag": "^1.8.1",
"@types/less": "^3.0.3",
"@types/micromatch": "^4.0.2",
"@types/mime": "^2.0.3",
"@types/node": "^17.0.31",
"@types/resolve": "^1.20.2",
"@types/sass": "~1.43.1",
"@types/stylus": "^0.48.37",
"@types/ws": "^8.5.3",
"@vue/compiler-dom": "^3.2.33",
"acorn": "^8.7.1",
"cac": "6.7.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/__tests__/plugins/css.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('css path resolutions', () => {

const mockFs = vi
.spyOn(fs, 'readFile')
// @ts-ignore jest.spyOn not recognize overrided `fs.readFile` definition.
// @ts-ignore vi.spyOn not recognize override `fs.readFile` definition.
.mockImplementationOnce((p, encoding, callback) => {
expect(p).toBe(path.join(mockedProjectPath, mockedBarCssRelativePath))
expect(encoding).toBe('utf-8')
Expand Down
2 changes: 1 addition & 1 deletion playground/cli-module/__tests__/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { isWindows, ports, viteBinPath } from '~utils'
export const port = ports['cli-module']

export async function serve(root: string, isProd: boolean) {
// collect stdout and stderr streams from child processes here to avoid interfering with regular jest output
// collect stdout and stderr streams from child processes here to avoid interfering with regular vitest output
const streams = {
build: { out: [], err: [] },
server: { out: [], err: [] }
Expand Down
2 changes: 1 addition & 1 deletion playground/cli/__tests__/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { isWindows, ports, viteBinPath } from '~utils'
export const port = ports.cli

export async function serve(root: string, isProd: boolean) {
// collect stdout and stderr streams from child processes here to avoid interfering with regular jest output
// collect stdout and stderr streams from child processes here to avoid interfering with regular vitest output
const streams = {
build: { out: [], err: [] },
server: { out: [], err: [] }
Expand Down
2 changes: 1 addition & 1 deletion playground/ssr-react/__tests__/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function serve(root: string, isProd: boolean) {
// client build
await build({
root,
logLevel: 'silent', // exceptions are logged by Jest
logLevel: 'silent', // exceptions are logged by Vitest
build: {
target: 'esnext',
minify: false,
Expand Down
2 changes: 1 addition & 1 deletion playground/ssr-react/__tests__/ssr-react.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test('client navigation', async () => {
await untilUpdated(() => page.textContent('h1'), 'changed')
})

test(`circular dependecies modules doesn't throw`, async () => {
test(`circular dependencies modules doesn't throw`, async () => {
await page.goto(url)
expect(await page.textContent('.circ-dep-init')).toMatch(
'circ-dep-init-a circ-dep-init-b'
Expand Down
2 changes: 1 addition & 1 deletion playground/ssr-vue/__tests__/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function serve(root, isProd) {
// client build
await build({
root,
logLevel: 'silent', // exceptions are logged by Jest
logLevel: 'silent', // exceptions are logged by Vitest
build: {
target: 'esnext',
minify: false,
Expand Down
4 changes: 3 additions & 1 deletion playground/ssr-vue/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<router-link to="/about">About</router-link>
<router-view v-slot="{ Component }">
<Suspense>
<component :is="Component" />
<div>
<component :is="Component" />
</div>
</Suspense>
</router-view>
</div>
Expand Down
2 changes: 1 addition & 1 deletion playground/ssr-vue/src/pages/About.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default {
async setup() {
const url = import.meta.env.SSR
? import.meta.url
: document.querySelector('.import-meta-url').textContent
: document.querySelector('.import-meta-url')?.textContent
return {
msg: 'About',
url
Expand Down
4 changes: 2 additions & 2 deletions playground/ssr-vue/src/pages/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ function load(file) {
}
const url = import.meta.env.SSR
? import.meta.url
: document.querySelector('.import-meta-url').textContent
const protocol = new URL(url).protocol
: document.querySelector('.import-meta-url')?.textContent
const protocol = url ? new URL(url).protocol : undefined

const state = reactive({
count: 0,
Expand Down
1 change: 0 additions & 1 deletion playground/vitestSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ beforeAll(async (s) => {
// If the page remains open, a command like `await page.click(...)` produces
// a timeout with an exception that hides the real error in the console.
await page.close()

beforeAllError = e
}

Expand Down
Loading