-
-
Notifications
You must be signed in to change notification settings - Fork 620
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'next' into ref/basic-group
- Loading branch information
Showing
21 changed files
with
141 additions
and
110 deletions.
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
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
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,22 @@ | ||
const regex = /[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g; | ||
|
||
/** | ||
* Convert str to kebab-case | ||
* @param str input string | ||
* @returns output string | ||
*/ | ||
export function toKebabCase(str: string): string { | ||
return str.match(regex).join('-').toLowerCase(); | ||
} | ||
|
||
/** | ||
* Convert str to UpperCamelCase | ||
* @param str import string | ||
* @returns {string} output string | ||
*/ | ||
export function toUpperCamelCase(str: string): string { | ||
return str | ||
.match(regex) | ||
.map((x) => x.slice(0, 1).toUpperCase() + x.slice(1).toLowerCase()) | ||
.join(''); | ||
} |
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
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
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
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 was deleted.
Oops, something went wrong.
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,19 @@ | ||
const resolveStats = require('../lib/groups/resolveStats'); | ||
|
||
describe('StatsGroup', function () { | ||
it('should assign json correctly', () => { | ||
const result = resolveStats({ | ||
json: true, | ||
}); | ||
expect(result.options.stats).toBeFalsy(); | ||
expect(result.outputOptions.json).toBeTruthy(); | ||
}); | ||
|
||
it('should assign stats correctly', () => { | ||
const result = resolveStats({ | ||
stats: 'warning', | ||
}); | ||
expect(result.options.stats).toEqual('warning'); | ||
expect(result.outputOptions.json).toBeFalsy(); | ||
}); | ||
}); |
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 was deleted.
Oops, something went wrong.
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,22 @@ | ||
/** | ||
* Resolve flags which deal with compilation stats | ||
* @param {args} args - Parsed args passed to CLI | ||
*/ | ||
const resolveStats = (args) => { | ||
const { stats, json } = args; | ||
|
||
const finalOptions = { | ||
options: {}, | ||
outputOptions: {}, | ||
}; | ||
|
||
if (stats !== undefined) { | ||
finalOptions.options.stats = stats; | ||
} | ||
if (json) { | ||
finalOptions.outputOptions.json = true; | ||
} | ||
return finalOptions; | ||
}; | ||
|
||
module.exports = resolveStats; |
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
Oops, something went wrong.