-
Notifications
You must be signed in to change notification settings - Fork 0
(feat): add missing @babel/preset-react dependency and add @Sage alia #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,30 @@ | ||
| { | ||
| "name": "@yardinternet/eslint-config", | ||
| "version": "1.0.1", | ||
| "description": "Eslint configuration", | ||
| "main": "src/index.js", | ||
| "scripts": { | ||
| "test": "echo \"Error: no test specified\" && exit 1" | ||
| }, | ||
| "publishConfig": { | ||
| "registry": "https://npm.pkg.github.com/" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/yardinternet/toolkit.git", | ||
| "directory": "packages/eslint-config" | ||
| }, | ||
| "type": "commonjs", | ||
| "author": "", | ||
| "license": "ISC", | ||
| "dependencies": { | ||
| "@eslint/eslintrc": "^3.2.0", | ||
| "@eslint/js": "^9.17.0", | ||
| "@wordpress/eslint-plugin": "^22.1.1", | ||
| "eslint-config-prettier": "^9.1.0", | ||
| "globals": "^15.14.0" | ||
| } | ||
| "name": "@yardinternet/eslint-config", | ||
| "version": "1.0.1", | ||
| "description": "Eslint configuration", | ||
| "main": "src/index.js", | ||
| "scripts": { | ||
| "test": "echo \"Error: no test specified\" && exit 1" | ||
| }, | ||
| "publishConfig": { | ||
| "registry": "https://npm.pkg.github.com/" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/yardinternet/toolkit.git", | ||
| "directory": "packages/eslint-config" | ||
| }, | ||
| "type": "commonjs", | ||
| "author": "", | ||
| "license": "ISC", | ||
| "dependencies": { | ||
| "@babel/preset-react": "^7.27.1", | ||
| "@eslint/eslintrc": "^3.2.0", | ||
| "@eslint/js": "^9.17.0", | ||
| "@wordpress/eslint-plugin": "^22.1.1", | ||
| "eslint-config-prettier": "^9.1.0", | ||
| "eslint-import-resolver-alias": "^1.1.2", | ||
| "eslint-plugin-import": "^2.32.0", | ||
| "globals": "^15.14.0" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,38 @@ | ||
| { | ||
| "name": "@yardinternet/toolkit", | ||
| "version": "1.0.3", | ||
| "description": "Yard toolkit CLI scripts", | ||
| "bin": { | ||
| "yard-toolkit": "./src/index.js" | ||
| }, | ||
| "scripts": { | ||
| "test": "echo \"Error: no test specified\" && exit 1" | ||
| }, | ||
| "publishConfig": { | ||
| "registry": "https://npm.pkg.github.com/" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/yardinternet/toolkit.git", | ||
| "directory": "packages/toolkit" | ||
| }, | ||
| "type": "module", | ||
| "author": "", | ||
| "license": "ISC", | ||
| "dependencies": { | ||
| "@wordpress/scripts": "^30.9.0", | ||
| "chalk": "^5.4.1", | ||
| "meow": "^13.2.0" | ||
| }, | ||
| "optionalDependencies": { | ||
| "@yardinternet/eslint-config": "^1.0.1", | ||
| "@yardinternet/prettier-config": "^1.0.2", | ||
| "@yardinternet/stylelint-config": "^1.0.1" | ||
| } | ||
| "name": "@yardinternet/toolkit", | ||
| "version": "1.0.3", | ||
| "description": "Yard toolkit CLI scripts", | ||
| "bin": { | ||
| "yard-toolkit": "./src/index.js" | ||
| }, | ||
| "scripts": { | ||
| "test": "echo \"Error: no test specified\" && exit 1" | ||
| }, | ||
| "publishConfig": { | ||
| "registry": "https://npm.pkg.github.com/" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/yardinternet/toolkit.git", | ||
| "directory": "packages/toolkit" | ||
| }, | ||
| "type": "module", | ||
| "author": "", | ||
| "license": "ISC", | ||
| "dependencies": { | ||
| "@babel/preset-react": "^7.27.1", | ||
| "chalk": "^5.4.1", | ||
| "eslint": "^9.32.0", | ||
| "meow": "^13.2.0", | ||
| "prettier": "npm:wp-prettier@^3.0.3", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was dit dus toch nodig voor de override? Of is dit voor de verbositeit?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nu nodig omdat we
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nu je het zegt, kunnen we de |
||
| "stylelint": "^16.23.0" | ||
| }, | ||
| "optionalDependencies": { | ||
| "@yardinternet/eslint-config": "*", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is any version wel handig? Zo meteen ontstaan er in de toekomst compatibiliteit problemen in oude projecten (een oude versie an de Toolkit CLI maar een nieuwe config). Anderzijds is het wel handig dat het dan automatisch 'geüpdatet' zonder dat je een nieuwe versie moet uitbrengen.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ja dat laatste. Als de toolkit geupdatet wordt in een project, doen we dat vaak via zo'n command die alle Het is dan apart dat hier bij |
||
| "@yardinternet/prettier-config": "*", | ||
| "@yardinternet/stylelint-config": "*" | ||
| }, | ||
| "overrides": { | ||
| "prettier": "npm:wp-prettier@^3.0.3" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,38 @@ | ||
| import { spawn } from 'child_process'; | ||
|
|
||
| import { | ||
| filetypeFromString, | ||
| getGlobByFormatModeAndFiletype, | ||
| modesFromString, | ||
| run, | ||
| error, | ||
| } from '../utils/helpers.js'; | ||
|
|
||
| export const format = ( options, filetype, userPath ) => { | ||
| const formatFiletype = filetypeFromString( filetype, true ); | ||
| const formatMode = modesFromString( options.mode, true ); | ||
|
|
||
| const command = 'wp-scripts format'; | ||
| const command = 'prettier'; | ||
|
|
||
| const glob = getGlobByFormatModeAndFiletype( | ||
| formatMode, | ||
| formatFiletype.name | ||
| ); | ||
|
|
||
| run( `${ command } ${ glob?.path ?? '' } ${ userPath ?? '' }`, 'format' ); | ||
| const args = [ | ||
| ...( glob?.path ? [ glob.path ] : [] ), | ||
| ...( userPath ? [ userPath ] : [] ), | ||
| '--check', | ||
| '--write', | ||
| ]; | ||
|
Comment on lines
+14
to
+26
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dit was trouwens het probleem waar we eerder tegenaan liepen. Met
Terwijl we die wel nodig hadden voor het command
Met
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interessant, glob?.path is toch gewoon een string. Dus Wellicht kan deze logica nog weg geabstraheerd worden naar een helper of wellicht in run (of niet :) )
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, |
||
|
|
||
| const child = spawn( command, args, { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is het niet beter om de exec in de run helper gewoon te vervangen voor de deze spawn functie? De functionaliteit is toch het zelfde? Alleen de logs worden wel getoond
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Laat maar ik zie nu je opmerking hierover: https://github.com/yardinternet/toolkit/pull/44/files#r2239860906 |
||
| stdio: 'inherit', | ||
| shell: true, // required for glob support like {*,**/*}.css | ||
| } ); | ||
|
|
||
| child.on( 'exit', ( code ) => { | ||
| if ( code !== 0 ) { | ||
| error( `Prettier exited with code ${ code }` ); | ||
| } | ||
| } ); | ||
|
Comment on lines
+21
to
+37
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ik ga dit nog herschrijven, want dubbele code met |
||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,10 @@ | ||
| import { spawn } from 'child_process'; | ||
|
|
||
| import { | ||
| error, | ||
| filetypeFromString, | ||
| getGlobByFormatModeAndFiletype, | ||
| modesFromString, | ||
| run, | ||
| } from '../utils/helpers.js'; | ||
| import { filetypes } from '../config/filetypes.js'; | ||
| import { options as configOptions } from '../config/options.js'; | ||
|
|
@@ -21,7 +22,7 @@ export const lint = ( options, filetype, userPath ) => { | |
| break; | ||
| case filetypes.scss.name: | ||
| case filetypes.css.name: | ||
| command = 'wp-scripts lint-style'; | ||
| command = 'stylelint'; | ||
| break; | ||
| default: | ||
| error( | ||
|
|
@@ -34,10 +35,20 @@ export const lint = ( options, filetype, userPath ) => { | |
| formatFiletype.name | ||
| ); | ||
|
|
||
| run( | ||
| `${ command } ${ glob?.path ?? '' } ${ userPath ?? '' } ${ | ||
| isFix ? '--fix' : '' | ||
| }`, | ||
| 'lint' | ||
| ); | ||
| const args = [ | ||
| ...( glob?.path ? [ glob.path ] : [] ), | ||
| ...( userPath ? [ userPath ] : [] ), | ||
| ...( isFix ? [ '--fix' ] : [] ), | ||
| ]; | ||
|
|
||
| const child = spawn( command, args, { | ||
| stdio: 'inherit', | ||
| shell: true, // Required for glob support | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. interessant dat je daar een optie voor moet mee geven. Ik zal denken dat dat gewoon binnen de 'stylelint' code wordt afgehandeld
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://nodejs.org/api/child_process.html#child_processspawncommand-args-options
|
||
| } ); | ||
|
|
||
| child.on( 'exit', ( code ) => { | ||
| if ( code !== 0 ) { | ||
| error( `${ command } exited with code ${ code }` ); | ||
| } | ||
| } ); | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ export const modes = { | |
| }, | ||
| { | ||
| filetype: filetypes.css.name, | ||
| path: './web/app/themes/**/resources/styles/**/*.css', | ||
| path: './web/app/themes/**/resources/styles/{*,**/*}.css', | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Met |
||
| }, | ||
| ], | ||
| }, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dit is neem ik aan zodat hij Vite begrijpt? Ik neem aan dat het geen probleem is als deze config in een project met webpack wordt gebruikt, tock?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ook in oude projecten gaat dit fout en gaat de linter kapot
Dit is bijv. hier https://github.com/yardinternet/brave-scaffold/blob/main/stubs/sage-child/resources/scripts/frontend/frontend.js