Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(yarn): migrate from v1.2.17 to v3.6.0
We hope to solve issues with this that were plaguing contributors due to bugs in the much older Yarn 1.x versions that we had to use because Yarn V3 had it's own set of problems when it came to linking the .bin folders for child packages in a monorepo. 1. We've moved from hoisting by default to NOT hoisting by default for all packages which results in slightly slower installs for the dependencies when setting up the project build but it does have the beneficial effect of much easier fixes for compiler errors because each package can be provided with their own version of whatever dependencies they need. 2. The "pre" and "post" npm scripts are no longer supported by Yarn which was an annoying breaking change so we had to restructure some of the scripts which had pre and post scripts of their own to get equal behavior. 3. Upgraded to Yarn v3.6.0 4. packages/cactus-api-client/src/main/typescript/socketio-api-client.ts has a line where the Typescript compiler has been disabled and an issue opened for the same: https://github.com/hyperledger/cacti/issues/2523 5. Added several missing dependencies to the individual package.json files of the packages. These were resolving fine earlier because of hoisting but the problem of undeclared dependencies went undetected because of this convenience feature of the NodeJS module resolution algorithm. Now, instead of having to catch these problems in production, we can fix them up-front at development time which is great because there were dozens of them! 6. Migrated from `import` to `import type` in a few places in the code where it was applicable and useful: when you only import a dependency via `import type` then it's safe to move it to "devDependencies" because at runtime the `import type` syntax is completely omitted by the compiler. 7. Refactored the importing of "internal-ip" in a couple of test cases because the newer version does not export `v4` and `v6` but instead `internalIpV4`. 7. Renamed 2 environment variables that are used by ci.yaml to control the steps taken by ci.sh because they had a `YARN_` prefix in their names that Yarn v3 appears to be automatically parsing and assuming to be configuration for itself - which then leads to crashes because it does not recognize the custom variable name that is not meant for it. The variables renamed are: `TOOLS_VALIDATE_BUNDLE_NAMES_DISABLED` and `CUSTOM_CHECKS_DISABLED` 8. The configure script now runs the init-registries sub-script via npm instead of yarn because yarn is unable to run scripts prior to having ran a yarn install on a fresh clone (which was making the configure script bail out on the CI) 9. The `--mode=skip-build` parameter is specified for yarn in the configure script so that during installation it doesn't spend an extra 15 minutes compiling dependencies with native code in them. Yarn v1 did not do this by default and therefore it is assumed that it should work fine for v3 as well, but this is by no means a guarantee that it will work in all cases. 10. Updated the artillery binary path to be relatively qualified instead of just the binary file's name in the test case that does the API server benchmarking in packages/cactus-cmd-api-server/src/test/typescript/benchmark/artillery-api-benchmark.test.ts so now the binary's path is specified explicitly as ./packages/cactus-cmd-api-server/node_modules/artillery/bin/artillery which is the new path on account of us turning off t he hoisting of the dependencies entirely for the project (e.g. the binary is no longer in the rood node_modules directory) Fixes #1142 Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
- Loading branch information