-
Notifications
You must be signed in to change notification settings - Fork 11
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
Support config file for arguments #9
Merged
Merged
Changes from 57 commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
f665a5d
feat: add demo config file
laras126 5cd1145
feat: kinda working with simplified config
laras126 9d22899
refact: abstracting so we can test
laras126 d006d3d
refact: move cli code to index
laras126 49f2424
test: add okay test for running audits
laras126 2093185
fix: add audit key
laras126 77abd7c
Merge branch 'master' into feature/config
laras126 9b63b85
feat: support property values
laras126 8f9447c
chore: format js
laras126 92a1cd3
fix: linter fixes
laras126 1ea0384
chore: nvmrc and package lock
laras126 72f9aaf
Merge branch 'master' of github.com:ryelle/css-audit
laras126 486b6e3
Merge branch 'master' into feature/config
laras126 4560344
Merge branch 'master' of github.com:ryelle/css-audit
laras126 f6a6a18
Merge branch 'master' into feature/config
laras126 de02b3a
test: cli test for get arg
laras126 0ec24cf
feat: working through cases for get arg
laras126 3304463
feat: working fns in test!
laras126 ccbe828
test: passing for config fallback
laras126 3369fa1
feat: move fns out of test
laras126 8629201
feat: try adding github workflow for tests
laras126 a2cf2c2
fix: node version
laras126 7709820
test: skip failing and ignore fixtures
laras126 c5c8561
fix: format js
laras126 99c1920
fix: add additional prettier paths
laras126 b78fad8
feat: update getArg calls, better names
laras126 973db0e
fix: option for cliOnly in getArg
laras126 cf9a85d
chore: incl root js in prettier
laras126 296c20a
fix: typo
laras126 d69b01b
fix: return new arr
laras126 475867c
fix: consolidate run audits, but confused
laras126 997efb6
refact: clean up tests, some passing
laras126 3532544
reafct: use array methods and fix bugs
laras126 71c696e
fix: update test, support for multiple property values
laras126 0086dda
fix: use all in config
laras126 d9131df
fix: update config
laras126 dbec2a2
Merge branch 'master' of github.com:ryelle/css-audit
laras126 7297326
Merge branch 'master' into feature/config
laras126 72d224e
feat: hook up template
laras126 6677eab
fix: format js
laras126 b611af1
fix: rm erroneous autofill
laras126 754c9e8
fix: rm github workflows and test skip
laras126 d139cce
Merge branch 'master' into feature/config
laras126 ce26910
fix: return full object in json format for test
laras126 3dcba21
feat: add cosmiconfig
laras126 af0dea2
Merge branch 'master' of github.com:ryelle/css-audit
laras126 a75cc3b
Merge branch 'master' into feature/config
laras126 0529d79
fix: issue with test config location
laras126 22bcaf5
fix: linter and format
laras126 f57cfeb
feat: add more property value audits
laras126 14726f1
fix: rename file
laras126 cb9737f
fix: bugs
laras126 f5baae4
fix: format
laras126 56cec52
doc: update readme
laras126 accfad6
fix: name change, build html
laras126 7f97c69
fix: PR feedback
laras126 3940bca
fix: format
laras126 c10f2ed
Merge branch 'master' into feature/config
ryelle File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
14 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
format: 'html', | ||
all: true, | ||
filename: 'wp-admin', | ||
audits: [ [ 'property-values', 'font-size' ] ], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* Node dependencies | ||
*/ | ||
const fs = require( 'fs' ); | ||
const path = require( 'path' ); | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
const { runAudits } = require( './src/run' ); | ||
const { getArg, getFileArgsFromCLI, getHelp } = require( './src/utils/cli' ); | ||
|
||
const input = getFileArgsFromCLI(); | ||
|
||
if ( getArg( '--help', true ) || ! input.length ) { | ||
console.log( getHelp() ); | ||
process.exit( 0 ); | ||
} | ||
|
||
const cssFiles = []; | ||
input.forEach( ( file ) => { | ||
const filePath = path.resolve( process.env.INIT_CWD, file ); | ||
const stats = fs.statSync( filePath ); | ||
if ( stats.isDirectory() ) { | ||
return; | ||
} | ||
if ( file.match( /min\.css$/ ) ) { | ||
return; | ||
} | ||
cssFiles.push( { | ||
name: file, | ||
content: String( fs.readFileSync( filePath ) ), | ||
} ); | ||
} ); | ||
|
||
const result = runAudits( cssFiles ); | ||
|
||
console.log( result ); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think I'd rather leave the
all
property out of the config file - it was intended as a shortcut for the CLI command, but in a config file I think it would be better to list out each audit intentionally.This doesn't need any special handling, I think we can just remove it from this file.