Skip to content

Commit

Permalink
fix(cli-plugin-dependencies): verify dependencies (#4483)
Browse files Browse the repository at this point in the history
  • Loading branch information
brunozoric authored Jan 9, 2025
1 parent 621f49c commit ebf90f6
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 25 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/pullRequests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# and run "github-actions-wac build" (or "ghawac build") to regenerate this file.
# For more information, run "github-actions-wac --help".
name: Pull Requests
"on": pull_request
'on': pull_request
concurrency:
group: pr-${{ github.event.pull_request.number }}
cancel-in-progress: true
Expand All @@ -19,7 +19,7 @@ jobs:
- uses: webiny/[email protected]
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max_old_space_size=4096"
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
validateCommitsDev:
name: Validate commit messages (dev branch, 'feat' commits not allowed)
Expand All @@ -34,7 +34,7 @@ jobs:
allowed-commit-types: fix,docs,style,refactor,test,build,perf,ci,chore,revert,merge,wip
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max_old_space_size=4096"
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
constants:
name: Create constants
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
$GITHUB_OUTPUT
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max_old_space_size=4096"
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
assignMilestone:
name: Assign milestone
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
milestone: ${{ steps.get-milestone-to-assign.outputs.milestone }}
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max_old_space_size=4096"
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
build:
name: Build
Expand Down Expand Up @@ -149,7 +149,7 @@ jobs:
path: ${{ github.base_ref }}/.webiny/cached-packages
key: ${{ needs.constants.outputs.run-cache-key }}
env:
NODE_OPTIONS: "--max_old_space_size=4096"
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
staticCodeAnalysis:
needs:
Expand Down Expand Up @@ -190,7 +190,7 @@ jobs:
working-directory: ${{ github.base_ref }}
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max_old_space_size=4096"
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
staticCodeAnalysisTs:
name: Static code analysis (TypeScript)
Expand All @@ -216,7 +216,7 @@ jobs:
run: yarn cy:ts
working-directory: ${{ github.base_ref }}
env:
NODE_OPTIONS: "--max_old_space_size=4096"
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
jestTestsNoStorageConstants:
needs:
Expand Down Expand Up @@ -244,7 +244,7 @@ jobs:
echo '${{
steps.list-packages-to-jest-test.outputs.packages-to-jest-test }}'
env:
NODE_OPTIONS: "--max_old_space_size=4096"
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
jestTestsNoStorageRun:
needs:
Expand All @@ -265,7 +265,7 @@ jobs:
}}
runs-on: ${{ matrix.os }}
env:
NODE_OPTIONS: "--max_old_space_size=4096"
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
AWS_REGION: eu-central-1
if: needs.jestTestsNoStorageConstants.outputs.packages-to-jest-test != '[]'
Expand Down Expand Up @@ -363,7 +363,7 @@ jobs:
echo '${{
steps.list-packages-to-jest-test.outputs.packages-to-jest-test }}'
env:
NODE_OPTIONS: "--max_old_space_size=4096"
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
jestTestsddbRun:
needs:
Expand All @@ -383,7 +383,7 @@ jobs:
fromJson(needs.jestTestsddbConstants.outputs.packages-to-jest-test) }}
runs-on: ${{ matrix.os }}
env:
NODE_OPTIONS: "--max_old_space_size=4096"
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
AWS_REGION: eu-central-1
if: needs.jestTestsddbConstants.outputs.packages-to-jest-test != '[]'
Expand Down Expand Up @@ -480,7 +480,7 @@ jobs:
echo '${{
steps.list-packages-to-jest-test.outputs.packages-to-jest-test }}'
env:
NODE_OPTIONS: "--max_old_space_size=4096"
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
jestTestsddb-esRun:
needs:
Expand All @@ -501,7 +501,7 @@ jobs:
}}
runs-on: ${{ matrix.os }}
env:
NODE_OPTIONS: "--max_old_space_size=4096"
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
AWS_REGION: eu-central-1
AWS_ELASTIC_SEARCH_DOMAIN_NAME: ${{ secrets.AWS_ELASTIC_SEARCH_DOMAIN_NAME }}
Expand Down Expand Up @@ -610,7 +610,7 @@ jobs:
echo '${{
steps.list-packages-to-jest-test.outputs.packages-to-jest-test }}'
env:
NODE_OPTIONS: "--max_old_space_size=4096"
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
jestTestsddb-osRun:
needs:
Expand All @@ -631,7 +631,7 @@ jobs:
}}
runs-on: ${{ matrix.os }}
env:
NODE_OPTIONS: "--max_old_space_size=4096"
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
AWS_REGION: eu-central-1
AWS_ELASTIC_SEARCH_DOMAIN_NAME: ${{ secrets.AWS_OPEN_SEARCH_DOMAIN_NAME }}
Expand Down
1 change: 1 addition & 0 deletions packages/cli-plugin-dependencies/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"dependencies": {
"@babel/runtime": "^7.26.0",
"@webiny/cli": "0.0.0",
"chalk": "^4.1.2",
"get-yarn-workspaces": "^1.0.2",
"glob": "^7.2.3",
"load-json-file": "^6.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ export class DependencyTree implements IDependencyTree {
const semverVersion =
semver.validRange(version) || version === "beta" ? version : null;
if (!semverVersion) {
console.log(
`${version} is not a valid SemVer value in ${file}, package ${name}.`
);
process.env.DEBUG === "true" &&
console.debug(
`${version} is not a valid SemVer value in ${file}, package ${name}.`
);
continue;
}
version = version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { IDependencyTree } from "~/types";
import loadJsonFile from "load-json-file";
import { getDuplicatesFilePath, getReferencesFilePath } from "~/references/files";
import fs from "fs";
import { green } from "chalk";

export interface IVerifyDependenciesParams {
tree: IDependencyTree;
Expand All @@ -26,6 +27,8 @@ export const verifyDependencies = (params: IVerifyDependenciesParams): void => {
references: tree.references
};

console.log("Checking references file...");

if (fs.existsSync(referencesFile)) {
const json = loadJsonFile.sync(referencesFile);
if (JSON.stringify(references) !== JSON.stringify(json)) {
Expand All @@ -39,6 +42,8 @@ export const verifyDependencies = (params: IVerifyDependenciesParams): void => {
);
}

console.log("Checking duplicates file...");

if (fs.existsSync(duplicatesFile)) {
const json = loadJsonFile.sync(duplicatesFile);
if (JSON.stringify(tree.duplicates) !== JSON.stringify(json)) {
Expand All @@ -52,5 +57,5 @@ export const verifyDependencies = (params: IVerifyDependenciesParams): void => {
);
}

console.log("All package reference files are in sync.");
console.log(green("✅ All package reference files are in sync."));
};
2 changes: 1 addition & 1 deletion packages/cli/files/references.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/system-requirements/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"dependencies": {
"chalk": "^4.1.2",
"cli-table3": "^0.6.5",
"execa": "^5.0.0",
"semver": "^7.3.5"
"execa": "^5.1.1",
"semver": "^7.6.3"
},
"license": "MIT",
"publishConfig": {
Expand Down
5 changes: 3 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15087,6 +15087,7 @@ __metadata:
"@babel/runtime": "npm:^7.26.0"
"@webiny/cli": "npm:0.0.0"
"@webiny/project-utils": "npm:0.0.0"
chalk: "npm:^4.1.2"
execa: "npm:^5.1.1"
get-yarn-workspaces: "npm:^1.0.2"
glob: "npm:^7.2.3"
Expand Down Expand Up @@ -16262,8 +16263,8 @@ __metadata:
dependencies:
chalk: "npm:^4.1.2"
cli-table3: "npm:^0.6.5"
execa: "npm:^5.0.0"
semver: "npm:^7.3.5"
execa: "npm:^5.1.1"
semver: "npm:^7.6.3"
bin:
webiny: ./bin.js
languageName: unknown
Expand Down

0 comments on commit ebf90f6

Please sign in to comment.