Skip to content

Commit

Permalink
build: Simplify npm scripts of the root project (#1176)
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Jelinek <[email protected]>
  • Loading branch information
djelinek authored Mar 6, 2024
1 parent d3e0da5 commit ea82816
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 61 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/template-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ node_modules
docs
resources/api-handler.vsix
.npmrc
*.tgz
*.tgz
test/test-project/package-lock.json
18 changes: 3 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
12 changes: 8 additions & 4 deletions locators/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@
},
"keywords": [
"webdriver",
"selenium-webdriver",
"selenium",
"test",
"vscode",
"extension"
"extension",
"extester",
"ui-test"
],
"author": "Red Hat",
"license": "Apache-2.0",
Expand All @@ -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"
}
}
71 changes: 46 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 14 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,24 @@
},
"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",
"url": "git+https://github.com/redhat-developer/vscode-extension-tester.git"
},
"keywords": [
"webdriver",
"selenium-webdriver",
"selenium",
"test",
"vscode",
"extension"
"extension",
"extester",
"ui-test"
],
"workspaces": [
"page-objects",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
10 changes: 7 additions & 3 deletions page-objects/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@
},
"keywords": [
"webdriver",
"selenium-webdriver",
"selenium",
"test",
"vscode",
"extension"
"extension",
"extester",
"ui-test"
],
"author": "Red Hat",
"license": "Apache-2.0",
Expand All @@ -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": "*"
Expand All @@ -44,7 +48,7 @@
"ts-essentials": "^9.4.1"
},
"peerDependencies": {
"selenium-webdriver": "^4.6.1",
"selenium-webdriver": ">=4.6.1",
"typescript": ">=4.6.2"
}
}

0 comments on commit ea82816

Please sign in to comment.