Skip to content

Commit

Permalink
KOGITO-7159: Remove Yarn for installing packages and running scripts (a…
Browse files Browse the repository at this point in the history
…pache#996)

* Remove yarn from top-level scripts

* Remove yarn usage in all places except for dashbuilder

* Rollback to --yarn option on vsce usage

* Test if bringing back Yarn on powershell commands is enough
  • Loading branch information
tiagobento authored May 16, 2022
1 parent 2ecbb7b commit 772f484
Show file tree
Hide file tree
Showing 107 changed files with 363 additions and 379 deletions.
6 changes: 3 additions & 3 deletions .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ runs:
echo "STEP: Setup Yarn and Lerna"
cd ${{ inputs.path }}
npm install -g [email protected] [email protected]
yarn config set network-timeout 1000000
pnpm config set network-timeout 1000000
- name: "Setup default Maven args"
shell: bash
Expand All @@ -62,7 +62,7 @@ runs:
run: |
echo "STEP: Bootstrap"
cd ${{ inputs.path }}
yarn bootstrap --frozen-lockfile
pnpm bootstrap --frozen-lockfile
- name: "Check dependencies mismatches"
shell: bash
Expand All @@ -76,7 +76,7 @@ runs:
run: |
echo "STEP: Check format"
cd ${{ inputs.path }}
yarn format:check
pnpm format:check
- name: "Start Xvfb (Ubuntu only)"
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn pretty-quick --staged
pnpm pretty-quick --staged
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ This repository contains all the tooling artifacts of the Kogito project.
To start building the KIE Tools project, you're going to need:

- Node `>= 16.13.2` _(To install, follow these instructions: https://nodejs.org/en/download/package-manager/)_
- Yarn `1.22.10` _(To install, run `npm install -g [email protected]`)_
- pnpm `7.0.0` _(To install, follow these instructions: https://pnpm.io/installation)_
- Maven `3.8.1`
- Java `11`
Expand All @@ -40,7 +39,7 @@ Users of Fedora or RHEL will also need to add an additional repository:

After installing the tools above, you'll need to download the dependencies and link the packages locally. Simply run:

- `yarn bootstrap`
- `pnpm bootstrap`

To build it, you'll have two choices. Note that you always need to specify which package you want to build, so replace `[pkg-name]` with the name of the desired package.

Expand All @@ -65,28 +64,28 @@ The KIE Tools project contains several applications. To develop each one of them
#### Chrome Extension

1. After you've successfully built the project following the instructions above, open the `packages/chrome-extension-pack-kogito-kie-editors` folder on your favourite IDE. You can import the entire repo as well if you want to make changes to other packages.
2. Run `yarn build:dev` on `packages/chrome-extension-pack-kogito-kie-editors`. This will create a version of the Chrome Extension that fetches the envelope locally.
3. Open a terminal and run `yarn start` on `packages/chrome-extension-pack-kogito-kie-editors`. This will start a `webpack serve` instance with the editors and their envelope. We use that because we don't pack the Chrome Extension bundle with the editors inside. Instead, we fetch them from GitHub pages.
2. Run `pnpm build:dev` on `packages/chrome-extension-pack-kogito-kie-editors`. This will create a version of the Chrome Extension that fetches the envelope locally.
3. Open a terminal and run `pnpm start` on `packages/chrome-extension-pack-kogito-kie-editors`. This will start a `webpack serve` instance with the editors and their envelope. We use that because we don't pack the Chrome Extension bundle with the editors inside. Instead, we fetch them from GitHub pages.
4. You also have to enable invalid certificates for resources loaded from localhost in your browser. To do that, go to `chrome://flags/#allow-insecure-localhost` in your Chrome browser and enable this flag. Alternativelly, you can go to `https://localhost:9001` and add an exception.
5. Open Chrome and go to `chrome://extensions`. Enable "Developer mode" in the top-right corner and click on "Load unpacked". Choose the `packages/chrome-extension-pack-kogito-kie-editors/dist` folder.
6. From now on you can use the development version of the extension. **Remember!** After each change, you have to rebuild the changed modules and hit the "Refresh" button of the extension card.

#### Online Editor

1. After you've successfully built the project following the instructions above, go to `packages/online-editor`.
2. Open a terminal and run `yarn start`. This will start a `webpack serve` instance with the Online Editor resources.
2. Open a terminal and run `pnpm start`. This will start a `webpack serve` instance with the Online Editor resources.
3. From now on you can use the development version of the Online Editor by accessing `https://localhost:9001`.

#### Desktop

1. After you've successfully built the project following the instructions above, go to `packages/desktop`.
2. To start the application in development mode, you can run `yarn start`. If you make changes and want to reload the app, run `yarn run build:dev && yarn start`. This will recompile the module and restart the Electron app. Remember: if you make changes to other modules, you have to build them too!
3. To build and package the application for production (i.e. generating an executable), you can run `yarn run build:prod`. This will pack the application for the current OS. If you want to pack the application for a different OS, run `yarn run pack:linux`, for example. See `package.json` for more details.
2. To start the application in development mode, you can run `pnpm start`. If you make changes and want to reload the app, run `pnpm build:dev && pnpm start`. This will recompile the module and restart the Electron app. Remember: if you make changes to other modules, you have to build them too!
3. To build and package the application for production (i.e. generating an executable), you can run `pnpm build:prod`. This will pack the application for the current OS. If you want to pack the application for a different OS, run `pnpm pack:linux`, for example. See `package.json` for more details.

#### Standalone Editors

1. After you've successfully built the project following the instructions above, go to `packages/kie-editors-standalone`.
2. Open a terminal and run `yarn start`. This will start a `webpack serve` instance with the Standalone Editors test page.
2. Open a terminal and run `pnpm start`. This will start a `webpack serve` instance with the Standalone Editors test page.
3. From now on you can use the development version of the Standalone DMN Editor by accessing `https://localhost:9001/resources/dmn` and the Standalone BPMN Editor by accessing `https://localhost:9001/resources/bpmn`.

## Libraries
Expand Down
2 changes: 1 addition & 1 deletion RELEASE_PROCESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Release workflow (post 0.13.0)

1. Update the `CHANGELOG.md` files and send a PR to `main`.
1. Create a `{version}-prerelease` branch from the commit you just made with the CHANGELOG updates.
1. Update version from `0.0.0` to `{version}` -- `yarn update-version-to {version}`.
1. Update version from `0.0.0` to `{version}` -- `pnpm update-version-to {version}`.
1. Push `{version}-prerelease` branch to `origin`.
1. 🔨(automatic) WORKFLOW (`staging.yml`).
- Create new draft release on GitHub.
Expand Down
5 changes: 2 additions & 3 deletions examples/base64png-editor-chrome-extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ This package is the Chrome Extension, which runs the Base64 PNG Editor.
Install all dependencies and build the project on the **root** folder of this repository

```shell script
yarn run init
yarn build:prod
pnpm build:prod
```

Open your Chrome browser on the `chrome://extension`, choose to Load Unpacked, and select this package `dist/` folder

**Important**: In order to the extension works, it's necessary to run the command after you have build the application:

```
yarn serve-envelope
pnpm serve-envelope
```

It will run a server exposing your `dist/` folder on the `localhost:9000`. It's necessary to access your `localhost:9000`, and enable access to it.
Expand Down
4 changes: 2 additions & 2 deletions examples/base64png-editor-chrome-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
},
"scripts": {
"build": "rimraf dist && webpack",
"build:dev": "yarn run run-script-if --bool \"$(build-env global.build.examples)\" --then \"yarn run build --env dev\"",
"build:prod": "yarn run run-script-if --bool \"$(build-env global.build.examples)\" --then \"yarn run build\"",
"build:dev": "pnpm run-script-if --bool \"$(build-env global.build.examples)\" --then \"pnpm build --env dev\"",
"build:prod": "pnpm run-script-if --bool \"$(build-env global.build.examples)\" --then \"pnpm build\"",
"serve-envelope": "webpack-dev-server"
},
"babel": {
Expand Down
6 changes: 3 additions & 3 deletions examples/base64png-editor-vscode-extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ This example requires the VS Code version 1.46 or later.
Install all dependencies and build the project on the **root** folder of this repository

```shell script
yarn run init
yarn build:prod
pnpm init
pnpm build:prod
```

- Debug mode
Expand All @@ -27,4 +27,4 @@ code .

- Installing VSIX

The `yarn build:prod` generate a vsix file on the `/dist` folder. Open your VS Code, and install it.
The `pnpm build:prod` generate a vsix file on the `/dist` folder. Open your VS Code, and install it.
10 changes: 5 additions & 5 deletions examples/base64png-editor-vscode-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@
]
},
"scripts": {
"pack": "vsce package --yarn -o ./dist/kie_tools_examples_base64_editor_vscode_extension_$npm_package_version.vsix",
"compile": "yarn run build --env dev",
"watch": "yarn run build --env dev",
"pack": "vsce package --yarn -o ./dist/kie_tools_examples_base64_editor_vscode_extension_$npm_package_version.vsix",
"compile": "pnpm build --env dev",
"watch": "pnpm build --env dev",
"build": "rimraf dist && webpack",
"build:dev": "yarn run run-script-if --bool \"$(build-env global.build.examples)\" --then \"yarn run build --env dev\"",
"build:prod": "yarn run run-script-if --bool \"$(build-env global.build.examples)\" --then \"yarn run build\" \"yarn run pack\""
"build:dev": "pnpm run-script-if --bool \"$(build-env global.build.examples)\" --then \"pnpm build --env dev\"",
"build:prod": "pnpm run-script-if --bool \"$(build-env global.build.examples)\" --then \"pnpm build\" \"pnpm pack\""
},
"devDependencies": {
"@kie-tools/build-env": "0.0.0",
Expand Down
6 changes: 3 additions & 3 deletions examples/base64png-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
},
"scripts": {
"copy:css": "copyfiles -u 1 \"src/**/*.{sass,scss,css}\" dist/",
"build": "rimraf dist && yarn copy:css && tsc",
"build:dev": "yarn run run-script-if --bool \"$(build-env global.build.examples)\" --then \"yarn run build\"",
"build:prod": "yarn run run-script-if --bool \"$(build-env global.build.examples)\" --then \"yarn run build\""
"build": "rimraf dist && pnpm copy:css && tsc",
"build:dev": "pnpm run-script-if --bool \"$(build-env global.build.examples)\" --then \"pnpm build\"",
"build:prod": "pnpm run-script-if --bool \"$(build-env global.build.examples)\" --then \"pnpm build\""
},
"dependencies": {
"@kie-tools-core/editor": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/ping-pong-view-angular/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": 1,
"newProjectRoot": "projects",
"cli": {
"packageManager": "yarn"
"packageManager": "pnpm"
},
"projects": {
"ping-pong-view-angular": {
Expand Down
8 changes: 4 additions & 4 deletions examples/ping-pong-view-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
"url": "git+https://github.com/kiegroup/kie-tools.git"
},
"scripts": {
"build": "rimraf dist && yarn run build:wc && yarn run build:wc-lib && yarn run build:app",
"build:dev": "yarn run run-script-if --bool \"$(build-env global.build.examples)\" --then \"yarn run build\"",
"build:prod": "yarn run run-script-if --bool \"$(build-env global.build.examples)\" --then \"yarn run build --configuration production\"",
"build": "rimraf dist && pnpm build:wc && pnpm build:wc-lib && pnpm build:app",
"build:dev": "pnpm run-script-if --bool \"$(build-env global.build.examples)\" --then \"pnpm build\"",
"build:prod": "pnpm run-script-if --bool \"$(build-env global.build.examples)\" --then \"pnpm build --configuration production\"",
"build:app": "ng build ping-pong-view-angular",
"build:wc": "ng build ping-pong-view-wc && yarn run build:wc:concat",
"build:wc": "ng build ping-pong-view-wc && pnpm build:wc:concat",
"build:wc:concat": "cat dist/wc/polyfills.js dist/wc/runtime.js dist/wc/main.js > dist/wc/index.js",
"build:wc-lib": "tsc --project tsconfig.lib.json"
},
Expand Down
6 changes: 3 additions & 3 deletions examples/ping-pong-view-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
},
"scripts": {
"copy:css": "copyfiles -u 1 \"src/**/*.{sass,scss,css}\" dist/",
"build": "rimraf dist && yarn copy:css && tsc",
"build:dev": "yarn run run-script-if --bool \"$(build-env global.build.examples)\" --then \"yarn run build\"",
"build:prod": "yarn run run-script-if --bool \"$(build-env global.build.examples)\" --then \"yarn run build\""
"build": "rimraf dist && pnpm copy:css && tsc",
"build:dev": "pnpm run-script-if --bool \"$(build-env global.build.examples)\" --then \"pnpm build\"",
"build:prod": "pnpm run-script-if --bool \"$(build-env global.build.examples)\" --then \"pnpm build\""
},
"dependencies": {
"@kie-tools-core/envelope-bus": "0.0.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/ping-pong-view/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"scripts": {
"build": "rimraf dist && tsc",
"build:dev": "yarn run run-script-if --bool \"$(build-env global.build.examples)\" --then \"yarn run build\"",
"build:prod": "yarn run run-script-if --bool \"$(build-env global.build.examples)\" --then \"yarn run build\""
"build:dev": "pnpm run-script-if --bool \"$(build-env global.build.examples)\" --then \"pnpm build\"",
"build:prod": "pnpm run-script-if --bool \"$(build-env global.build.examples)\" --then \"pnpm build\""
},
"dependencies": {
"@kie-tools-core/envelope": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/todo-list-view-vscode-extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ This extensions has the following commands:

## Building

Run `yarn run build:prod`. A `.vsix` file will be on the `dist` folder.
Run `pnpm build:prod`. A `.vsix` file will be on the `dist` folder.
10 changes: 5 additions & 5 deletions examples/todo-list-view-vscode-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
"*"
],
"scripts": {
"pack": "vsce package --yarn -o ./dist/kie_tools_examples_todo_list_view_$npm_package_version.vsix",
"compile": "yarn run build --env dev",
"watch": "yarn run build --env dev",
"pack": "vsce package --yarn -o ./dist/kie_tools_examples_todo_list_view_$npm_package_version.vsix",
"compile": "pnpm build --env dev",
"watch": "pnpm build --env dev",
"build": "rimraf dist && webpack",
"build:dev": "yarn run run-script-if --bool \"$(build-env global.build.examples)\" --then \"yarn run build --env dev\"",
"build:prod": "yarn run run-script-if --bool \"$(build-env global.build.examples)\" --then \"yarn run build\" \"yarn run pack\""
"build:dev": "pnpm run-script-if --bool \"$(build-env global.build.examples)\" --then \"pnpm build --env dev\"",
"build:prod": "pnpm run-script-if --bool \"$(build-env global.build.examples)\" --then \"pnpm build\" \"pnpm pack\""
},
"contributes": {
"menus": {
Expand Down
6 changes: 3 additions & 3 deletions examples/todo-list-view/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
},
"scripts": {
"copy:css": "copyfiles -u 1 \"src/**/*.{sass,scss,css}\" dist/",
"build": "rimraf dist && yarn copy:css && tsc",
"build:dev": "yarn run run-script-if --bool \"$(build-env global.build.examples)\" --then \"yarn run build\"",
"build:prod": "yarn run run-script-if --bool \"$(build-env global.build.examples)\" --then \"yarn run build\""
"build": "rimraf dist && pnpm copy:css && tsc",
"build:dev": "pnpm run-script-if --bool \"$(build-env global.build.examples)\" --then \"pnpm build\"",
"build:prod": "pnpm run-script-if --bool \"$(build-env global.build.examples)\" --then \"pnpm build\""
},
"dependencies": {
"@kie-tools-core/envelope": "0.0.0",
Expand Down
8 changes: 4 additions & 4 deletions examples/webapp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ To get more the details please take a look on each implementation:
To install all dependencies it's necessary to execute the following command on the root folder of the project:

```shell script
yarn run init
pnpm init
```

### Build

```shell script
yarn run build:fast // Normal build
yarn run build:prod // Optimized build, run TsLint
pnpm build:fast // Normal build
pnpm build:prod // Optimized build, run TsLint
```

### Run

```shell script
yarn run start // Starts the dev server on localhost:9001
pnpm start // Starts the dev server on localhost:9001
```
4 changes: 2 additions & 2 deletions examples/webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"private": true,
"scripts": {
"build": "rimraf dist && webpack",
"build:dev": "yarn run run-script-if --bool \"$(build-env global.build.examples)\" --then \"yarn run build --env dev\"",
"build:prod": "yarn run run-script-if --bool \"$(build-env global.build.examples)\" --then \"yarn run build\"",
"build:dev": "pnpm run-script-if --bool \"$(build-env global.build.examples)\" --then \"pnpm build --env dev\"",
"build:prod": "pnpm run-script-if --bool \"$(build-env global.build.examples)\" --then \"pnpm build\"",
"start": "webpack serve --host 0.0.0.0 --env dev"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": "0.0.0",
"packages": ["packages/*", "examples/*"],
"npmClient": "yarn",
"npmClient": "pnpm",
"useWorkspaces": true
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
]
},
"scripts": {
"install-dependencies": "pnpm install || echo 'Ignoring install errors'",
"bootstrap": "yarn install-dependencies && node ./scripts/link_packages_with_self.js",
"install-dependencies": "pnpm install --strict-peer-dependencies=false",
"bootstrap": "pnpm install-dependencies && node ./scripts/link_packages_with_self.js",
"build-env": "node packages/build-env/cli.js",
"env:print": "yarn build-env --print-env",
"env:vars": "yarn build-env --print-vars",
"env:print": "pnpm build-env --print-env",
"env:vars": "pnpm build-env --print-vars",
"update-version-to": "node ./scripts/update_version.js",
"format": "prettier --write .",
"format:check": "prettier --check .",
Expand Down
8 changes: 4 additions & 4 deletions packages/backend-extended-services/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command",
"lint": "echo 'Linting'",
"install:mvnw": "mvn wrapper:wrapper -f kogito-extended-services-quarkus",
"build:dev": "yarn install:mvnw && mvn clean install -DskipTests",
"build:prod:win32": "yarn install:mvnw && yarn powershell mvn clean install `-DskipTests=$(build-env global.build.test --not)",
"build:prod:darwin:linux": "yarn install:mvnw && mvn clean install -DskipTests=$(build-env global.build.test --not)",
"build:prod": "yarn lint && run-script-os"
"build:dev": "pnpm install:mvnw && mvn clean install -DskipTests",
"build:prod:win32": "pnpm install:mvnw && yarn powershell mvn clean install `-DskipTests=$(build-env global.build.test --not)",
"build:prod:darwin:linux": "pnpm install:mvnw && mvn clean install -DskipTests=$(build-env global.build.test --not)",
"build:prod": "pnpm lint && run-script-os"
}
}
6 changes: 3 additions & 3 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
"@kie-tools-core/run-script-if": "0.0.0"
},
"scripts": {
"lint": "yarn run run-script-if --bool \"$(build-env global.build.lint)\" --then \"yarn eslint ./src --ext .ts,.tsx\"",
"test": "yarn run run-script-if --bool \"$(build-env global.build.test)\" --then \"jest --silent --verbose --passWithNoTests\"",
"lint": "pnpm run-script-if --bool \"$(build-env global.build.lint)\" --then \"pnpm eslint ./src --ext .ts,.tsx\"",
"test": "pnpm run-script-if --bool \"$(build-env global.build.test)\" --then \"jest --silent --verbose --passWithNoTests\"",
"build:dev": "rimraf dist && tsc -p tsconfig.dev.json",
"build:prod": "yarn lint && rimraf dist && tsc -p tsconfig.prod.json && yarn test"
"build:prod": "pnpm lint && rimraf dist && tsc -p tsconfig.prod.json && pnpm test"
},
"babel": {
"presets": [
Expand Down
22 changes: 10 additions & 12 deletions packages/boxed-expression-component/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,36 @@ Consider that the showcase app is able to display the most updated JSON represen

## Scripts

In the main project (where the components actually live), it is possible to execute, from the root folder, the following scripts (`yarn` is recommended):
In the main project (where the components actually live), it is possible to execute, from the root folder, the following scripts (`pnpm` is recommended):

```sh
# Collect and build dependencies
yarn

# Remove 'dist' folder (such script is automatically called when the build is executed)
yarn prebuild
pnpm prebuild

# Build a production-ready artifact to be deployed
yarn build:prod
pnpm build:prod

# Execute all tests
yarn test
pnpm test

# Trigger static code analysis
yarn lint
pnpm lint

# Trigger type checking
yarn type-check
pnpm type-check

# Perform all the three checks above (tests, lint and type checking)
yarn quality-checks
pnpm quality-checks
```

In the showcase project, these scripts are available:

```sh
# Start a local server to see the 'BoxedExpressionEditor' in action
yarn start
pnpm start
# Compiles a production ready showcase application
yarn build
pnpm build
# Run cypress 'BoxedExpressionEditor' tests. To update the Cypress Snapshot files, used for the regression, remove the related png and rerun the tests to regenerate it.
yarn test:it
pnpm test:it
```
Loading

0 comments on commit 772f484

Please sign in to comment.