mirror of
https://github.com/yannbertrand/macos-defaults
synced 2024-11-14 23:57:07 +00:00
🔒 Add Content-Security-Policy header
This commit is contained in:
parent
8e97594e5f
commit
d67ca17bd4
4 changed files with 17 additions and 0 deletions
|
@ -85,6 +85,12 @@ Thank you! I built it using [VuePress](https://vuepress.vuejs.org/). I liked the
|
||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree no categories should write the netlify _headers file 1`] = `
|
||||||
|
"/*
|
||||||
|
Content-Security-Policy: default-src 'self'; style-src 'self' 'unsafe-inline';
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`write-tree one category, no page with image should write a category/readme.md file using the category template 1`] = `
|
exports[`write-tree one category, no page with image should write a category/readme.md file using the category template 1`] = `
|
||||||
"# Category
|
"# Category
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
/*
|
||||||
|
Content-Security-Policy: default-src 'self'; style-src 'self' 'unsafe-inline';
|
|
@ -22,6 +22,10 @@ module.exports = (defaults, destinationPath) => {
|
||||||
fs.copyFileSync('./templates/.vuepress/styles/index.styl', `${destinationPath}/.vuepress/styles/index.styl`)
|
fs.copyFileSync('./templates/.vuepress/styles/index.styl', `${destinationPath}/.vuepress/styles/index.styl`)
|
||||||
fs.copyFileSync('./templates/.vuepress/styles/palette.styl', `${destinationPath}/.vuepress/styles/palette.styl`)
|
fs.copyFileSync('./templates/.vuepress/styles/palette.styl', `${destinationPath}/.vuepress/styles/palette.styl`)
|
||||||
|
|
||||||
|
const netlifyHeadersTemplate = fs.readFileSync('./templates/.vuepress/public/_headers.handlebars', 'utf8')
|
||||||
|
const netlifyHeadersContent = Handlebars.compile(netlifyHeadersTemplate)()
|
||||||
|
fs.writeFileSync(`${destinationPath}/.vuepress/public/_headers`, netlifyHeadersContent)
|
||||||
|
|
||||||
const homeTemplate = fs.readFileSync('./templates/home.md.handlebars', 'utf8')
|
const homeTemplate = fs.readFileSync('./templates/home.md.handlebars', 'utf8')
|
||||||
const rootReadmeContent = Handlebars.compile(homeTemplate)(defaults)
|
const rootReadmeContent = Handlebars.compile(homeTemplate)(defaults)
|
||||||
fs.writeFileSync(`${destinationPath}/readme.md`, rootReadmeContent)
|
fs.writeFileSync(`${destinationPath}/readme.md`, rootReadmeContent)
|
||||||
|
|
|
@ -36,6 +36,11 @@ describe('write-tree', () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should write the netlify _headers file', () => {
|
||||||
|
const netlifyHeadersContent = readFile(`${destinationPath}/.vuepress/public/_headers`)
|
||||||
|
expect(netlifyHeadersContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
it('should write an empty readme.md file using the home template', () => {
|
it('should write an empty readme.md file using the home template', () => {
|
||||||
const rootReadmeContent = readFile(`${destinationPath}/readme.md`)
|
const rootReadmeContent = readFile(`${destinationPath}/readme.md`)
|
||||||
expect(rootReadmeContent).toMatchSnapshot()
|
expect(rootReadmeContent).toMatchSnapshot()
|
||||||
|
|
Loading…
Reference in a new issue