From 8da18f31a45f395e7e96d1f163689be9fae4e366 Mon Sep 17 00:00:00 2001 From: Animesh Kumar Date: Wed, 22 Nov 2023 00:26:57 +0530 Subject: [PATCH] update workflow, update dependencies,update script Changes: - update workflow to run JSON Schema validator - update `package.json` to include the validator - update directory path to run script from root of the project --- .github/workflows/if-nodejs-pr-testing.yml | 3 +++ package.json | 2 +- scripts/validate-schemas-final.js | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/if-nodejs-pr-testing.yml b/.github/workflows/if-nodejs-pr-testing.yml index 9ce9f9a1..46bdc34c 100644 --- a/.github/workflows/if-nodejs-pr-testing.yml +++ b/.github/workflows/if-nodejs-pr-testing.yml @@ -76,3 +76,6 @@ jobs: - if: steps.packagejson.outputs.exists == 'true' name: Run release assets generation to make sure PR does not break it run: npm run generate:assets --if-present + - if: steps.packagejson.outputs.exists == 'true' + name: Run JSON Schema Validator + run: npm run lint-schemas --if-present diff --git a/package.json b/package.json index 5b350ad3..4ee68d6f 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "prepublishOnly": "npm run build", "bundle": "cd tools/bundler && npm i && npm run bundle", "startNewVersion": "newVersion=$npm_config_new_version node scripts/add-new-version.js", - "lint": "node scripts/validate-schemas.js", + "lint": "npx eslint . --ext .js", "lint-schemas": "node scripts/validate-schemas-final.js", "bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION" }, diff --git a/scripts/validate-schemas-final.js b/scripts/validate-schemas-final.js index 3353d846..37cacad3 100644 --- a/scripts/validate-schemas-final.js +++ b/scripts/validate-schemas-final.js @@ -8,7 +8,7 @@ function validationDraft04(draft, startFileName, endFileName){ const ajv = new Ajv(); // Specify the path to the 'schemas' directory - const directoryPath = '../schemas'; + const directoryPath = './schemas'; const files = fs.readdirSync(directoryPath); @@ -57,7 +57,7 @@ function validation(draft, startFileName, excludedFiles){ const ajv = new Ajv(); // Specify the path to the 'schemas' directory - const directoryPath = '../schemas'; + const directoryPath = './schemas'; const files = fs.readdirSync(directoryPath);