forked from w3c/spec-prod
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add .editorconfig, .prettierrc and use shfmt - reorder exports from utils.js - use tabs instead of spaces in JS - keep using 4-spaces in shell scripts
- Loading branch information
1 parent
782f1d8
commit 1063d38
Showing
10 changed files
with
125 additions
and
112 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
indent_style = tab | ||
tab_width = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true |
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,7 @@ | ||
{ | ||
"arrowParens": "avoid", | ||
"singleQuote": false, | ||
"trailingComma": "all", | ||
"tabWidth": 2, | ||
"useTabs": true | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,74 @@ | ||
// @ts-check | ||
const { execSync } = require('child_process'); | ||
const { execSync } = require("child_process"); | ||
|
||
/** | ||
* @param {string} path | ||
*/ | ||
function addPath(path) { | ||
console.log(`::add-path::${path}`); | ||
} | ||
|
||
/** | ||
* @param {string} message | ||
* @param {number} [code] | ||
*/ | ||
function exit(message, code = 1) { | ||
if (code === 0) { | ||
console.log(message); | ||
} else { | ||
console.error(message); | ||
} | ||
process.exit(code); | ||
if (code === 0) { | ||
console.log(message); | ||
} else { | ||
console.error(message); | ||
} | ||
process.exit(code); | ||
} | ||
|
||
/** | ||
* @param {string} path | ||
* @param {string} text | ||
*/ | ||
function addPath(path) { | ||
console.log(`::add-path::${path}`); | ||
function formatAsHeading(text) { | ||
const marker = "=".repeat(Math.max(50, text.length)); | ||
return `${marker}\n${text}:\n${marker}`; | ||
} | ||
|
||
/** | ||
* @param {string} key | ||
* @param {string} value | ||
*/ | ||
function setEnv(key, value) { | ||
console.log(`::set-env name=${key}::${value}`); | ||
console.log(`::set-env name=${key}::${value}`); | ||
} | ||
|
||
/** | ||
* @param {string} key | ||
* @param {string} value | ||
*/ | ||
function setOutput(key, value) { | ||
console.log(`::set-output name=${key}::${value}`); | ||
} | ||
|
||
/** | ||
* @param {string} text | ||
*/ | ||
function formatAsHeading(text) { | ||
const marker = '='.repeat(Math.max(50, text.length)); | ||
return `${marker}\n${text}:\n${marker}`; | ||
} | ||
|
||
function yesOrNo(value) { | ||
const str = String(value).trim(); | ||
if (/^(?:y|yes|true|1|on)$/i.test(str)) { | ||
return true; | ||
} | ||
if (/^(?:n|no|false|0|off)$/i.test(value)) { | ||
return false; | ||
} | ||
console.log(`::set-output name=${key}::${value}`); | ||
} | ||
|
||
/** | ||
* Synchronously run a shell command get its result. | ||
* @param {string} command | ||
*/ | ||
function sh(command, options = {}) { | ||
return execSync(command, { encoding: 'utf-8', ...options }).trim(); | ||
return execSync(command, { encoding: "utf-8", ...options }).trim(); | ||
} | ||
|
||
function yesOrNo(value) { | ||
const str = String(value).trim(); | ||
if (/^(?:y|yes|true|1|on)$/i.test(str)) { | ||
return true; | ||
} | ||
if (/^(?:n|no|false|0|off)$/i.test(value)) { | ||
return false; | ||
} | ||
} | ||
|
||
module.exports = { | ||
exit, | ||
addPath, | ||
setEnv, | ||
setOutput, | ||
formatAsHeading, | ||
yesOrNo, | ||
sh, | ||
addPath, | ||
exit, | ||
formatAsHeading, | ||
setEnv, | ||
setOutput, | ||
sh, | ||
yesOrNo, | ||
}; |
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