chore: code formatting

This commit is contained in:
github-actions[bot]
2022-01-17 03:17:11 +00:00
parent b935d11be0
commit 6722685bce
3 changed files with 8 additions and 8 deletions

View File

@@ -39,7 +39,7 @@ for (const id of Object.keys(plugins)) {
readme.path, readme.path,
readme.content readme.content
.replace(/(<!--header-->)[\s\S]*(<!--\/header-->)/g, `$1\n${header}\n$2`) .replace(/(<!--header-->)[\s\S]*(<!--\/header-->)/g, `$1\n${header}\n$2`)
.replace(/(<!--examples-->)[\s\S]*(<!--\/examples-->)/g, `$1\n${examples.map(({ test, prod, ...step }) => ["```yaml", yaml.dump(step, {quotingType:'"', noCompatMode:true}), "```"].join("\n")).join("\n")}\n$2`) .replace(/(<!--examples-->)[\s\S]*(<!--\/examples-->)/g, `$1\n${examples.map(({ test, prod, ...step }) => ["```yaml", yaml.dump(step, { quotingType: '"', noCompatMode: true }), "```"].join("\n")).join("\n")}\n$2`)
.replace(/(<!--options-->)[\s\S]*(<!--\/options-->)/g, `$1\n${options}\n$2`), .replace(/(<!--options-->)[\s\S]*(<!--\/options-->)/g, `$1\n${options}\n$2`),
) )
console.log(`Generating source/plugins/${community ? "community/" : ""}${id}/README.md`) console.log(`Generating source/plugins/${community ? "community/" : ""}${id}/README.md`)
@@ -59,13 +59,13 @@ for (const id of Object.keys(templates)) {
readme.path, readme.path,
readme.content readme.content
.replace(/(<!--header-->)[\s\S]*(<!--\/header-->)/g, `$1\n${header}\n$2`) .replace(/(<!--header-->)[\s\S]*(<!--\/header-->)/g, `$1\n${header}\n$2`)
.replace(/(<!--examples-->)[\s\S]*(<!--\/examples-->)/g, `$1\n${examples.map(({ test, prod, ...step }) => ["```yaml", yaml.dump(step, {quotingType:'"', noCompatMode:true}), "```"].join("\n")).join("\n")}\n$2`), .replace(/(<!--examples-->)[\s\S]*(<!--\/examples-->)/g, `$1\n${examples.map(({ test, prod, ...step }) => ["```yaml", yaml.dump(step, { quotingType: '"', noCompatMode: true }), "```"].join("\n")).join("\n")}\n$2`),
) )
console.log(`Generating source/templates/${id}/README.md`) console.log(`Generating source/templates/${id}/README.md`)
//Tests //Tests
workflow.push(...examples.map(example => testcase(templates[id].name, "prod", example)).filter(t => t)) workflow.push(...examples.map(example => testcase(templates[id].name, "prod", example)).filter(t => t))
await fs.writeFile(tests.path, yaml.dump(examples.map(example => testcase(templates[id].name, "test", example)).filter(t => t), {quotingType:'"', noCompatMode:true})) await fs.writeFile(tests.path, yaml.dump(examples.map(example => testcase(templates[id].name, "test", example)).filter(t => t), { quotingType: '"', noCompatMode: true }))
console.log(`Generating tests/templates/${id}.yml`) console.log(`Generating tests/templates/${id}.yml`)
} }
@@ -87,7 +87,7 @@ for (const step of ["config", "documentation"]) {
} }
//Example workflows //Example workflows
await update({ source: paths.join(__metrics, ".github/scripts/files/examples.yml"), output: ".github/workflows/examples.yml", context: { steps: yaml.dump(workflow, {quotingType:'"', noCompatMode:true}) } }) await update({ source: paths.join(__metrics, ".github/scripts/files/examples.yml"), output: ".github/workflows/examples.yml", context: { steps: yaml.dump(workflow, { quotingType: '"', noCompatMode: true }) } })
//Commit and push //Commit and push
if (mode === "publish") { if (mode === "publish") {

View File

@@ -41,7 +41,7 @@ export default async function metadata({log = true, diff = false} = {}) {
if (!(await fs.promises.lstat(path.join(__plugins, name))).isDirectory()) if (!(await fs.promises.lstat(path.join(__plugins, name))).isDirectory())
continue continue
switch (name) { switch (name) {
case "community":{ case "community": {
const ___plugins = path.join(__plugins, "community") const ___plugins = path.join(__plugins, "community")
for (const name of await fs.promises.readdir(___plugins)) { for (const name of await fs.promises.readdir(___plugins)) {
if (!(await fs.promises.lstat(path.join(___plugins, name))).isDirectory()) if (!(await fs.promises.lstat(path.join(___plugins, name))).isDirectory())

View File

@@ -164,7 +164,7 @@ export default async function({log = true, nosettings = false, community = {}} =
//Load plugins //Load plugins
for (const name of await fs.promises.readdir(__plugins)) { for (const name of await fs.promises.readdir(__plugins)) {
switch (name) { switch (name) {
case "community":{ case "community": {
const ___plugins = path.join(__plugins, "community") const ___plugins = path.join(__plugins, "community")
for (const name of await fs.promises.readdir(___plugins)) for (const name of await fs.promises.readdir(___plugins))
await load.plugin(name, {__plugins:___plugins, Plugins, conf, logger}) await load.plugin(name, {__plugins:___plugins, Plugins, conf, logger})
@@ -249,5 +249,5 @@ const load = {
} }
) )
} }
} },
} }