From ea828165a9c87b80ea3b33abcc9c48fcd085a2f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Jel=C3=ADnek?= Date: Wed, 6 Mar 2024 14:04:20 +0100 Subject: [PATCH] build: Simplify npm scripts of the root project (#1176) Signed-off-by: Dominik Jelinek --- .github/workflows/template-main.yaml | 3 ++ .gitignore | 3 +- CONTRIBUTING.md | 18 ++----- locators/package.json | 12 +++-- package-lock.json | 71 ++++++++++++++++++---------- package.json | 27 ++++++----- page-objects/package.json | 10 ++-- 7 files changed, 83 insertions(+), 61 deletions(-) diff --git a/.github/workflows/template-main.yaml b/.github/workflows/template-main.yaml index b8c2af8b0..fbf1beb03 100644 --- a/.github/workflows/template-main.yaml +++ b/.github/workflows/template-main.yaml @@ -39,6 +39,9 @@ jobs: node-version: ${{ inputs.nodejs }} cache: npm + - name: Install + run: npm ci + - name: Run Tests (macOS, windows) if: matrix.os != 'ubuntu-latest' run: | diff --git a/.gitignore b/.gitignore index 8d7358218..0bb05d1b8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ node_modules docs resources/api-handler.vsix .npmrc -*.tgz \ No newline at end of file +*.tgz +test/test-project/package-lock.json diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 17ee9b007..67aa0e6c9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,19 +28,13 @@ git remote add upstream https://github.com/redhat-developer/vscode-extension-tes ### Build It -Now that you have the code, you will need to build the project. First, we need to get all the modules linked and built. - -```nodejs -npm run prepare-deps -``` - -Second step is to install all main module dependencies. +Now that you have the code, you will need to build the project. First, we need to install all modules dependencies: ```nodejs npm install ``` -Now you can compile the typescript project. We recommend using the predefined script for that. +Now you can compile the typescript project. We recommend using the predefined script for that: ```nodejs npm run build @@ -52,13 +46,7 @@ After these steps, you should be able to run the project and make your changes. **When you make a change, make sure the tests are passing**. In the ```test/test-project``` directory there is a dummy VS Code extension we use to test the framework itself. -First we need to install the dependencies of this project. For that, you can use the following script - -```nodejs -npm run prepare-test -``` - -With test dependencies installed we can launch the tests +For that, you can use the following script and launch the tests: ```nodejs npm test diff --git a/locators/package.json b/locators/package.json index 60f26e45d..b63dc1f1f 100644 --- a/locators/package.json +++ b/locators/package.json @@ -18,9 +18,13 @@ }, "keywords": [ "webdriver", + "selenium-webdriver", + "selenium", "test", "vscode", - "extension" + "extension", + "extester", + "ui-test" ], "author": "Red Hat", "license": "Apache-2.0", @@ -29,14 +33,14 @@ }, "homepage": "https://github.com/redhat-developer/vscode-extension-tester#readme", "devDependencies": { - "@types/node": "^18.17.15", + "@types/node": "^18.19.21", "@types/selenium-webdriver": "^4.1.21", "monaco-page-objects": "file:../page-objects", "rimraf": "^5.0.5", "typescript": "5.3.3" }, "peerDependencies": { - "monaco-page-objects": "^3.13.0", - "selenium-webdriver": "^4.6.1" + "monaco-page-objects": "*", + "selenium-webdriver": ">=4.6.1" } } diff --git a/package-lock.json b/package-lock.json index 136ad9e20..026e45c21 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,8 +13,6 @@ "locators" ], "dependencies": { - "@types/selenium-webdriver": "^4.1.21", - "@types/targz": "^1.0.4", "@vscode/vsce": "^2.24.0", "commander": "^12.0.0", "compare-versions": "^6.1.0", @@ -23,11 +21,11 @@ "got": "^13.0.0", "hpagent": "^1.2.0", "js-yaml": "^4.1.0", - "monaco-page-objects": "^3.13.1", + "monaco-page-objects": "3.13.1", "sanitize-filename": "^1.6.3", "selenium-webdriver": "^4.18.1", "targz": "^1.0.1", - "vscode-extension-tester-locators": "^3.11.0" + "vscode-extension-tester-locators": "3.11.0" }, "bin": { "extest": "out/cli.js" @@ -36,7 +34,9 @@ "@types/fs-extra": "^11.0.4", "@types/js-yaml": "^4.0.9", "@types/mocha": "^10.0.6", - "@types/node": "^18.17.15", + "@types/node": "^18.19.21", + "@types/selenium-webdriver": "^4.1.21", + "@types/targz": "^1.0.4", "mocha": "^10.3.0", "rimraf": "^5.0.5", "typescript": "*" @@ -51,15 +51,15 @@ "version": "3.11.0", "license": "Apache-2.0", "devDependencies": { - "@types/node": "^18.17.15", + "@types/node": "^18.19.21", "@types/selenium-webdriver": "^4.1.21", "monaco-page-objects": "file:../page-objects", "rimraf": "^5.0.5", "typescript": "5.3.3" }, "peerDependencies": { - "monaco-page-objects": "^3.13.0", - "selenium-webdriver": "^4.6.1" + "monaco-page-objects": "*", + "selenium-webdriver": ">=4.6.1" } }, "node_modules/@isaacs/cliui": { @@ -221,14 +221,19 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.17.15", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.17.15.tgz", - "integrity": "sha512-2yrWpBk32tvV/JAd3HNHWuZn/VDN1P+72hWirHnvsvTGSqbANi+kSeuQR9yAHnbvaBvHDsoTdXV0Fe+iRtHLKA==" + "version": "18.19.21", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.21.tgz", + "integrity": "sha512-2Q2NeB6BmiTFQi4DHBzncSoq/cJMLDdhPaAoJFnFCyD9a8VPZRf7a1GAwp1Edb7ROaZc5Jz/tnZyL6EsWMRaqw==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } }, "node_modules/@types/selenium-webdriver": { "version": "4.1.21", "resolved": "https://registry.npmjs.org/@types/selenium-webdriver/-/selenium-webdriver-4.1.21.tgz", "integrity": "sha512-QGURnImvxYlIQz5DVhvHdqpYNLBjhJ2Vm+cnQI2G9QZzkWlZm0LkLcvDcHp+qE6N2KBz4CeuvXgPO7W3XQ0Tyw==", + "dev": true, "dependencies": { "@types/ws": "*" } @@ -237,6 +242,7 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/tar-fs/-/tar-fs-2.0.4.tgz", "integrity": "sha512-ipPec0CjTmVDWE+QKr9cTmIIoTl7dFG/yARCM5MqK8i6CNLIG1P8x4kwDsOQY1ChZOZjH0wO9nvfgBvWl4R3kA==", + "dev": true, "dependencies": { "@types/node": "*", "@types/tar-stream": "*" @@ -246,6 +252,7 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/@types/tar-stream/-/tar-stream-3.1.3.tgz", "integrity": "sha512-Zbnx4wpkWBMBSu5CytMbrT5ZpMiF55qgM+EpHzR4yIDu7mv52cej8hTkOc6K+LzpkOAbxwn/m7j3iO+/l42YkQ==", + "dev": true, "dependencies": { "@types/node": "*" } @@ -254,12 +261,14 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/@types/targz/-/targz-1.0.4.tgz", "integrity": "sha512-4i2weIjweWsnrvutLH7dM/+FPVSFSqxb+XKWo61tAiHxyYYHveImqys5JijMboKJz+jhFu24SlFrdVAB0xAMIw==", + "dev": true, "dependencies": { "@types/tar-fs": "*" } }, "node_modules/@types/ws": { "version": "8.5.3", + "dev": true, "license": "MIT", "dependencies": { "@types/node": "*" @@ -392,8 +401,9 @@ } }, "node_modules/@vscode/vsce/node_modules/semver": { - "version": "7.5.4", - "license": "ISC", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "dependencies": { "lru-cache": "^6.0.0" }, @@ -971,8 +981,9 @@ } }, "node_modules/entities": { - "version": "4.4.0", - "license": "BSD-2-Clause", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", "engines": { "node": ">=0.12" }, @@ -1872,8 +1883,9 @@ } }, "node_modules/node-abi/node_modules/semver": { - "version": "7.5.4", - "license": "ISC", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "optional": true, "dependencies": { "lru-cache": "^6.0.0" @@ -2075,8 +2087,9 @@ } }, "node_modules/path-scurry/node_modules/lru-cache": { - "version": "10.0.1", - "license": "ISC", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.0.tgz", + "integrity": "sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==", "engines": { "node": "14 || >=16.14" } @@ -2132,8 +2145,9 @@ } }, "node_modules/prebuild-install/node_modules/readable-stream": { - "version": "3.6.0", - "license": "MIT", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "optional": true, "dependencies": { "inherits": "^2.0.3", @@ -2247,8 +2261,9 @@ } }, "node_modules/readable-stream": { - "version": "2.3.7", - "license": "MIT", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -2738,6 +2753,12 @@ "version": "1.13.6", "license": "MIT" }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "node_modules/universalify": { "version": "2.0.0", "license": "MIT", @@ -2952,13 +2973,13 @@ "devDependencies": { "@types/clone-deep": "^4.0.4", "@types/fs-extra": "^11.0.4", - "@types/node": "^18.17.15", + "@types/node": "^18.19.21", "@types/selenium-webdriver": "^4.1.21", "rimraf": "^5.0.5", "typescript": "*" }, "peerDependencies": { - "selenium-webdriver": "^4.6.1", + "selenium-webdriver": ">=4.6.1", "typescript": ">=4.6.2" } } diff --git a/package.json b/package.json index faec79d5f..549853057 100644 --- a/package.json +++ b/package.json @@ -15,13 +15,10 @@ }, "scripts": { "prepack": "npm run build", - "prepare-deps": "npm run build-page-objects && npm run build-locators", - "build-page-objects": "cd page-objects && npm i && npm run build", - "build-locators": "cd locators && npm i && npm run build", - "prebuild": "npm run prepare-deps", - "build": "npm link ./page-objects ./locators && rimraf out/ && tsc && chmod a+x ./out/cli.js", - "prepare-test": "cd test/test-project && npm install && rimraf package-lock.json", - "test": "npm run build && npm run prepare-test && cd test/test-project && npm run ui-test" + "prebuild": "npm run build --workspaces", + "build": "rimraf out/ && tsc && chmod a+x ./out/cli.js", + "pretest": "npm run build && npm install --prefix test/test-project", + "test": "npm run ui-test --prefix test/test-project" }, "repository": { "type": "git", @@ -29,9 +26,13 @@ }, "keywords": [ "webdriver", + "selenium-webdriver", + "selenium", "test", "vscode", - "extension" + "extension", + "extester", + "ui-test" ], "workspaces": [ "page-objects", @@ -53,14 +54,14 @@ "@types/fs-extra": "^11.0.4", "@types/js-yaml": "^4.0.9", "@types/mocha": "^10.0.6", - "@types/node": "^18.17.15", + "@types/node": "^18.19.21", + "@types/selenium-webdriver": "^4.1.21", + "@types/targz": "^1.0.4", "mocha": "^10.3.0", "rimraf": "^5.0.5", "typescript": "*" }, "dependencies": { - "@types/selenium-webdriver": "^4.1.21", - "@types/targz": "^1.0.4", "@vscode/vsce": "^2.24.0", "commander": "^12.0.0", "compare-versions": "^6.1.0", @@ -69,11 +70,11 @@ "got": "^13.0.0", "hpagent": "^1.2.0", "js-yaml": "^4.1.0", - "monaco-page-objects": "^3.13.1", + "monaco-page-objects": "3.13.1", "sanitize-filename": "^1.6.3", "selenium-webdriver": "^4.18.1", "targz": "^1.0.1", - "vscode-extension-tester-locators": "^3.11.0" + "vscode-extension-tester-locators": "3.11.0" }, "peerDependencies": { "mocha": ">=5.2.0", diff --git a/page-objects/package.json b/page-objects/package.json index f35529256..b43b1f325 100644 --- a/page-objects/package.json +++ b/page-objects/package.json @@ -18,9 +18,13 @@ }, "keywords": [ "webdriver", + "selenium-webdriver", + "selenium", "test", "vscode", - "extension" + "extension", + "extester", + "ui-test" ], "author": "Red Hat", "license": "Apache-2.0", @@ -31,7 +35,7 @@ "devDependencies": { "@types/clone-deep": "^4.0.4", "@types/fs-extra": "^11.0.4", - "@types/node": "^18.17.15", + "@types/node": "^18.19.21", "@types/selenium-webdriver": "^4.1.21", "rimraf": "^5.0.5", "typescript": "*" @@ -44,7 +48,7 @@ "ts-essentials": "^9.4.1" }, "peerDependencies": { - "selenium-webdriver": "^4.6.1", + "selenium-webdriver": ">=4.6.1", "typescript": ">=4.6.2" } }