Skip to content

Migrate js clients #47

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

Merged
merged 28 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
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
35 changes: 35 additions & 0 deletions .github/workflows/js-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: JS (build)

on:
push:
paths:
- 'visual-js/**'
- .github/workflows/js-build.yml
pull_request:
paths:
- 'visual-js/**'
- .github/workflows/js-build.yml

defaults:
run:
working-directory: visual-js

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node 18
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Build with lerna
run: |
corepack enable
yarn install
npx lerna run lint
npx lerna run build
npx lerna run test
env:
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
37 changes: 37 additions & 0 deletions .github/workflows/js-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: JS (release)

on:
workflow_dispatch: {}

defaults:
run:
working-directory: visual-js

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node 18
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Setup Git
if: ${{ steps.prep.outputs.tag_name == '' }}
run: |
git config --global user.name "sauce-visual-bot"
git config --global user.email "[email protected]"
- name: Build
run: |
corepack enable
yarn install
npx lerna run build
- name: upgrade & publish version(s)
## TODO version and publish commands need to be adjusted when we're confident with the pipeline
run: |
npx changeset version --snapshot migration
npx changeset publish --no-git-tag --snapshot
## TODO enable the git tagging when we're confident with the pipeline
##- name: Push to git
## run: |
## git push --follow-tags
8 changes: 8 additions & 0 deletions visual-js/.changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
15 changes: 15 additions & 0 deletions visual-js/.changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": true,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [],
"changedFilePatterns": [
"visual*/**",
"package.json"
]
}
9 changes: 9 additions & 0 deletions visual-js/.changeset/mean-horses-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@saucelabs/nightwatch-sauce-visual-service": patch
"@saucelabs/visual-storybook": patch
"@saucelabs/cypress-visual-plugin": patch
"@saucelabs/wdio-sauce-visual-service": patch
"@saucelabs/visual": patch
---

migrate source to github
11 changes: 11 additions & 0 deletions visual-js/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules
.DS_Store
yarn-error.log
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored (not using zero install yet)
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks

12 changes: 12 additions & 0 deletions visual-js/.husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

(
cd js
npx lint-staged
)

(
cd js-wdio
npx lint-staged
)
550 changes: 550 additions & 0 deletions visual-js/.yarn/plugins/@yarnpkg/plugin-version.cjs

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions visual-js/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: '@yarnpkg/plugin-version'

pnpMode: loose
5 changes: 5 additions & 0 deletions visual-js/lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "0.0.0",
"npmClient": "yarn"
}
27 changes: 27 additions & 0 deletions visual-js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "visual-clients-workspace",
"private": true,
"workspaces": [
"visual",
"visual-storybook",
"visual-wdio",
"visual-cypress",
"visual-nightwatch"
],
"devDependencies": {
"husky": "8.0.0",
"lerna": "^8.1.2"
},
"scripts": {
"prepare": "cd ../.. && husky install clients/js/.husky"
},
"lint-staged": {
"**/*.{js,jsx,ts,tsx}": [
"yarn lint"
]
},
"packageManager": "[email protected]",
"dependencies": {
"@changesets/cli": "^2.27.1"
}
}
7 changes: 7 additions & 0 deletions visual-js/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.prod.json",
"compilerOptions": {
"inlineSourceMap": true,
"esModuleInterop": true
}
}
28 changes: 28 additions & 0 deletions visual-js/tsconfig.prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"extends": "@tsconfig/node18/tsconfig.json",

"compilerOptions": {
"outDir": "./build",
"allowJs": true,
"declaration": true,
"declarationMap": true,
"resolveJsonModule": true,
"removeComments": false,
"strictFunctionTypes": false,
"experimentalDecorators": true,
"esModuleInterop": true,
"moduleResolution": "Node",
"module": "ESNext",
"lib": ["dom", "es2021"],
"types": ["node"]
},

"exclude": [
"../node_modules",
"__mocks__",
"packages/**/node_modules",
"coverage",
"examples",
"/*.js"
]
}
36 changes: 36 additions & 0 deletions visual-js/visual-cypress/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.cjs', 'build'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',

// Allow unused vars that start with _
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
],
},
};
5 changes: 5 additions & 0 deletions visual-js/visual-cypress/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
.work
build/
coverage/
yarn.lock
4 changes: 4 additions & 0 deletions visual-js/visual-cypress/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
}
8 changes: 8 additions & 0 deletions visual-js/visual-cypress/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Sauce Labs Visual for Cypress

This package is Sauce Labs Visual integration for Cypress.<br />
It comes as both a plugin and commands that will be made available for your tests.

## Installation & Usage

View installation and usage instructions on the [Sauce Docs website](https://docs.saucelabs.com/visual-testing/integrations/cypress/).
89 changes: 89 additions & 0 deletions visual-js/visual-cypress/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"name": "@saucelabs/cypress-visual-plugin",
"version": "0.3.0",
"description": "Cypress plugin for Sauce Visual Testing",
"main": "build/index.cjs",
"module": "build/index.js",
"types": "build/index.d.ts",
"type": "module",
"license": "MIT",
"files": [
"build",
"README.md"
],
"engines": {
"node": "^16.13 || >=18"
},
"typeScriptVersion": "5.1.6",
"keywords": [
"cypress",
"saucelabs",
"visual"
],
"exports": {
".": {
"require": "./build/index.cjs",
"import": "./build/index.js",
"types": "./build/index.d.ts"
},
"./commands": {
"require": "./build/commands.cjs",
"import": "./build/commands.js",
"types": "./build/commands.d.ts"
},
"./package.json": "./package.json"
},
"peerDependencies": {
"cypress": "^12.0.0 || ^13.0.0"
},
"dependencies": {
"@saucelabs/visual": "0.3.0",
"chalk": "^5.3.0",
"exponential-backoff": "^3.1.1",
"macos-release": "^3.2.0",
"node-fetch": "^3.3.1",
"tsup": "^7.2.0"
},
"tsup": {
"entry": [
"./src/commands.ts",
"./src/index.ts"
],
"dts": true,
"outDir": "./build",
"format": [
"cjs",
"esm"
],
"noExternal": [
"chalk",
"macos-release"
]
},
"devDependencies": {
"@tsconfig/node18": "^2.0.1",
"@types/cypress": "^1.1.3",
"@types/node": "^20.4.4",
"@typescript-eslint/eslint-plugin": "^5.59.1",
"@typescript-eslint/parser": "^5.59.1",
"eslint": "^8.0.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^29.5.0",
"jest-junit-reporter": "^1.1.0",
"prettier": "^2.8.8",
"ts-node": "^10.9.1",
"tsc-watch": "^6.0.4",
"typescript": "^5.1.6"
},
"scripts": {
"build": "tsup",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
"test-ignored": "jest --collect-coverage",
"watch": "tsc-watch --declaration -p .",
"test": "node ./test-cjs.cjs"
},
"publishConfig": {
"access": "public"
}
}
Loading
Loading