Refactor validation tools and update related scripts#77522
Refactor validation tools and update related scripts#77522kushagra-goyal-14 wants to merge 5 commits intoWordPress:trunkfrom
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Hi @manzoorwanijk |
|
EDIT: Never mind. I thought this PR is trying to fix that same issue. |
Thanks. I’ll have a look at this soon. |
manzoorwanijk
left a comment
There was a problem hiding this comment.
Thank you for working on this. Let us tidy things a bit.
| "ajv": "8.17.1", | ||
| "chalk": "4.1.1", | ||
| "cross-spawn": "^7.0.6", | ||
| "glob": "7.1.2", | ||
| "jsonc-parser": "3.3.1", | ||
| "simple-git": "3.24.0" |
There was a problem hiding this comment.
Let us use the version ranges here and remove the deps that are not used in the workspace.
| "ajv": "8.17.1", | |
| "chalk": "4.1.1", | |
| "cross-spawn": "^7.0.6", | |
| "glob": "7.1.2", | |
| "jsonc-parser": "3.3.1", | |
| "simple-git": "3.24.0" | |
| "chalk": "^4.1.1", | |
| "glob": "^7.1.2", | |
| "jsonc-parser": "^3.3.1", | |
| "simple-git": "^3.24.0" |
| collectDeps, | ||
| readPackageJson, | ||
| } from '../packages/scripts/utils/license.js'; | ||
| } from '../../packages/scripts/utils/license.js'; |
There was a problem hiding this comment.
Let us add @wordpress/scripts as a dev dependency to this workspace and the use @wordpress/scripts/utils/license.js here.
| "gutenberg", | ||
| "api-docs" | ||
| ], | ||
| "homepage": "https://github.com/WordPress/gutenberg/tree/HEAD/tools/validation/README.md", |
There was a problem hiding this comment.
The README doesn't exist.
| "keywords": [ | ||
| "wordpress", | ||
| "gutenberg", | ||
| "api-docs" |
There was a problem hiding this comment.
This keyword doesn't seem to be relevant.
| "test/unit", | ||
| "tools/api-docs" | ||
| "tools/api-docs", | ||
| "tools/validation" |
There was a problem hiding this comment.
Once you update this branch from trunk, you won't need this change here.
| "lint:lockfile": "npm run validate-package-lock --workspace @wordpress/validation-tools --", | ||
| "lint:tsconfig": "npm run validate-tsconfig --workspace @wordpress/validation-tools --", |
There was a problem hiding this comment.
It's better to have --workspace argument before the other arguments, just in case the script accepts arguments.
| import JSONC from 'jsonc-parser'; | ||
| import { readFileSync } from 'fs'; | ||
|
|
||
| let hasErrors = false; | ||
|
|
||
| const rootTsconfigJson = JSON.parse( readFileSync( 'tsconfig.json', 'utf8' ) ); |
There was a problem hiding this comment.
I am surprised we had this here as tsconfig can have comments which JSON.parse cannot handle.
| @@ -0,0 +1,42 @@ | |||
| { | |||
| "name": "@wordpress/validation-tools", | |||
| "version": "1.0.0", | |||
There was a problem hiding this comment.
Let us use version 0
| "version": "1.0.0", | |
| "version": "0.0.0", |
What?
Part of #75041
Why?
The issue provides more context, but in short, this PR ensures the workspace package does not rely on root dependencies once dependency isolation is enforced.
How?
This PR converts validation tools into a new workspace
@wordpress/validation-toolswhile still relating the functionality.Testing Instructions
Testing Instructions for Keyboard
npm run lint:lockfilenpm run lint:tsconfignpm run other:check-local-changesnpm run other:check-licensesor
npm run lint