Skip to content

Commit 48e2d29

Browse files
committed
Improve readability of config generation in netlify build plugin
1 parent 7674ce7 commit 48e2d29

File tree

1 file changed

+7
-3
lines changed
  • netlify/plugins/netlify-jekyll-metadata

1 file changed

+7
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import fs from 'node:fs'
2-
import url from 'node:url'
32

43
export const onPreBuild = async function () {
54
const siteUrl = process.env.URL
65
const repoUrl = new URL(process.env.REPOSITORY_URL || '')
76
const repoNameWithOwner = repoUrl.pathname.replace(/^\/+/, '')
87
const branch = process.env.BRANCH
98

10-
const fileContents = `repository: ${repoNameWithOwner}\nurl: ${siteUrl}\nbranch: ${branch}\nbaseurl: ""`
9+
const fileContents = `
10+
repository: ${repoNameWithOwner}
11+
url: ${siteUrl}
12+
branch: ${branch}
13+
baseurl: ""
14+
`
1115
const fileName = '_config.ci.yml'
12-
return fs.promises.writeFile(fileName, fileContents)
16+
return fs.promises.writeFile(fileName, fileContents.trim())
1317
}

0 commit comments

Comments
 (0)