Skip to content

Commit c2506cd

Browse files
authored
Merge branch 'vuejs:main' into main
2 parents 0a824b5 + 75b7c00 commit c2506cd

File tree

41 files changed

+1048
-796
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1048
-796
lines changed

.github/workflows/ci.yml

Lines changed: 100 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -16,113 +16,112 @@ jobs:
1616
name: Build the package
1717
steps:
1818
- uses: actions/checkout@v4
19-
- uses: pnpm/action-setup@v3
19+
with:
20+
submodules: true
21+
- uses: pnpm/action-setup@v4
2022
- uses: actions/setup-node@v4
2123
with:
2224
node-version: 22
2325
cache: 'pnpm'
2426
- run: pnpm install
2527
env:
2628
CYPRESS_INSTALL_BINARY: 0
29+
CHROMEDRIVER_SKIP_DOWNLOAD: true
2730
- run: pnpm build
2831
- run: pnpm test:unit
2932

30-
# Use cache to share the output across different jobs
31-
# No need to cache node_modules because they are all bundled
32-
- uses: actions/cache/save@v4
33-
id: cache
34-
with:
35-
path: outfile.cjs
36-
key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
33+
- run: pnpm snapshot
3734

38-
test:
35+
# Use artifact to share the output across different jobs
36+
# No need to save node_modules because they are all bundled
37+
- uses: actions/upload-artifact@v4
38+
with:
39+
name: build-output
40+
path: |
41+
outfile.cjs
42+
playground
43+
retention-days: 3
44+
45+
verify-scripts:
46+
needs: build
47+
strategy:
48+
matrix:
49+
node-version: [18, 20, 22]
50+
os: [ubuntu-latest, windows-latest, macos-latest]
51+
verification-script:
52+
- pnpm --filter '!*typescript*' build
53+
- pnpm --filter '*typescript*' build
54+
- pnpm --filter '*vitest*' test:unit
55+
- pnpm --filter '*eslint*' --filter '!*nightwatch*' lint --no-fix --max-warnings=0
56+
- pnpm --filter '*prettier*' format --write --check
57+
# FIXME: it's failing now
58+
# - pnpm --filter '*with-tests*' test:unit
59+
runs-on: ${{ matrix.os }}
60+
continue-on-error: ${{ matrix.os == 'windows-latest' }}
61+
env:
62+
CYPRESS_INSTALL_BINARY: 0
63+
CHROMEDRIVER_SKIP_DOWNLOAD: true
64+
steps:
65+
- uses: actions/checkout@v4
66+
with:
67+
submodules: true
68+
- uses: pnpm/action-setup@v4
69+
- uses: actions/setup-node@v4
70+
with:
71+
node-version: ${{ matrix.node-version }}
72+
cache: 'pnpm'
73+
74+
# use artifacts to share the playground across different jobs
75+
- uses: actions/download-artifact@v4
76+
with:
77+
name: build-output
78+
79+
- name: Install dependencies to avoid tsconfig warnings
80+
run: pnpm install
81+
- name: Install dependencies in playground
82+
working-directory: ./playground
83+
run: pnpm install --no-frozen-lockfile
84+
85+
- name: Run build script in playground
86+
working-directory: ./playground
87+
run: ${{ matrix.verification-script }}
88+
89+
verify-e2e:
3990
needs: build
4091
strategy:
4192
matrix:
42-
flag-for-ts: ['', '--typescript']
43-
flag-for-jsx: ['', '--jsx']
44-
flag-for-router: ['', '--router']
45-
flag-for-pinia: ['', '--pinia']
46-
flag-for-vitest: ['', '--vitest']
47-
48-
# It's quite costly to install Cypress & Playwright even with cache.
49-
# Maybe we can split them into another job so that all the projects
50-
# can share the same binary installation.
51-
flag-for-e2e: ['', '--cypress', '--playwright']
52-
53-
# Skip ESLint/Prettier tests as we've reached the limit of job numbers
54-
# TODO: Find a way to test them without adding new jobs
55-
93+
e2e-framework: ['cypress', 'playwright']
5694
node-version: [22]
57-
os: [ubuntu-latest]
58-
59-
# Run a few tests on other systems and Node.js versions
60-
include:
61-
- node-version: 22
62-
os: windows-latest
63-
flag-for-ts: '--typescript'
64-
flag-for-jsx: '--jsx'
65-
flag-for-router: '--router'
66-
flag-for-pinia: '--pinia'
67-
flag-for-vitest: '--vitest'
68-
flag-for-e2e: '--cypress'
69-
flag-for-eslint: '--eslint'
70-
71-
- node-version: 22
72-
os: macos-latest
73-
flag-for-ts: '--typescript'
74-
flag-for-jsx: '--jsx'
75-
flag-for-router: '--router'
76-
flag-for-pinia: '--pinia'
77-
flag-for-vitest: '--vitest'
78-
flag-for-e2e: '--cypress'
79-
flag-for-eslint: '--eslint'
80-
81-
- node-version: 18
82-
os: ubuntu-latest
83-
flag-for-ts: '--typescript'
84-
flag-for-jsx: '--jsx'
85-
flag-for-router: '--router'
86-
flag-for-pinia: '--pinia'
87-
flag-for-vitest: '--vitest'
88-
flag-for-e2e: '--cypress'
89-
flag-for-eslint: '--eslint'
90-
91-
- node-version: 20
92-
os: ubuntu-latest
93-
flag-for-ts: '--typescript'
94-
flag-for-jsx: '--jsx'
95-
flag-for-router: '--router'
96-
flag-for-pinia: '--pinia'
97-
flag-for-vitest: '--vitest'
98-
flag-for-e2e: '--cypress'
99-
flag-for-eslint: '--eslint'
95+
os: [ubuntu-latest, windows-latest, macos-latest]
10096
runs-on: ${{ matrix.os }}
10197
continue-on-error: ${{ matrix.os == 'windows-latest' }}
10298
env:
103-
FEATURE_FLAGS: ${{ matrix.flag-for-ts }} ${{ matrix.flag-for-jsx }} ${{ matrix.flag-for-router }} ${{ matrix.flag-for-pinia }} ${{ matrix.flag-for-vitest }} ${{ matrix.flag-for-e2e }} ${{matrix.flag-for-eslint}}
10499
# Sometimes the Linux runner can't verify Cypress in 30s
105100
CYPRESS_VERIFY_TIMEOUT: 60000
106101
steps:
107102
- uses: actions/checkout@v4
108-
- uses: pnpm/action-setup@v3
103+
with:
104+
submodules: true
105+
- uses: pnpm/action-setup@v4
109106
- uses: actions/setup-node@v4
110107
with:
111108
node-version: ${{ matrix.node-version }}
112109
cache: 'pnpm'
113-
- uses: actions/cache/restore@v4
114-
id: cache-restore
110+
111+
# use artifacts to share the playground across different jobs
112+
- uses: actions/download-artifact@v4
115113
with:
116-
path: outfile.cjs
117-
key: ${{ github.sha }}-${{ hashFiles('pnpm-lock.yaml') }}
118-
- name: Build the package on cache miss
119-
if: steps.cache-restore.outputs.cache-hit != 'true'
120-
run: pnpm install && pnpm build
114+
name: build-output
115+
116+
- name: Install dependencies to avoid tsconfig warnings
117+
run: pnpm install
118+
- name: Install dependencies in playground
119+
working-directory: ./playground
120+
run: pnpm install --no-frozen-lockfile
121121

122122
# https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62
123123
# Install playwright's binary under custom directory to cache
124124
- name: Set Playwright & Cypress path
125-
if: runner.os != 'Windows'
126125
run: |
127126
echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV
128127
echo "CYPRESS_CACHE_FOLDER=$HOME/.cache/cypress-bin" >> $GITHUB_ENV
@@ -132,7 +131,7 @@ jobs:
132131
echo "PLAYWRIGHT_BROWSERS_PATH=$HOME\.cache\playwright-bin" >> $env:GITHUB_ENV
133132
echo "CYPRESS_CACHE_FOLDER=$HOME\.cache\cypress-bin" >> $env:GITHUB_ENV
134133
135-
- if: ${{ contains(matrix.flag-for-e2e, '--cypress') }}
134+
- if: ${{ contains(matrix.e2e-framework, 'cypress') }}
136135
name: Cache Cypress binaries
137136
id: cache-cypress
138137
uses: actions/cache@v4
@@ -141,7 +140,7 @@ jobs:
141140
key: ${{ runner.os }}-cypress-bin
142141
path: ${{ env.CYPRESS_CACHE_FOLDER }}
143142

144-
- if: ${{ contains(matrix.flag-for-e2e, '--playwright') }}
143+
- if: ${{ contains(matrix.e2e-framework, 'playwright') }}
145144
name: Cache Playwright's binary
146145
uses: actions/cache@v4
147146
with:
@@ -150,47 +149,32 @@ jobs:
150149
key: ${{ runner.os }}-playwright-bin-v1
151150
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}
152151

153-
- if: ${{ (contains(env.FEATURE_FLAGS, '--')) }}
154-
name: Create the sample project with feature flags
155-
working-directory: ../
156-
run: node ./create-vue/outfile.cjs sample-project ${{ env.FEATURE_FLAGS }}
157-
158-
- if: ${{ !(contains(env.FEATURE_FLAGS, '--')) }}
159-
name: Create the sample project with default options
160-
working-directory: ../
161-
run: node ./create-vue/outfile.cjs sample-project --default
162-
163-
- name: Install dependencies in the sample project
164-
working-directory: ../sample-project
165-
run: pnpm install
166-
167-
- if: ${{ contains(matrix.flag-for-vitest, '--') }}
168-
name: Run unit test script
169-
working-directory: ../sample-project
170-
run: pnpm test:unit
171-
172-
- name: Run build script
173-
working-directory: ../sample-project
174-
run: pnpm build
175-
176152
- name: Download Cypress
177-
if: ${{ contains(matrix.flag-for-e2e, '--cypress') }}
178-
working-directory: ../sample-project
153+
if: ${{ contains(matrix.e2e-framework, 'cypress') }}
154+
working-directory: ./playground/cypress
179155
run: |
180156
pnpm exec cypress cache list
181157
pnpm exec cypress install
182158
183-
- if: ${{ contains(matrix.flag-for-e2e, '--playwright') }}
159+
- if: ${{ contains(matrix.e2e-framework, 'playwright') }}
184160
name: Install Playwright dependencies
185-
working-directory: ../sample-project
186-
run: npx playwright install --with-deps
187-
188-
- if: ${{ contains(matrix.flag-for-e2e, '--') }}
189-
name: Run e2e test script
190-
working-directory: ../sample-project
191-
run: pnpm test:e2e
192-
193-
- if: ${{ contains(matrix.flag-for-eslint, '--') }}
194-
name: Run lint script
195-
working-directory: ../sample-project
196-
run: pnpm lint --no-fix --max-warnings=0
161+
working-directory: ./playground/playwright
162+
run: pnpm exec playwright install --with-deps
163+
164+
- name: Run build script
165+
working-directory: ./playground
166+
run: pnpm --filter '*${{ matrix.e2e-framework }}*' build
167+
168+
- name: Run e2e test script
169+
working-directory: ./playground
170+
run: pnpm --filter '*${{ matrix.e2e-framework }}*' --workspace-concurrency 1 test:e2e
171+
172+
# FIXME: Component testing is failing in CI after running too many tests.
173+
# The workaround in https://github.com/cypress-io/cypress/issues/22208 is not working.
174+
# But it seems not affecting real-world projects.
175+
# - name: Cypress component testing for projects without Vitest
176+
# working-directory: ./playground
177+
# if: ${{ contains(matrix.e2e-framework, 'cypress') }}
178+
# run: pnpm --filter '*cypress*' --filter '!*vitest*' --workspace-concurrency 1 test:unit
179+
180+
# FIXME: `--with-tests` folders. It's failing now.

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ npm create vue@latest
1717
> [!NOTE]
1818
> (`@latest` or `@legacy`) MUST NOT be omitted, otherwise `npm` may resolve to a cached and outdated version of the package.
1919
20-
Or, if you need to support IE11, you can create a Vue 2 project with:
20+
By default the command will run in interactive mode, but you can also provide feature flags in the CLI arguments to skip the prompts. Run `npm create vue@latest -- --help` to see all available options.
21+
22+
> [!NOTE]
23+
> If you're using PowerShell, you'll need to quote the `--`, that is, run `npm create vue@latest '--' --help`.
24+
25+
If you need to support IE11, you can create a Vue 2 project with:
2126

2227
```sh
2328
npm create vue@legacy

__test__/renderEslint.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { getAdditionalConfigs } from '../utils/renderEslint'
44
describe('renderEslint', () => {
55
it('should get additional dependencies and config with no test flags', () => {
66
const additionalConfigs = getAdditionalConfigs({
7+
needsTypeScript: false,
78
needsVitest: false,
89
needsCypress: false,
910
needsCypressCT: false,
@@ -14,6 +15,7 @@ describe('renderEslint', () => {
1415

1516
it('should get additional dependencies and config with for vitest', () => {
1617
const additionalConfigs = getAdditionalConfigs({
18+
needsTypeScript: false,
1719
needsVitest: true,
1820
needsCypress: false,
1921
needsCypressCT: false,
@@ -31,6 +33,7 @@ describe('renderEslint', () => {
3133

3234
it('should get additional dependencies and config with for cypress', () => {
3335
const additionalConfigs = getAdditionalConfigs({
36+
needsTypeScript: false,
3437
needsVitest: false,
3538
needsCypress: true,
3639
needsCypressCT: false,
@@ -53,6 +56,7 @@ describe('renderEslint', () => {
5356

5457
it('should get additional dependencies and config with for cypress with component testing', () => {
5558
const additionalConfigs = getAdditionalConfigs({
59+
needsTypeScript: false,
5660
needsVitest: false,
5761
needsCypress: true,
5862
needsCypressCT: true,
@@ -76,6 +80,7 @@ describe('renderEslint', () => {
7680

7781
it('should get additional dependencies and config with for playwright', () => {
7882
const additionalConfigs = getAdditionalConfigs({
83+
needsTypeScript: false,
7984
needsVitest: false,
8085
needsCypress: false,
8186
needsCypressCT: false,

0 commit comments

Comments
 (0)