Skip to content

Commit

Permalink
feat: Add vue2 package from npm/vue/v2 branch (#21026)
Browse files Browse the repository at this point in the history
* Add vue2 package from npm/vue/v2 branch

* Add vue2 as automatic export

* remove npm/vue2/examples

* remove cypress directory from vue2

* fix: ordering of build scripts

* remove unneeded files from output, name module cypress-vue2 / CypressVue2

* fix types package resolution

Co-authored-by: Lachlan Miller <[email protected]>
Co-authored-by: Tim Griesser <[email protected]>
  • Loading branch information
3 people authored Apr 13, 2022
1 parent 001a724 commit 3aa69e2
Show file tree
Hide file tree
Showing 48 changed files with 1,887 additions and 266 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ cli/types
# cli/react, cli/vue, and cli/mount-utils are all copied from dist'd builds
cli/react
cli/vue
cli/vue2
cli/mount-utils

# packages/example is not linted (think about changing this)
Expand Down Expand Up @@ -69,6 +70,9 @@ npm/cypress-schematic/src/**/*.js
/npm/create-cypress-tests/initial-template
/npm/create-cypress-tests/**/*.template.*

# The global eslint configuration is not set up to parse vue@2 files
/npm/vue2/**/*.vue

packages/data-context/test/unit/codegen/files

# community templates we test against, no need to lint
Expand Down
1 change: 1 addition & 0 deletions .releaserc.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ module.exports = {
],
extends: 'semantic-release-monorepo',
branches: [
'master',
],
}
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ commands:
command: ls -la types
working_directory: cli/build
- run:
command: ls -la vue mount-utils react
command: ls -la vue vue2 mount-utils react
working_directory: cli/build
- unless:
condition:
Expand Down
3 changes: 2 additions & 1 deletion cli/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ build
# ignore packages synced at build-time via
# the sync-exported-npm-with-cli.js script
vue
vue2
react
mount-utils
mount-utils
7 changes: 6 additions & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@
"types/net-stubbing.ts",
"mount-utils",
"vue",
"react"
"react",
"vue2"
],
"bin": {
"cypress": "bin/cypress"
Expand All @@ -124,6 +125,10 @@
"import": "./vue/dist/cypress-vue.esm-bundler.js",
"require": "./vue/dist/cypress-vue.cjs.js"
},
"./vue2": {
"import": "./vue2/dist/cypress-vue2.esm-bundler.js",
"require": "./vue2/dist/cypress-vue2.cjs.js"
},
"./package.json": {
"import": "./package.json",
"require": "./package.json"
Expand Down
1 change: 1 addition & 0 deletions cli/scripts/post-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const npmModulesToCopy = [
'mount-utils',
'react',
'vue',
'vue2',
]

npmModulesToCopy.forEach((folder) => {
Expand Down
2 changes: 1 addition & 1 deletion cli/scripts/post-install.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ shell.set('-e') // any error is fatal
fs.ensureDirSync(join(__dirname, '..', 'types'))

includeTypes.forEach((folder) => {
const source = resolvePkg(`@types/${folder}`, { cwd: join(__dirname, '..', '..') })
const source = resolvePkg(`@types/${folder}`, { cwd: __dirname })

fs.copySync(source, join(__dirname, '..', 'types', folder))
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ describe('init component tests script', () => {
}) as any)

await initComponentTesting({ config: {}, cypressConfigPath, useYarn: true })
expect(execStub).to.be.calledWith('yarn add @cypress/vue@3 --dev')
expect(execStub).to.be.calledWith('yarn add @cypress/vue --dev')
})

it('suggest the right instruction based on user template choice', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,16 @@ type InstallAdapterOptions = {
useYarn: boolean
}

const frameworkDependencies = {
react: '@cypress/react',
'vue@2': '@cypress/vue2',
'vue@3': '@cypress/vue',
}

export async function installFrameworkAdapter (cwd: string, options: InstallAdapterOptions) {
const framework = await guessOrAskForFramework(cwd)

await installDependency(`@cypress/${framework}`, options)
await installDependency(frameworkDependencies[framework], options)

return framework
}
4 changes: 2 additions & 2 deletions npm/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"description": "Browser-based Component Testing for Vue.js with Cypress.io ✌️🌲",
"main": "dist/cypress-vue.cjs.js",
"scripts": {
"build": "rimraf dist && rollup -c rollup.config.js",
"postbuild": "node ../../scripts/sync-exported-npm-with-cli.js",
"build-prod": "yarn build",
"cy:open": "node ../../scripts/cypress.js open --component --project ${PWD}",
"cy:run": "node ../../scripts/cypress.js run --component --project ${PWD}",
"build": "rimraf dist && rollup -c rollup.config.js",
"postbuild": "node ../../scripts/sync-exported-npm-with-cli.js",
"typecheck": "vue-tsc --noEmit",
"test": "yarn cy:run",
"watch": "yarn build --watch --watch.exclude ./dist/**/*",
Expand Down
17 changes: 17 additions & 0 deletions npm/vue2/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"plugins": [
"cypress"
],
"extends": [
"plugin:@cypress/dev/tests"
],
"env": {
"cypress/globals": true
},
"rules": {
"mocha/no-global-tests": "off",
"no-unused-vars": "off",
"no-console": "off",
"@typescript-eslint/no-unused-vars": "off"
}
}
4 changes: 4 additions & 0 deletions npm/vue2/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
registry=http://registry.npmjs.org/
save-exact=true
progress=false
package-lock=true
7 changes: 7 additions & 0 deletions npm/vue2/.releaserc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
...require('../../.releaserc.base'),
branches: [
// this one releases v3 on master on the latest channel
'master',
],
}
5 changes: 5 additions & 0 deletions npm/vue2/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# @cypress/vue2-v1.0.0 (2021-06-17)

### Features

* Split out as separate package from `@cypress/vue`, based on the `npm/vue/v2` branch.
Loading

1 comment on commit 3aa69e2

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 3aa69e2 Apr 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.0.0/linux-x64/10.0-release-3aa69e2538aae5702bfc48789c54f37263ce08fc/cypress.tgz

Please sign in to comment.