mirror of
https://github.com/yannbertrand/macos-defaults
synced 2024-12-14 21:52:33 +00:00
🚚 Copy the vuepress folder to the production one
This commit is contained in:
parent
c01fde81e9
commit
4978266d5a
14 changed files with 11559 additions and 0 deletions
15
build/production/__mocks__/fs.js
Normal file
15
build/production/__mocks__/fs.js
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
const fs = jest.genMockFromModule('fs');
|
||||||
|
|
||||||
|
const result = {}
|
||||||
|
|
||||||
|
fs.mkdirSync = jest.fn()
|
||||||
|
fs.writeFileSync = jest.fn((path, content) => {
|
||||||
|
result[path] = content
|
||||||
|
})
|
||||||
|
fs.copyFileSync = jest.fn((origin, destination) => {
|
||||||
|
result[destination] = `copied:${origin}`
|
||||||
|
})
|
||||||
|
fs.readFakeFileSync = jest.fn(path => result[path])
|
||||||
|
fs.readFileSync = jest.requireActual("fs").readFileSync
|
||||||
|
|
||||||
|
module.exports = fs
|
942
build/production/__snapshots__/write-tree.test.js.snap
Normal file
942
build/production/__snapshots__/write-tree.test.js.snap
Normal file
|
@ -0,0 +1,942 @@
|
||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`write-tree no categories should write a vuepress config.yml file using the template 1`] = `
|
||||||
|
"---
|
||||||
|
|
||||||
|
title: 'macOS defaults'
|
||||||
|
description: 'Uncomplete list of macOS defaults commands with demos ✨'
|
||||||
|
evergreen: true
|
||||||
|
plugins:
|
||||||
|
- '@vuepress/medium-zoom'
|
||||||
|
themeConfig:
|
||||||
|
repo: 'yannbertrand/macos-defaults'
|
||||||
|
nav:
|
||||||
|
- text: 'Home'
|
||||||
|
link: '/'
|
||||||
|
activeHeaderLinks: false
|
||||||
|
sidebar:
|
||||||
|
- title: 'Home'
|
||||||
|
path: '/'
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree no categories should write an empty readme.md file using the home template 1`] = `
|
||||||
|
"---
|
||||||
|
metaTitle: 'macOS defaults'
|
||||||
|
---
|
||||||
|
# macOS \`defaults\` list
|
||||||
|
Uncomplete list of macOS \`defaults\` commands with demos ✨
|
||||||
|
|
||||||
|
## 💻 Commands
|
||||||
|
## 🤔 How do I add a command?
|
||||||
|
Please update [this file](https://github.com/yannbertrand/macos-defaults/blob/master/defaults.yml) that I use to [build multiple websites](https://github.com/yannbertrand/macos-defaults/#readme) like this one.
|
||||||
|
|
||||||
|
## ❤️ I like this website, how can I build the same?
|
||||||
|
Thank you! I built it using [VuePress](https://vuepress.vuejs.org/). Take a look at [my report](https://github.com/yannbertrand/macos-defaults/tree/master/build/vuepress#readme) if you want to use it.
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, no page with image should write a category/readme.md file using the category template 1`] = `
|
||||||
|
"# Category
|
||||||
|
|
||||||
|
<img src=\\"./category.png\\" alt=\\"A screenshot of the Category\\"
|
||||||
|
width=\\"740\\" height=\\"80\\" style=\\"height: auto\\" />
|
||||||
|
|
||||||
|
> Category description.
|
||||||
|
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, no page with image should write a readme.md file using the home template 1`] = `
|
||||||
|
"---
|
||||||
|
metaTitle: 'macOS defaults'
|
||||||
|
---
|
||||||
|
# macOS \`defaults\` list
|
||||||
|
Uncomplete list of macOS \`defaults\` commands with demos ✨
|
||||||
|
|
||||||
|
## 💻 Commands
|
||||||
|
### Category
|
||||||
|
|
||||||
|
## 🤔 How do I add a command?
|
||||||
|
Please update [this file](https://github.com/yannbertrand/macos-defaults/blob/master/defaults.yml) that I use to [build multiple websites](https://github.com/yannbertrand/macos-defaults/#readme) like this one.
|
||||||
|
|
||||||
|
## ❤️ I like this website, how can I build the same?
|
||||||
|
Thank you! I built it using [VuePress](https://vuepress.vuejs.org/). Take a look at [my report](https://github.com/yannbertrand/macos-defaults/tree/master/build/vuepress#readme) if you want to use it.
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, no page with image should write a vuepress config.yml file using the template 1`] = `
|
||||||
|
"---
|
||||||
|
|
||||||
|
title: 'macOS defaults'
|
||||||
|
description: 'Uncomplete list of macOS defaults commands with demos ✨'
|
||||||
|
evergreen: true
|
||||||
|
plugins:
|
||||||
|
- '@vuepress/medium-zoom'
|
||||||
|
themeConfig:
|
||||||
|
repo: 'yannbertrand/macos-defaults'
|
||||||
|
nav:
|
||||||
|
- text: 'Home'
|
||||||
|
link: '/'
|
||||||
|
activeHeaderLinks: false
|
||||||
|
sidebar:
|
||||||
|
- title: 'Home'
|
||||||
|
path: '/'
|
||||||
|
- title: Category
|
||||||
|
collapsable: false
|
||||||
|
path: '/category/'
|
||||||
|
children:
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with image example should write a category/page.md file using the page template 1`] = `
|
||||||
|
"---
|
||||||
|
metaTitle: 'Page | Category | macOS defaults'
|
||||||
|
---
|
||||||
|
# Page
|
||||||
|
|
||||||
|
> Page description.
|
||||||
|
|
||||||
|
- **Tested on macOS**:
|
||||||
|
* Big Sur
|
||||||
|
- **Parameter type**: bool
|
||||||
|
|
||||||
|
## Set to \`true\` (default value)
|
||||||
|
\`\`\`bash
|
||||||
|
defaults write com.apple.category page -bool true
|
||||||
|
\`\`\`
|
||||||
|
<img
|
||||||
|
src=\\"./category-page-true.png\\"
|
||||||
|
alt=\\"Example output with value set to true\\"
|
||||||
|
width=\\"600\\" height=\\"400\\" style=\\"height: auto\\"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
## Set to \`false\`
|
||||||
|
\`\`\`bash
|
||||||
|
defaults write com.apple.category page -bool false
|
||||||
|
\`\`\`
|
||||||
|
<img
|
||||||
|
src=\\"./category-page-false.png\\"
|
||||||
|
alt=\\"Example output with value set to false\\"
|
||||||
|
width=\\"400\\" height=\\"200\\" style=\\"height: auto\\"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
## Read current value
|
||||||
|
\`\`\`bash
|
||||||
|
defaults read com.apple.category page
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
## Delete current value
|
||||||
|
\`\`\`bash
|
||||||
|
defaults delete com.apple.category page
|
||||||
|
\`\`\`
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with image example should write a category/readme.md file using the category template 1`] = `
|
||||||
|
"# Category
|
||||||
|
|
||||||
|
> Category description.
|
||||||
|
|
||||||
|
- [Page](./page.html)
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with image example should write a readme.md file using the home template 1`] = `
|
||||||
|
"---
|
||||||
|
metaTitle: 'macOS defaults'
|
||||||
|
---
|
||||||
|
# macOS \`defaults\` list
|
||||||
|
Uncomplete list of macOS \`defaults\` commands with demos ✨
|
||||||
|
|
||||||
|
## 💻 Commands
|
||||||
|
### Category
|
||||||
|
- [Page](./category/page.html)
|
||||||
|
|
||||||
|
## 🤔 How do I add a command?
|
||||||
|
Please update [this file](https://github.com/yannbertrand/macos-defaults/blob/master/defaults.yml) that I use to [build multiple websites](https://github.com/yannbertrand/macos-defaults/#readme) like this one.
|
||||||
|
|
||||||
|
## ❤️ I like this website, how can I build the same?
|
||||||
|
Thank you! I built it using [VuePress](https://vuepress.vuejs.org/). Take a look at [my report](https://github.com/yannbertrand/macos-defaults/tree/master/build/vuepress#readme) if you want to use it.
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with image example should write a vuepress config.yml file using the template 1`] = `
|
||||||
|
"---
|
||||||
|
|
||||||
|
title: 'macOS defaults'
|
||||||
|
description: 'Uncomplete list of macOS defaults commands with demos ✨'
|
||||||
|
evergreen: true
|
||||||
|
plugins:
|
||||||
|
- '@vuepress/medium-zoom'
|
||||||
|
themeConfig:
|
||||||
|
repo: 'yannbertrand/macos-defaults'
|
||||||
|
nav:
|
||||||
|
- text: 'Home'
|
||||||
|
link: '/'
|
||||||
|
activeHeaderLinks: false
|
||||||
|
sidebar:
|
||||||
|
- title: 'Home'
|
||||||
|
path: '/'
|
||||||
|
- title: Category
|
||||||
|
collapsable: false
|
||||||
|
path: '/category/'
|
||||||
|
children:
|
||||||
|
- 'category/page'
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with text and possible values example should write a category/page.md file using the page template 1`] = `
|
||||||
|
"---
|
||||||
|
metaTitle: 'Page | Category | macOS defaults'
|
||||||
|
---
|
||||||
|
# Page
|
||||||
|
|
||||||
|
> Page description.
|
||||||
|
|
||||||
|
- **Tested on macOS**:
|
||||||
|
* Big Sur
|
||||||
|
- **Parameter type**: string
|
||||||
|
* start
|
||||||
|
* middle
|
||||||
|
* end
|
||||||
|
|
||||||
|
## Set to \`start\`
|
||||||
|
\`\`\`bash
|
||||||
|
defaults write com.apple.category page -string start
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
- output when value is start
|
||||||
|
|
||||||
|
## Set to \`middle\` (default value)
|
||||||
|
\`\`\`bash
|
||||||
|
defaults write com.apple.category page -string middle
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
- output when value is middle
|
||||||
|
|
||||||
|
## Set to \`end\`
|
||||||
|
\`\`\`bash
|
||||||
|
defaults write com.apple.category page -string end
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
- output when value is end
|
||||||
|
|
||||||
|
## Read current value
|
||||||
|
\`\`\`bash
|
||||||
|
defaults read com.apple.category page
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
## Delete current value
|
||||||
|
\`\`\`bash
|
||||||
|
defaults delete com.apple.category page
|
||||||
|
\`\`\`
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with text and possible values example should write a category/readme.md file using the category template 1`] = `
|
||||||
|
"# Category
|
||||||
|
|
||||||
|
> Category description.
|
||||||
|
|
||||||
|
- [Page](./page.html)
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with text and possible values example should write a readme.md file using the home template 1`] = `
|
||||||
|
"---
|
||||||
|
metaTitle: 'macOS defaults'
|
||||||
|
---
|
||||||
|
# macOS \`defaults\` list
|
||||||
|
Uncomplete list of macOS \`defaults\` commands with demos ✨
|
||||||
|
|
||||||
|
## 💻 Commands
|
||||||
|
### Category
|
||||||
|
- [Page](./category/page.html)
|
||||||
|
|
||||||
|
## 🤔 How do I add a command?
|
||||||
|
Please update [this file](https://github.com/yannbertrand/macos-defaults/blob/master/defaults.yml) that I use to [build multiple websites](https://github.com/yannbertrand/macos-defaults/#readme) like this one.
|
||||||
|
|
||||||
|
## ❤️ I like this website, how can I build the same?
|
||||||
|
Thank you! I built it using [VuePress](https://vuepress.vuejs.org/). Take a look at [my report](https://github.com/yannbertrand/macos-defaults/tree/master/build/vuepress#readme) if you want to use it.
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with text and possible values example should write a vuepress config.yml file using the template 1`] = `
|
||||||
|
"---
|
||||||
|
|
||||||
|
title: 'macOS defaults'
|
||||||
|
description: 'Uncomplete list of macOS defaults commands with demos ✨'
|
||||||
|
evergreen: true
|
||||||
|
plugins:
|
||||||
|
- '@vuepress/medium-zoom'
|
||||||
|
themeConfig:
|
||||||
|
repo: 'yannbertrand/macos-defaults'
|
||||||
|
nav:
|
||||||
|
- text: 'Home'
|
||||||
|
link: '/'
|
||||||
|
activeHeaderLinks: false
|
||||||
|
sidebar:
|
||||||
|
- title: 'Home'
|
||||||
|
path: '/'
|
||||||
|
- title: Category
|
||||||
|
collapsable: false
|
||||||
|
path: '/category/'
|
||||||
|
children:
|
||||||
|
- 'category/page'
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with text example with an after command should write a category/page.md file using the page template 1`] = `
|
||||||
|
"---
|
||||||
|
metaTitle: 'Page | Category | macOS defaults'
|
||||||
|
---
|
||||||
|
# Page
|
||||||
|
|
||||||
|
> Page description.
|
||||||
|
|
||||||
|
- **Tested on macOS**:
|
||||||
|
* Big Sur
|
||||||
|
- **Parameter type**: string
|
||||||
|
|
||||||
|
## Set to \`~/Desktop\` (default value)
|
||||||
|
\`\`\`bash
|
||||||
|
defaults write com.apple.category page -string ~/Desktop && killall App
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
- output when value is ~/Desktop
|
||||||
|
|
||||||
|
## Set to \`~/Pictures\`
|
||||||
|
\`\`\`bash
|
||||||
|
defaults write com.apple.category page -string ~/Pictures && killall App
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
- output when value is ~/Pictures
|
||||||
|
|
||||||
|
## Read current value
|
||||||
|
\`\`\`bash
|
||||||
|
defaults read com.apple.category page
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
## Delete current value
|
||||||
|
\`\`\`bash
|
||||||
|
defaults delete com.apple.category page && killall App
|
||||||
|
\`\`\`
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with text example with an after command should write a category/readme.md file using the category template 1`] = `
|
||||||
|
"# Category
|
||||||
|
|
||||||
|
> Category description.
|
||||||
|
|
||||||
|
- [Page](./page.html)
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with text example with an after command should write a readme.md file using the home template 1`] = `
|
||||||
|
"---
|
||||||
|
metaTitle: 'macOS defaults'
|
||||||
|
---
|
||||||
|
# macOS \`defaults\` list
|
||||||
|
Uncomplete list of macOS \`defaults\` commands with demos ✨
|
||||||
|
|
||||||
|
## 💻 Commands
|
||||||
|
### Category
|
||||||
|
- [Page](./category/page.html)
|
||||||
|
|
||||||
|
## 🤔 How do I add a command?
|
||||||
|
Please update [this file](https://github.com/yannbertrand/macos-defaults/blob/master/defaults.yml) that I use to [build multiple websites](https://github.com/yannbertrand/macos-defaults/#readme) like this one.
|
||||||
|
|
||||||
|
## ❤️ I like this website, how can I build the same?
|
||||||
|
Thank you! I built it using [VuePress](https://vuepress.vuejs.org/). Take a look at [my report](https://github.com/yannbertrand/macos-defaults/tree/master/build/vuepress#readme) if you want to use it.
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with text example with an after command should write a vuepress config.yml file using the template 1`] = `
|
||||||
|
"---
|
||||||
|
|
||||||
|
title: 'macOS defaults'
|
||||||
|
description: 'Uncomplete list of macOS defaults commands with demos ✨'
|
||||||
|
evergreen: true
|
||||||
|
plugins:
|
||||||
|
- '@vuepress/medium-zoom'
|
||||||
|
themeConfig:
|
||||||
|
repo: 'yannbertrand/macos-defaults'
|
||||||
|
nav:
|
||||||
|
- text: 'Home'
|
||||||
|
link: '/'
|
||||||
|
activeHeaderLinks: false
|
||||||
|
sidebar:
|
||||||
|
- title: 'Home'
|
||||||
|
path: '/'
|
||||||
|
- title: Category
|
||||||
|
collapsable: false
|
||||||
|
path: '/category/'
|
||||||
|
children:
|
||||||
|
- 'category/page'
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with text example with requirements should write a category/page.md file using the page template 1`] = `
|
||||||
|
"---
|
||||||
|
metaTitle: 'Page | Category | macOS defaults'
|
||||||
|
---
|
||||||
|
# Page
|
||||||
|
|
||||||
|
> Page description.
|
||||||
|
|
||||||
|
- **Tested on macOS**:
|
||||||
|
* Big Sur
|
||||||
|
- **Parameter type**: string
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
- [\`com.apple.category2 another-key\`](../../another-category/another-key.html#set-to-true) must be set to \`true\`
|
||||||
|
- [\`com.apple.category2 a-third-key\`](../../a-third-category/a-third-key.html#set-to-0.5) must be set to \`0.5\`
|
||||||
|
|
||||||
|
## Set to \`true\` (default value)
|
||||||
|
\`\`\`bash
|
||||||
|
defaults write com.apple.category page -string true && killall App
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
- output when value is true
|
||||||
|
|
||||||
|
## Set to \`false\`
|
||||||
|
\`\`\`bash
|
||||||
|
defaults write com.apple.category page -string false && killall App
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
- output when value is false
|
||||||
|
|
||||||
|
## Read current value
|
||||||
|
\`\`\`bash
|
||||||
|
defaults read com.apple.category page
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
## Delete current value
|
||||||
|
\`\`\`bash
|
||||||
|
defaults delete com.apple.category page && killall App
|
||||||
|
\`\`\`
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with text example with requirements should write a category/readme.md file using the category template 1`] = `
|
||||||
|
"# Category
|
||||||
|
|
||||||
|
> Category description.
|
||||||
|
|
||||||
|
- [Page](./page.html)
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with text example with requirements should write a readme.md file using the home template 1`] = `
|
||||||
|
"---
|
||||||
|
metaTitle: 'macOS defaults'
|
||||||
|
---
|
||||||
|
# macOS \`defaults\` list
|
||||||
|
Uncomplete list of macOS \`defaults\` commands with demos ✨
|
||||||
|
|
||||||
|
## 💻 Commands
|
||||||
|
### Category
|
||||||
|
- [Page](./category/page.html)
|
||||||
|
|
||||||
|
## 🤔 How do I add a command?
|
||||||
|
Please update [this file](https://github.com/yannbertrand/macos-defaults/blob/master/defaults.yml) that I use to [build multiple websites](https://github.com/yannbertrand/macos-defaults/#readme) like this one.
|
||||||
|
|
||||||
|
## ❤️ I like this website, how can I build the same?
|
||||||
|
Thank you! I built it using [VuePress](https://vuepress.vuejs.org/). Take a look at [my report](https://github.com/yannbertrand/macos-defaults/tree/master/build/vuepress#readme) if you want to use it.
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with text example with requirements should write a vuepress config.yml file using the template 1`] = `
|
||||||
|
"---
|
||||||
|
|
||||||
|
title: 'macOS defaults'
|
||||||
|
description: 'Uncomplete list of macOS defaults commands with demos ✨'
|
||||||
|
evergreen: true
|
||||||
|
plugins:
|
||||||
|
- '@vuepress/medium-zoom'
|
||||||
|
themeConfig:
|
||||||
|
repo: 'yannbertrand/macos-defaults'
|
||||||
|
nav:
|
||||||
|
- text: 'Home'
|
||||||
|
link: '/'
|
||||||
|
activeHeaderLinks: false
|
||||||
|
sidebar:
|
||||||
|
- title: 'Home'
|
||||||
|
path: '/'
|
||||||
|
- title: Category
|
||||||
|
collapsable: false
|
||||||
|
path: '/category/'
|
||||||
|
children:
|
||||||
|
- 'category/page'
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with text example with special chars values should write a category/page.md file using the page template 1`] = `
|
||||||
|
"---
|
||||||
|
metaTitle: 'Page | Category | macOS defaults'
|
||||||
|
---
|
||||||
|
# Page
|
||||||
|
|
||||||
|
> Page description.
|
||||||
|
|
||||||
|
- **Tested on macOS**:
|
||||||
|
* Big Sur
|
||||||
|
- **Parameter type**: bool
|
||||||
|
|
||||||
|
## Set to \`~/Desktop\` (default value)
|
||||||
|
\`\`\`bash
|
||||||
|
defaults write com.apple.category page -bool ~/Desktop
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
- output when value is ~/Desktop
|
||||||
|
|
||||||
|
## Set to \`~/Pictures\`
|
||||||
|
\`\`\`bash
|
||||||
|
defaults write com.apple.category page -bool ~/Pictures
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
- output when value is ~/Pictures
|
||||||
|
|
||||||
|
## Read current value
|
||||||
|
\`\`\`bash
|
||||||
|
defaults read com.apple.category page
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
## Delete current value
|
||||||
|
\`\`\`bash
|
||||||
|
defaults delete com.apple.category page
|
||||||
|
\`\`\`
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with text example with special chars values should write a category/readme.md file using the category template 1`] = `
|
||||||
|
"# Category
|
||||||
|
|
||||||
|
> Category description.
|
||||||
|
|
||||||
|
- [Page](./page.html)
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with text example with special chars values should write a readme.md file using the home template 1`] = `
|
||||||
|
"---
|
||||||
|
metaTitle: 'macOS defaults'
|
||||||
|
---
|
||||||
|
# macOS \`defaults\` list
|
||||||
|
Uncomplete list of macOS \`defaults\` commands with demos ✨
|
||||||
|
|
||||||
|
## 💻 Commands
|
||||||
|
### Category
|
||||||
|
- [Page](./category/page.html)
|
||||||
|
|
||||||
|
## 🤔 How do I add a command?
|
||||||
|
Please update [this file](https://github.com/yannbertrand/macos-defaults/blob/master/defaults.yml) that I use to [build multiple websites](https://github.com/yannbertrand/macos-defaults/#readme) like this one.
|
||||||
|
|
||||||
|
## ❤️ I like this website, how can I build the same?
|
||||||
|
Thank you! I built it using [VuePress](https://vuepress.vuejs.org/). Take a look at [my report](https://github.com/yannbertrand/macos-defaults/tree/master/build/vuepress#readme) if you want to use it.
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with text example with special chars values should write a vuepress config.yml file using the template 1`] = `
|
||||||
|
"---
|
||||||
|
|
||||||
|
title: 'macOS defaults'
|
||||||
|
description: 'Uncomplete list of macOS defaults commands with demos ✨'
|
||||||
|
evergreen: true
|
||||||
|
plugins:
|
||||||
|
- '@vuepress/medium-zoom'
|
||||||
|
themeConfig:
|
||||||
|
repo: 'yannbertrand/macos-defaults'
|
||||||
|
nav:
|
||||||
|
- text: 'Home'
|
||||||
|
link: '/'
|
||||||
|
activeHeaderLinks: false
|
||||||
|
sidebar:
|
||||||
|
- title: 'Home'
|
||||||
|
path: '/'
|
||||||
|
- title: Category
|
||||||
|
collapsable: false
|
||||||
|
path: '/category/'
|
||||||
|
children:
|
||||||
|
- 'category/page'
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with video example should write a category/page.md file using the page template 1`] = `
|
||||||
|
"---
|
||||||
|
metaTitle: 'Page | Category | macOS defaults'
|
||||||
|
---
|
||||||
|
# Page
|
||||||
|
|
||||||
|
> Page description.
|
||||||
|
|
||||||
|
- **Tested on macOS**:
|
||||||
|
* Big Sur
|
||||||
|
- **Parameter type**: float
|
||||||
|
|
||||||
|
## Set to \`0\` (default value)
|
||||||
|
\`\`\`bash
|
||||||
|
defaults write com.apple.category page -float 0
|
||||||
|
\`\`\`
|
||||||
|
<video autoplay loop muted playsinline width=\\"750\\" height=\\"400\\" style=\\"max-width: 100%; height: auto\\">
|
||||||
|
<source src=\\"./category-page-0.mp4\\" type=\\"video/mp4\\">
|
||||||
|
Example output with value set to 0
|
||||||
|
</video>
|
||||||
|
|
||||||
|
|
||||||
|
## Set to \`0.5\`
|
||||||
|
\`\`\`bash
|
||||||
|
defaults write com.apple.category page -float 0.5
|
||||||
|
\`\`\`
|
||||||
|
<video autoplay loop muted playsinline width=\\"720\\" height=\\"390\\" style=\\"max-width: 100%; height: auto\\">
|
||||||
|
<source src=\\"./category-page-0.5.mp4\\" type=\\"video/mp4\\">
|
||||||
|
Example output with value set to 0.5
|
||||||
|
</video>
|
||||||
|
|
||||||
|
|
||||||
|
## Read current value
|
||||||
|
\`\`\`bash
|
||||||
|
defaults read com.apple.category page
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
## Delete current value
|
||||||
|
\`\`\`bash
|
||||||
|
defaults delete com.apple.category page
|
||||||
|
\`\`\`
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with video example should write a category/readme.md file using the category template 1`] = `
|
||||||
|
"# Category
|
||||||
|
|
||||||
|
> Category description.
|
||||||
|
|
||||||
|
- [Page](./page.html)
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with video example should write a readme.md file using the home template 1`] = `
|
||||||
|
"---
|
||||||
|
metaTitle: 'macOS defaults'
|
||||||
|
---
|
||||||
|
# macOS \`defaults\` list
|
||||||
|
Uncomplete list of macOS \`defaults\` commands with demos ✨
|
||||||
|
|
||||||
|
## 💻 Commands
|
||||||
|
### Category
|
||||||
|
- [Page](./category/page.html)
|
||||||
|
|
||||||
|
## 🤔 How do I add a command?
|
||||||
|
Please update [this file](https://github.com/yannbertrand/macos-defaults/blob/master/defaults.yml) that I use to [build multiple websites](https://github.com/yannbertrand/macos-defaults/#readme) like this one.
|
||||||
|
|
||||||
|
## ❤️ I like this website, how can I build the same?
|
||||||
|
Thank you! I built it using [VuePress](https://vuepress.vuejs.org/). Take a look at [my report](https://github.com/yannbertrand/macos-defaults/tree/master/build/vuepress#readme) if you want to use it.
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, one page with video example should write a vuepress config.yml file using the template 1`] = `
|
||||||
|
"---
|
||||||
|
|
||||||
|
title: 'macOS defaults'
|
||||||
|
description: 'Uncomplete list of macOS defaults commands with demos ✨'
|
||||||
|
evergreen: true
|
||||||
|
plugins:
|
||||||
|
- '@vuepress/medium-zoom'
|
||||||
|
themeConfig:
|
||||||
|
repo: 'yannbertrand/macos-defaults'
|
||||||
|
nav:
|
||||||
|
- text: 'Home'
|
||||||
|
link: '/'
|
||||||
|
activeHeaderLinks: false
|
||||||
|
sidebar:
|
||||||
|
- title: 'Home'
|
||||||
|
path: '/'
|
||||||
|
- title: Category
|
||||||
|
collapsable: false
|
||||||
|
path: '/category/'
|
||||||
|
children:
|
||||||
|
- 'category/page'
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, two pages should write a category/page1.md file using the page template 1`] = `
|
||||||
|
"---
|
||||||
|
metaTitle: 'Page 1 | Category | macOS defaults'
|
||||||
|
---
|
||||||
|
# Page 1
|
||||||
|
|
||||||
|
> Page 1 description.
|
||||||
|
|
||||||
|
- **Tested on macOS**:
|
||||||
|
* Big Sur
|
||||||
|
- **Parameter type**: bool
|
||||||
|
|
||||||
|
## Set to \`true\` (default value)
|
||||||
|
\`\`\`bash
|
||||||
|
defaults write com.apple.category page1 -bool true
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
- output when value is true
|
||||||
|
|
||||||
|
## Set to \`false\`
|
||||||
|
\`\`\`bash
|
||||||
|
defaults write com.apple.category page1 -bool false
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
- output when value is false
|
||||||
|
|
||||||
|
## Read current value
|
||||||
|
\`\`\`bash
|
||||||
|
defaults read com.apple.category page1
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
## Delete current value
|
||||||
|
\`\`\`bash
|
||||||
|
defaults delete com.apple.category page1
|
||||||
|
\`\`\`
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, two pages should write a category/page2.md file using the page template 1`] = `
|
||||||
|
"---
|
||||||
|
metaTitle: 'Page 2 | Category | macOS defaults'
|
||||||
|
---
|
||||||
|
# Page 2
|
||||||
|
|
||||||
|
> Page 2 description.
|
||||||
|
|
||||||
|
- **Tested on macOS**:
|
||||||
|
* Big Sur
|
||||||
|
- **Parameter type**: bool
|
||||||
|
|
||||||
|
## Set to \`true\`
|
||||||
|
\`\`\`bash
|
||||||
|
defaults write com.apple.category page2 -bool true
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
- output when value is true
|
||||||
|
|
||||||
|
## Set to \`false\` (default value)
|
||||||
|
\`\`\`bash
|
||||||
|
defaults write com.apple.category page2 -bool false
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
- output when value is false
|
||||||
|
|
||||||
|
## Read current value
|
||||||
|
\`\`\`bash
|
||||||
|
defaults read com.apple.category page2
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
## Delete current value
|
||||||
|
\`\`\`bash
|
||||||
|
defaults delete com.apple.category page2
|
||||||
|
\`\`\`
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, two pages should write a category/readme.md file using the category template 1`] = `
|
||||||
|
"# Category
|
||||||
|
|
||||||
|
> Category description.
|
||||||
|
|
||||||
|
- [Page 1](./page1.html)
|
||||||
|
- [Page 2](./page2.html)
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, two pages should write a readme.md file using the home template 1`] = `
|
||||||
|
"---
|
||||||
|
metaTitle: 'macOS defaults'
|
||||||
|
---
|
||||||
|
# macOS \`defaults\` list
|
||||||
|
Uncomplete list of macOS \`defaults\` commands with demos ✨
|
||||||
|
|
||||||
|
## 💻 Commands
|
||||||
|
### Category
|
||||||
|
- [Page 1](./category/page1.html)
|
||||||
|
- [Page 2](./category/page2.html)
|
||||||
|
|
||||||
|
## 🤔 How do I add a command?
|
||||||
|
Please update [this file](https://github.com/yannbertrand/macos-defaults/blob/master/defaults.yml) that I use to [build multiple websites](https://github.com/yannbertrand/macos-defaults/#readme) like this one.
|
||||||
|
|
||||||
|
## ❤️ I like this website, how can I build the same?
|
||||||
|
Thank you! I built it using [VuePress](https://vuepress.vuejs.org/). Take a look at [my report](https://github.com/yannbertrand/macos-defaults/tree/master/build/vuepress#readme) if you want to use it.
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree one category, two pages should write a vuepress config.yml file using the template 1`] = `
|
||||||
|
"---
|
||||||
|
|
||||||
|
title: 'macOS defaults'
|
||||||
|
description: 'Uncomplete list of macOS defaults commands with demos ✨'
|
||||||
|
evergreen: true
|
||||||
|
plugins:
|
||||||
|
- '@vuepress/medium-zoom'
|
||||||
|
themeConfig:
|
||||||
|
repo: 'yannbertrand/macos-defaults'
|
||||||
|
nav:
|
||||||
|
- text: 'Home'
|
||||||
|
link: '/'
|
||||||
|
activeHeaderLinks: false
|
||||||
|
sidebar:
|
||||||
|
- title: 'Home'
|
||||||
|
path: '/'
|
||||||
|
- title: Category
|
||||||
|
collapsable: false
|
||||||
|
path: '/category/'
|
||||||
|
children:
|
||||||
|
- 'category/page1'
|
||||||
|
- 'category/page2'
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree two categories, one page in each should write a category1/page.md file using the page template 1`] = `
|
||||||
|
"---
|
||||||
|
metaTitle: 'Page | Category 1 | macOS defaults'
|
||||||
|
---
|
||||||
|
# Page
|
||||||
|
|
||||||
|
> Page description.
|
||||||
|
|
||||||
|
- **Tested on macOS**:
|
||||||
|
* Big Sur
|
||||||
|
- **Parameter type**: bool
|
||||||
|
|
||||||
|
## Set to \`true\` (default value)
|
||||||
|
\`\`\`bash
|
||||||
|
defaults write com.apple.category1 page -bool true
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
- output when value is true
|
||||||
|
|
||||||
|
## Set to \`false\`
|
||||||
|
\`\`\`bash
|
||||||
|
defaults write com.apple.category1 page -bool false
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
- output when value is false
|
||||||
|
|
||||||
|
## Read current value
|
||||||
|
\`\`\`bash
|
||||||
|
defaults read com.apple.category1 page
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
## Delete current value
|
||||||
|
\`\`\`bash
|
||||||
|
defaults delete com.apple.category1 page
|
||||||
|
\`\`\`
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree two categories, one page in each should write a category1/readme.md file using the category template 1`] = `
|
||||||
|
"# Category 1
|
||||||
|
|
||||||
|
> Category 1 description.
|
||||||
|
|
||||||
|
- [Page](./page.html)
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree two categories, one page in each should write a category2/page.md file using the page template 1`] = `
|
||||||
|
"---
|
||||||
|
metaTitle: 'Page | Category 2 | macOS defaults'
|
||||||
|
---
|
||||||
|
# Page
|
||||||
|
|
||||||
|
> Page description.
|
||||||
|
|
||||||
|
- **Tested on macOS**:
|
||||||
|
* Big Sur
|
||||||
|
- **Parameter type**: bool
|
||||||
|
|
||||||
|
## Set to \`true\`
|
||||||
|
\`\`\`bash
|
||||||
|
defaults write com.apple.category2 page -bool true
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
- output when value is true
|
||||||
|
|
||||||
|
## Set to \`false\` (default value)
|
||||||
|
\`\`\`bash
|
||||||
|
defaults write com.apple.category2 page -bool false
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
- output when value is false
|
||||||
|
|
||||||
|
## Read current value
|
||||||
|
\`\`\`bash
|
||||||
|
defaults read com.apple.category2 page
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
## Delete current value
|
||||||
|
\`\`\`bash
|
||||||
|
defaults delete com.apple.category2 page
|
||||||
|
\`\`\`
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree two categories, one page in each should write a category2/readme.md file using the category template 1`] = `
|
||||||
|
"# Category 2
|
||||||
|
|
||||||
|
> Category 2 description.
|
||||||
|
|
||||||
|
- [Page](./page.html)
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree two categories, one page in each should write a readme.md file using the home template 1`] = `
|
||||||
|
"---
|
||||||
|
metaTitle: 'macOS defaults'
|
||||||
|
---
|
||||||
|
# macOS \`defaults\` list
|
||||||
|
Uncomplete list of macOS \`defaults\` commands with demos ✨
|
||||||
|
|
||||||
|
## 💻 Commands
|
||||||
|
### Category 1
|
||||||
|
- [Page](./category1/page.html)
|
||||||
|
|
||||||
|
### Category 2
|
||||||
|
- [Page](./category2/page.html)
|
||||||
|
|
||||||
|
## 🤔 How do I add a command?
|
||||||
|
Please update [this file](https://github.com/yannbertrand/macos-defaults/blob/master/defaults.yml) that I use to [build multiple websites](https://github.com/yannbertrand/macos-defaults/#readme) like this one.
|
||||||
|
|
||||||
|
## ❤️ I like this website, how can I build the same?
|
||||||
|
Thank you! I built it using [VuePress](https://vuepress.vuejs.org/). Take a look at [my report](https://github.com/yannbertrand/macos-defaults/tree/master/build/vuepress#readme) if you want to use it.
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`write-tree two categories, one page in each should write a vuepress config.yml file using the template 1`] = `
|
||||||
|
"---
|
||||||
|
|
||||||
|
title: 'macOS defaults'
|
||||||
|
description: 'Uncomplete list of macOS defaults commands with demos ✨'
|
||||||
|
evergreen: true
|
||||||
|
plugins:
|
||||||
|
- '@vuepress/medium-zoom'
|
||||||
|
themeConfig:
|
||||||
|
repo: 'yannbertrand/macos-defaults'
|
||||||
|
nav:
|
||||||
|
- text: 'Home'
|
||||||
|
link: '/'
|
||||||
|
activeHeaderLinks: false
|
||||||
|
sidebar:
|
||||||
|
- title: 'Home'
|
||||||
|
path: '/'
|
||||||
|
- title: Category 1
|
||||||
|
collapsable: false
|
||||||
|
path: '/category1/'
|
||||||
|
children:
|
||||||
|
- 'category1/page'
|
||||||
|
- title: Category 2
|
||||||
|
collapsable: false
|
||||||
|
path: '/category2/'
|
||||||
|
children:
|
||||||
|
- 'category2/page'
|
||||||
|
"
|
||||||
|
`;
|
9
build/production/build.js
Normal file
9
build/production/build.js
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
const fs = require('fs')
|
||||||
|
const YAML = require('yaml')
|
||||||
|
|
||||||
|
const writeTree = require('./write-tree')
|
||||||
|
|
||||||
|
const input = fs.readFileSync('../../defaults.yml', 'utf8')
|
||||||
|
const defaults = YAML.parse(input)
|
||||||
|
|
||||||
|
writeTree(defaults, 'docs')
|
5
build/production/netlify.toml
Normal file
5
build/production/netlify.toml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
[build]
|
||||||
|
base = "build/vuepress"
|
||||||
|
command = "yarn test && yarn build:prod"
|
||||||
|
publish = "dist"
|
||||||
|
ignore = "git diff --quiet HEAD^ HEAD ../../defaults.yml ../../images/ __snapshots__/ templates/ build.js netlify.toml write-tree.js write-tree.test.js package.json yarn.lock"
|
25
build/production/package.json
Normal file
25
build/production/package.json
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"name": "macos-defaults-vuepress-builder",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"main": "build.js",
|
||||||
|
"scripts": {
|
||||||
|
"clean": "rimraf docs* dist*",
|
||||||
|
"build": "yarn clean && node build.js",
|
||||||
|
"build:prod": "yarn build && vuepress build docs --dest dist",
|
||||||
|
"start": "yarn build && vuepress dev docs",
|
||||||
|
"test": "jest"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@vuepress/plugin-medium-zoom": "1.5.4",
|
||||||
|
"handlebars": "4.7.6",
|
||||||
|
"vuepress": "1.5.4",
|
||||||
|
"yaml": "1.10.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"jest": "26.4.2",
|
||||||
|
"prettier": "2.1.2",
|
||||||
|
"rimraf": "3.0.2"
|
||||||
|
}
|
||||||
|
}
|
50
build/production/readme.md
Normal file
50
build/production/readme.md
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
# VuePress Build
|
||||||
|
## My opinion
|
||||||
|
VuePress was really easy to setup.
|
||||||
|
|
||||||
|
### 😄 Good
|
||||||
|
- Really easy to setup & deploy
|
||||||
|
- Default theme is nice
|
||||||
|
- It's possible to use Vue components
|
||||||
|
- Development mode is pleasant
|
||||||
|
|
||||||
|
### 😕 Bad
|
||||||
|
- Documentation is not super easy
|
||||||
|
- Lack of other official themes
|
||||||
|
|
||||||
|
### 😫 Ugly
|
||||||
|
- 🤷♂️
|
||||||
|
|
||||||
|
## How does it work?
|
||||||
|
Here is the built website architecture:
|
||||||
|
- [`.vuepress/config.yml`](./templates/.vuepress/config.yml.handlebars)
|
||||||
|
* Contains the whole VuePress configuration from title to sidebar config
|
||||||
|
- `readme.md`
|
||||||
|
* The main page content
|
||||||
|
|
||||||
|
All the other pages are markdown files that are carefully put under their folder (e.g. `screenshot/disable-shadow.md`). Assets are stored at the same level.
|
||||||
|
|
||||||
|
There is a second build phase where VuePress generates the static website.
|
||||||
|
|
||||||
|
I also added the [@vuepress/medium-zoom](https://v1.vuepress.vuejs.org/plugin/official/plugin-medium-zoom.html) plugin to add Medium zoom on images.
|
||||||
|
|
||||||
|
## Try locally
|
||||||
|
### 🏗 Install
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yarn install
|
||||||
|
```
|
||||||
|
|
||||||
|
### 🚀 Usage
|
||||||
|
|
||||||
|
This will build the [defaults.yml file](../../defaults.yml) and run a VuePress server on http://localhost:8080/. Sources of the website are available in the `docs` folder.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yarn start
|
||||||
|
```
|
||||||
|
|
||||||
|
### 🚧 Run unit tests
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yarn test
|
||||||
|
```
|
25
build/production/templates/.vuepress/config.yml.handlebars
Normal file
25
build/production/templates/.vuepress/config.yml.handlebars
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
title: 'macOS defaults'
|
||||||
|
description: 'Uncomplete list of macOS defaults commands with demos ✨'
|
||||||
|
evergreen: true
|
||||||
|
plugins:
|
||||||
|
- '@vuepress/medium-zoom'
|
||||||
|
themeConfig:
|
||||||
|
repo: 'yannbertrand/macos-defaults'
|
||||||
|
nav:
|
||||||
|
- text: 'Home'
|
||||||
|
link: '/'
|
||||||
|
activeHeaderLinks: false
|
||||||
|
sidebar:
|
||||||
|
- title: 'Home'
|
||||||
|
path: '/'
|
||||||
|
{{# categories }}
|
||||||
|
- title: {{ name }}
|
||||||
|
collapsable: false
|
||||||
|
path: '/{{ folder }}/'
|
||||||
|
children:
|
||||||
|
{{# keys }}
|
||||||
|
- '{{ ../folder }}/{{ key }}'
|
||||||
|
{{/ keys}}
|
||||||
|
{{/ categories }}
|
BIN
build/production/templates/.vuepress/public/favicon.ico
Normal file
BIN
build/production/templates/.vuepress/public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 106 KiB |
12
build/production/templates/category.md.handlebars
Normal file
12
build/production/templates/category.md.handlebars
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# {{ name }}
|
||||||
|
|
||||||
|
{{# image }}
|
||||||
|
<img src="./{{ filename }}" alt="A screenshot of the {{ ../name }}"
|
||||||
|
width="{{ width }}" height="{{ height }}" style="height: auto" />
|
||||||
|
|
||||||
|
{{/ image }}
|
||||||
|
> {{{ description }}}
|
||||||
|
|
||||||
|
{{# keys }}
|
||||||
|
- [{{ title }}](./{{ key }}.html)
|
||||||
|
{{/ keys }}
|
19
build/production/templates/home.md.handlebars
Normal file
19
build/production/templates/home.md.handlebars
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
---
|
||||||
|
metaTitle: 'macOS defaults'
|
||||||
|
---
|
||||||
|
# macOS `defaults` list
|
||||||
|
Uncomplete list of macOS `defaults` commands with demos ✨
|
||||||
|
|
||||||
|
## 💻 Commands
|
||||||
|
{{# categories }}
|
||||||
|
### {{ name }}
|
||||||
|
{{# keys }}
|
||||||
|
- [{{ title }}](./{{ ../folder }}/{{ key }}.html)
|
||||||
|
{{/ keys}}
|
||||||
|
|
||||||
|
{{/ categories }}
|
||||||
|
## 🤔 How do I add a command?
|
||||||
|
Please update [this file](https://github.com/yannbertrand/macos-defaults/blob/master/defaults.yml) that I use to [build multiple websites](https://github.com/yannbertrand/macos-defaults/#readme) like this one.
|
||||||
|
|
||||||
|
## ❤️ I like this website, how can I build the same?
|
||||||
|
Thank you! I built it using [VuePress](https://vuepress.vuejs.org/). Take a look at [my report](https://github.com/yannbertrand/macos-defaults/tree/master/build/vuepress#readme) if you want to use it.
|
56
build/production/templates/page.md.handlebars
Normal file
56
build/production/templates/page.md.handlebars
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
---
|
||||||
|
metaTitle: '{{ title }} | {{ name }} | macOS defaults'
|
||||||
|
---
|
||||||
|
# {{ title }}
|
||||||
|
|
||||||
|
> {{{ description }}}
|
||||||
|
|
||||||
|
- **Tested on macOS**:
|
||||||
|
{{# versions }}
|
||||||
|
* {{ . }}
|
||||||
|
{{/ versions }}
|
||||||
|
- **Parameter type**: {{ param.type }}
|
||||||
|
{{# param.values }}
|
||||||
|
* {{ . }}
|
||||||
|
{{/ param.values }}
|
||||||
|
|
||||||
|
{{# if requirements }}
|
||||||
|
## Requirements
|
||||||
|
{{# requirements }}
|
||||||
|
- [`{{ name }}`](../../{{ folder }}/{{ key }}.html#set-to-{{ value }}) must be set to `{{ value }}`
|
||||||
|
{{/ requirements }}
|
||||||
|
|
||||||
|
{{/ if }}
|
||||||
|
{{# examples }}
|
||||||
|
## Set to `{{{ value }}}`{{# if default }} (default value){{/ if }}
|
||||||
|
```bash
|
||||||
|
defaults write {{ ../domain }} {{ ../key }} -{{ ../param.type }} {{{ value }}}{{# if ../after }} && {{ ../after }}{{/ if }}
|
||||||
|
```
|
||||||
|
{{# video }}
|
||||||
|
<video autoplay loop muted playsinline width="{{ width }}" height="{{ height }}" style="max-width: 100%; height: auto">
|
||||||
|
<source src="./{{ ../../folder }}-{{ ../../key }}-{{ filename }}" type="video/mp4">
|
||||||
|
Example output with value set to {{{ ../value }}}
|
||||||
|
</video>
|
||||||
|
{{/ video }}
|
||||||
|
{{# image }}
|
||||||
|
<img
|
||||||
|
src="./{{ ../../folder }}-{{ ../../key }}-{{ filename }}"
|
||||||
|
alt="Example output with value set to {{{ ../value }}}"
|
||||||
|
width="{{ width }}" height="{{ height }}" style="height: auto"
|
||||||
|
/>
|
||||||
|
{{/ image }}
|
||||||
|
|
||||||
|
{{# text }}
|
||||||
|
- {{{ . }}}
|
||||||
|
{{/ text }}
|
||||||
|
|
||||||
|
{{/ examples }}
|
||||||
|
## Read current value
|
||||||
|
```bash
|
||||||
|
defaults read {{ domain }} {{ key }}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Delete current value
|
||||||
|
```bash
|
||||||
|
defaults delete {{ domain }} {{ key }}{{# if after }} && {{ after }}{{/ if }}
|
||||||
|
```
|
61
build/production/write-tree.js
Normal file
61
build/production/write-tree.js
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
const fs = require('fs')
|
||||||
|
const Handlebars = require('handlebars')
|
||||||
|
|
||||||
|
module.exports = (defaults, destinationPath) => {
|
||||||
|
fs.mkdirSync(destinationPath)
|
||||||
|
fs.mkdirSync(`${destinationPath}/.vuepress`)
|
||||||
|
fs.mkdirSync(`${destinationPath}/.vuepress/public`)
|
||||||
|
|
||||||
|
fs.copyFileSync('./templates/.vuepress/public/favicon.ico', `${destinationPath}/.vuepress/public/favicon.ico`)
|
||||||
|
|
||||||
|
const homeTemplate = fs.readFileSync('./templates/home.md.handlebars', 'utf8')
|
||||||
|
const rootReadmeContent = Handlebars.compile(homeTemplate)(defaults)
|
||||||
|
fs.writeFileSync(`${destinationPath}/readme.md`, rootReadmeContent)
|
||||||
|
|
||||||
|
const vuepressConfig = fs.readFileSync('./templates/.vuepress/config.yml.handlebars', 'utf8')
|
||||||
|
const vuepressConfigContent = Handlebars.compile(vuepressConfig)(defaults)
|
||||||
|
fs.writeFileSync(`${destinationPath}/.vuepress/config.yml`, vuepressConfigContent)
|
||||||
|
|
||||||
|
if (defaults.categories !== null) {
|
||||||
|
const categoryTemplate = fs.readFileSync('./templates/category.md.handlebars', 'utf8')
|
||||||
|
const renderCategory = Handlebars.compile(categoryTemplate)
|
||||||
|
defaults.categories.forEach(category => {
|
||||||
|
fs.mkdirSync(`${destinationPath}/${category.folder}`)
|
||||||
|
const categoryReadmeContent = renderCategory(category)
|
||||||
|
fs.writeFileSync(`${destinationPath}/${category.folder}/readme.md`, categoryReadmeContent)
|
||||||
|
|
||||||
|
if (category.image !== undefined) {
|
||||||
|
fs.copyFileSync(
|
||||||
|
`../../images/${category.folder}/${category.image.filename}`,
|
||||||
|
`${destinationPath}/${category.folder}/${category.image.filename}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const pageTemplate = fs.readFileSync('./templates/page.md.handlebars', 'utf8')
|
||||||
|
const renderPage = Handlebars.compile(pageTemplate)
|
||||||
|
defaults.categories.forEach(({ folder, name, keys }) => {
|
||||||
|
if (keys === undefined) { return }
|
||||||
|
|
||||||
|
keys.forEach(({ domain, ...page }) => {
|
||||||
|
const pageReadmeContent = renderPage({ ...page, folder, name, domain })
|
||||||
|
fs.writeFileSync(`${destinationPath}/${folder}/${page.key}.md`, pageReadmeContent)
|
||||||
|
|
||||||
|
page.examples.forEach(example => {
|
||||||
|
if (example.image !== undefined) {
|
||||||
|
fs.copyFileSync(
|
||||||
|
`../../images/${folder}/${page.key}/${example.image.filename}`,
|
||||||
|
`${destinationPath}/${folder}/${folder}-${page.key}-${example.image.filename}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (example.video !== undefined) {
|
||||||
|
fs.copyFileSync(
|
||||||
|
`../../images/${folder}/${page.key}/${example.video.filename}`,
|
||||||
|
`${destinationPath}/${folder}/${folder}-${page.key}-${example.video.filename}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
773
build/production/write-tree.test.js
Normal file
773
build/production/write-tree.test.js
Normal file
|
@ -0,0 +1,773 @@
|
||||||
|
const fs = require('fs')
|
||||||
|
jest.mock('fs')
|
||||||
|
|
||||||
|
const writeTree = require('./write-tree')
|
||||||
|
|
||||||
|
const destinationPath = './dist'
|
||||||
|
const copiedFiles = ['.vuepress/public/favicon.ico']
|
||||||
|
|
||||||
|
describe('write-tree', () => {
|
||||||
|
afterEach(() => {
|
||||||
|
jest.clearAllMocks()
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('no categories', () => {
|
||||||
|
beforeEach(() => callWriteTree({ categories: null }))
|
||||||
|
|
||||||
|
it('should copy some static files', () => {
|
||||||
|
copiedFiles.forEach(file => {
|
||||||
|
const fileContent = readFile(`${destinationPath}/${file}`)
|
||||||
|
expect(fileContent).toEqual(`copied:./templates/${file}`)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write an empty readme.md file using the home template', () => {
|
||||||
|
const rootReadmeContent = readFile(`${destinationPath}/readme.md`)
|
||||||
|
expect(rootReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a vuepress config.yml file using the template', () => {
|
||||||
|
const vuepressConfigContent = readFile(
|
||||||
|
`${destinationPath}/.vuepress/config.yml`
|
||||||
|
)
|
||||||
|
expect(vuepressConfigContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('one category, no page', () => {
|
||||||
|
describe('with image', () => {
|
||||||
|
beforeEach(() =>
|
||||||
|
callWriteTree({
|
||||||
|
categories: [
|
||||||
|
{
|
||||||
|
folder: 'category',
|
||||||
|
name: 'Category',
|
||||||
|
description: 'Category description.',
|
||||||
|
image: {
|
||||||
|
filename: 'category.png',
|
||||||
|
width: 740,
|
||||||
|
height: 80
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
it('should copy some static files', () => {
|
||||||
|
copiedFiles.forEach(file => {
|
||||||
|
const fileContent = readFile(`${destinationPath}/${file}`)
|
||||||
|
expect(fileContent).toEqual(`copied:./templates/${file}`)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a readme.md file using the home template', () => {
|
||||||
|
const rootReadmeContent = readFile(`${destinationPath}/readme.md`)
|
||||||
|
expect(rootReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a vuepress config.yml file using the template', () => {
|
||||||
|
const vuepressConfigContent = readFile(
|
||||||
|
`${destinationPath}/.vuepress/config.yml`
|
||||||
|
)
|
||||||
|
expect(vuepressConfigContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a category/readme.md file using the category template', () => {
|
||||||
|
const categoryReadmeContent = readFile(
|
||||||
|
`${destinationPath}/category/readme.md`
|
||||||
|
)
|
||||||
|
expect(categoryReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should copy the category.png example image to a category folder', () => {
|
||||||
|
const originImagePath = readFile(
|
||||||
|
`${destinationPath}/category/category.png`
|
||||||
|
)
|
||||||
|
expect(originImagePath).toMatchInlineSnapshot(
|
||||||
|
`"copied:../../images/category/category.png"`
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('one category, one page', () => {
|
||||||
|
describe('with text example', () => {
|
||||||
|
describe('with special chars values', () => {
|
||||||
|
beforeEach(() =>
|
||||||
|
callWriteTree({
|
||||||
|
categories: [
|
||||||
|
{
|
||||||
|
folder: 'category',
|
||||||
|
name: 'Category',
|
||||||
|
description: 'Category description.',
|
||||||
|
keys: [
|
||||||
|
{
|
||||||
|
key: 'page',
|
||||||
|
domain: 'com.apple.category',
|
||||||
|
title: 'Page',
|
||||||
|
description: 'Page description.',
|
||||||
|
param: { type: 'bool' },
|
||||||
|
examples: [
|
||||||
|
{
|
||||||
|
value: '~/Desktop',
|
||||||
|
default: true,
|
||||||
|
text: 'output when value is ~/Desktop'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '~/Pictures',
|
||||||
|
text: 'output when value is ~/Pictures'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
versions: ['Big Sur']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
it('should copy some static files', () => {
|
||||||
|
copiedFiles.forEach(file => {
|
||||||
|
const fileContent = readFile(`${destinationPath}/${file}`)
|
||||||
|
expect(fileContent).toEqual(`copied:./templates/${file}`)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a readme.md file using the home template', () => {
|
||||||
|
const rootReadmeContent = readFile(`${destinationPath}/readme.md`)
|
||||||
|
expect(rootReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a vuepress config.yml file using the template', () => {
|
||||||
|
const vuepressConfigContent = readFile(
|
||||||
|
`${destinationPath}/.vuepress/config.yml`
|
||||||
|
)
|
||||||
|
expect(vuepressConfigContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a category/readme.md file using the category template', () => {
|
||||||
|
const categoryReadmeContent = readFile(
|
||||||
|
`${destinationPath}/category/readme.md`
|
||||||
|
)
|
||||||
|
expect(categoryReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a category/page.md file using the page template', () => {
|
||||||
|
const pageReadmeContent = readFile(
|
||||||
|
`${destinationPath}/category/page.md`
|
||||||
|
)
|
||||||
|
expect(pageReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('with requirements', () => {
|
||||||
|
beforeEach(() =>
|
||||||
|
callWriteTree({
|
||||||
|
categories: [
|
||||||
|
{
|
||||||
|
folder: 'category',
|
||||||
|
name: 'Category',
|
||||||
|
description: 'Category description.',
|
||||||
|
keys: [
|
||||||
|
{
|
||||||
|
key: 'page',
|
||||||
|
domain: 'com.apple.category',
|
||||||
|
title: 'Page',
|
||||||
|
description: 'Page description.',
|
||||||
|
param: { type: 'string' },
|
||||||
|
requirements: [
|
||||||
|
{
|
||||||
|
folder: 'another-category',
|
||||||
|
key: 'another-key',
|
||||||
|
name: 'com.apple.category2 another-key',
|
||||||
|
value: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
folder: 'a-third-category',
|
||||||
|
key: 'a-third-key',
|
||||||
|
name: 'com.apple.category2 a-third-key',
|
||||||
|
value: 0.5
|
||||||
|
},
|
||||||
|
],
|
||||||
|
examples: [
|
||||||
|
{
|
||||||
|
value: true,
|
||||||
|
default: true,
|
||||||
|
text: 'output when value is true'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: false,
|
||||||
|
text: 'output when value is false'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
versions: ['Big Sur'],
|
||||||
|
after: 'killall App'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
it('should copy some static files', () => {
|
||||||
|
copiedFiles.forEach(file => {
|
||||||
|
const fileContent = readFile(`${destinationPath}/${file}`)
|
||||||
|
expect(fileContent).toEqual(`copied:./templates/${file}`)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a readme.md file using the home template', () => {
|
||||||
|
const rootReadmeContent = readFile(`${destinationPath}/readme.md`)
|
||||||
|
expect(rootReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a vuepress config.yml file using the template', () => {
|
||||||
|
const vuepressConfigContent = readFile(
|
||||||
|
`${destinationPath}/.vuepress/config.yml`
|
||||||
|
)
|
||||||
|
expect(vuepressConfigContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a category/readme.md file using the category template', () => {
|
||||||
|
const categoryReadmeContent = readFile(
|
||||||
|
`${destinationPath}/category/readme.md`
|
||||||
|
)
|
||||||
|
expect(categoryReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a category/page.md file using the page template', () => {
|
||||||
|
const pageReadmeContent = readFile(
|
||||||
|
`${destinationPath}/category/page.md`
|
||||||
|
)
|
||||||
|
expect(pageReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('with an after command', () => {
|
||||||
|
beforeEach(() =>
|
||||||
|
callWriteTree({
|
||||||
|
categories: [
|
||||||
|
{
|
||||||
|
folder: 'category',
|
||||||
|
name: 'Category',
|
||||||
|
description: 'Category description.',
|
||||||
|
keys: [
|
||||||
|
{
|
||||||
|
key: 'page',
|
||||||
|
domain: 'com.apple.category',
|
||||||
|
title: 'Page',
|
||||||
|
description: 'Page description.',
|
||||||
|
param: { type: 'string' },
|
||||||
|
examples: [
|
||||||
|
{
|
||||||
|
value: '~/Desktop',
|
||||||
|
default: true,
|
||||||
|
text: 'output when value is ~/Desktop'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '~/Pictures',
|
||||||
|
text: 'output when value is ~/Pictures'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
versions: ['Big Sur'],
|
||||||
|
after: 'killall App'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
it('should copy some static files', () => {
|
||||||
|
copiedFiles.forEach(file => {
|
||||||
|
const fileContent = readFile(`${destinationPath}/${file}`)
|
||||||
|
expect(fileContent).toEqual(`copied:./templates/${file}`)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a readme.md file using the home template', () => {
|
||||||
|
const rootReadmeContent = readFile(`${destinationPath}/readme.md`)
|
||||||
|
expect(rootReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a vuepress config.yml file using the template', () => {
|
||||||
|
const vuepressConfigContent = readFile(
|
||||||
|
`${destinationPath}/.vuepress/config.yml`
|
||||||
|
)
|
||||||
|
expect(vuepressConfigContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a category/readme.md file using the category template', () => {
|
||||||
|
const categoryReadmeContent = readFile(
|
||||||
|
`${destinationPath}/category/readme.md`
|
||||||
|
)
|
||||||
|
expect(categoryReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a category/page.md file using the page template', () => {
|
||||||
|
const pageReadmeContent = readFile(
|
||||||
|
`${destinationPath}/category/page.md`
|
||||||
|
)
|
||||||
|
expect(pageReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('with text and possible values example', () => {
|
||||||
|
beforeEach(() =>
|
||||||
|
callWriteTree({
|
||||||
|
categories: [
|
||||||
|
{
|
||||||
|
folder: 'category',
|
||||||
|
name: 'Category',
|
||||||
|
description: 'Category description.',
|
||||||
|
keys: [
|
||||||
|
{
|
||||||
|
key: 'page',
|
||||||
|
domain: 'com.apple.category',
|
||||||
|
title: 'Page',
|
||||||
|
description: 'Page description.',
|
||||||
|
param: { type: 'string', values: ['start', 'middle', 'end'] },
|
||||||
|
examples: [
|
||||||
|
{
|
||||||
|
value: 'start',
|
||||||
|
text: 'output when value is start'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'middle',
|
||||||
|
default: true,
|
||||||
|
text: 'output when value is middle'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'end',
|
||||||
|
text: 'output when value is end'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
versions: ['Big Sur']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
it('should copy some static files', () => {
|
||||||
|
copiedFiles.forEach(file => {
|
||||||
|
const fileContent = readFile(`${destinationPath}/${file}`)
|
||||||
|
expect(fileContent).toEqual(`copied:./templates/${file}`)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a readme.md file using the home template', () => {
|
||||||
|
const rootReadmeContent = readFile(`${destinationPath}/readme.md`)
|
||||||
|
expect(rootReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a vuepress config.yml file using the template', () => {
|
||||||
|
const vuepressConfigContent = readFile(
|
||||||
|
`${destinationPath}/.vuepress/config.yml`
|
||||||
|
)
|
||||||
|
expect(vuepressConfigContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a category/readme.md file using the category template', () => {
|
||||||
|
const categoryReadmeContent = readFile(
|
||||||
|
`${destinationPath}/category/readme.md`
|
||||||
|
)
|
||||||
|
expect(categoryReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a category/page.md file using the page template', () => {
|
||||||
|
const pageReadmeContent = readFile(
|
||||||
|
`${destinationPath}/category/page.md`
|
||||||
|
)
|
||||||
|
expect(pageReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('with image example', () => {
|
||||||
|
beforeEach(() =>
|
||||||
|
callWriteTree({
|
||||||
|
categories: [
|
||||||
|
{
|
||||||
|
folder: 'category',
|
||||||
|
name: 'Category',
|
||||||
|
description: 'Category description.',
|
||||||
|
keys: [
|
||||||
|
{
|
||||||
|
key: 'page',
|
||||||
|
domain: 'com.apple.category',
|
||||||
|
title: 'Page',
|
||||||
|
description: 'Page description.',
|
||||||
|
param: { type: 'bool' },
|
||||||
|
examples: [
|
||||||
|
{
|
||||||
|
value: true,
|
||||||
|
default: true,
|
||||||
|
image: {
|
||||||
|
filename: 'true.png',
|
||||||
|
width: 600,
|
||||||
|
height: 400
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: false,
|
||||||
|
image: {
|
||||||
|
filename: 'false.png',
|
||||||
|
width: 400,
|
||||||
|
height: 200
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
versions: ['Big Sur']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
it('should copy some static files', () => {
|
||||||
|
copiedFiles.forEach(file => {
|
||||||
|
const fileContent = readFile(`${destinationPath}/${file}`)
|
||||||
|
expect(fileContent).toEqual(`copied:./templates/${file}`)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a readme.md file using the home template', () => {
|
||||||
|
const rootReadmeContent = readFile(`${destinationPath}/readme.md`)
|
||||||
|
expect(rootReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a vuepress config.yml file using the template', () => {
|
||||||
|
const vuepressConfigContent = readFile(
|
||||||
|
`${destinationPath}/.vuepress/config.yml`
|
||||||
|
)
|
||||||
|
expect(vuepressConfigContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a category/readme.md file using the category template', () => {
|
||||||
|
const categoryReadmeContent = readFile(
|
||||||
|
`${destinationPath}/category/readme.md`
|
||||||
|
)
|
||||||
|
expect(categoryReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a category/page.md file using the page template', () => {
|
||||||
|
const pageReadmeContent = readFile(
|
||||||
|
`${destinationPath}/category/page.md`
|
||||||
|
)
|
||||||
|
expect(pageReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should copy the true.png example image to a category/category-page-true folder', () => {
|
||||||
|
const originImagePath = readFile(
|
||||||
|
`${destinationPath}/category/category-page-true.png`
|
||||||
|
)
|
||||||
|
expect(originImagePath).toMatchInlineSnapshot(
|
||||||
|
`"copied:../../images/category/page/true.png"`
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should copy the false.png example image to a category/category-page-false folder', () => {
|
||||||
|
const originImagePath = readFile(
|
||||||
|
`${destinationPath}/category/category-page-false.png`
|
||||||
|
)
|
||||||
|
expect(originImagePath).toMatchInlineSnapshot(
|
||||||
|
`"copied:../../images/category/page/false.png"`
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('with video example', () => {
|
||||||
|
beforeEach(() =>
|
||||||
|
callWriteTree({
|
||||||
|
categories: [
|
||||||
|
{
|
||||||
|
folder: 'category',
|
||||||
|
name: 'Category',
|
||||||
|
description: 'Category description.',
|
||||||
|
keys: [
|
||||||
|
{
|
||||||
|
key: 'page',
|
||||||
|
domain: 'com.apple.category',
|
||||||
|
title: 'Page',
|
||||||
|
description: 'Page description.',
|
||||||
|
param: { type: 'float' },
|
||||||
|
examples: [
|
||||||
|
{
|
||||||
|
value: '0',
|
||||||
|
default: true,
|
||||||
|
video: {
|
||||||
|
filename: '0.mp4',
|
||||||
|
width: 750,
|
||||||
|
height: 400
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: '0.5',
|
||||||
|
video: {
|
||||||
|
filename: '0.5.mp4',
|
||||||
|
width: 720,
|
||||||
|
height: 390
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
versions: ['Big Sur']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
it('should copy some static files', () => {
|
||||||
|
copiedFiles.forEach(file => {
|
||||||
|
const fileContent = readFile(`${destinationPath}/${file}`)
|
||||||
|
expect(fileContent).toEqual(`copied:./templates/${file}`)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a readme.md file using the home template', () => {
|
||||||
|
const rootReadmeContent = readFile(`${destinationPath}/readme.md`)
|
||||||
|
expect(rootReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a vuepress config.yml file using the template', () => {
|
||||||
|
const vuepressConfigContent = readFile(
|
||||||
|
`${destinationPath}/.vuepress/config.yml`
|
||||||
|
)
|
||||||
|
expect(vuepressConfigContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a category/readme.md file using the category template', () => {
|
||||||
|
const categoryReadmeContent = readFile(
|
||||||
|
`${destinationPath}/category/readme.md`
|
||||||
|
)
|
||||||
|
expect(categoryReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a category/page.md file using the page template', () => {
|
||||||
|
const pageReadmeContent = readFile(
|
||||||
|
`${destinationPath}/category/page.md`
|
||||||
|
)
|
||||||
|
expect(pageReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should copy the 0.mp4 example video to a category/category-page-0 folder', () => {
|
||||||
|
const originVideoPath = readFile(
|
||||||
|
`${destinationPath}/category/category-page-0.mp4`
|
||||||
|
)
|
||||||
|
expect(originVideoPath).toMatchInlineSnapshot(
|
||||||
|
`"copied:../../images/category/page/0.mp4"`
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should copy the 0.5.mp4 example video to a category/category-page-0.5 folder', () => {
|
||||||
|
const originVideoPath = readFile(
|
||||||
|
`${destinationPath}/category/category-page-0.5.mp4`
|
||||||
|
)
|
||||||
|
expect(originVideoPath).toMatchInlineSnapshot(
|
||||||
|
`"copied:../../images/category/page/0.5.mp4"`
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('one category, two pages', () => {
|
||||||
|
beforeEach(() =>
|
||||||
|
callWriteTree({
|
||||||
|
categories: [
|
||||||
|
{
|
||||||
|
folder: 'category',
|
||||||
|
name: 'Category',
|
||||||
|
description: 'Category description.',
|
||||||
|
keys: [
|
||||||
|
{
|
||||||
|
key: 'page1',
|
||||||
|
domain: 'com.apple.category',
|
||||||
|
title: 'Page 1',
|
||||||
|
description: 'Page 1 description.',
|
||||||
|
param: { type: 'bool' },
|
||||||
|
examples: [
|
||||||
|
{
|
||||||
|
value: true,
|
||||||
|
default: true,
|
||||||
|
text: 'output when value is true'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: false,
|
||||||
|
text: 'output when value is false'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
versions: ['Big Sur']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'page2',
|
||||||
|
domain: 'com.apple.category',
|
||||||
|
title: 'Page 2',
|
||||||
|
description: 'Page 2 description.',
|
||||||
|
param: { type: 'bool' },
|
||||||
|
examples: [
|
||||||
|
{
|
||||||
|
value: true,
|
||||||
|
text: 'output when value is true'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: false,
|
||||||
|
default: true,
|
||||||
|
text: 'output when value is false'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
versions: ['Big Sur']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
it('should copy some static files', () => {
|
||||||
|
copiedFiles.forEach(file => {
|
||||||
|
const fileContent = readFile(`${destinationPath}/${file}`)
|
||||||
|
expect(fileContent).toEqual(`copied:./templates/${file}`)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a readme.md file using the home template', () => {
|
||||||
|
const rootReadmeContent = readFile(`${destinationPath}/readme.md`)
|
||||||
|
expect(rootReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a vuepress config.yml file using the template', () => {
|
||||||
|
const vuepressConfigContent = readFile(
|
||||||
|
`${destinationPath}/.vuepress/config.yml`
|
||||||
|
)
|
||||||
|
expect(vuepressConfigContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a category/readme.md file using the category template', () => {
|
||||||
|
const categoryReadmeContent = readFile(
|
||||||
|
`${destinationPath}/category/readme.md`
|
||||||
|
)
|
||||||
|
expect(categoryReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a category/page1.md file using the page template', () => {
|
||||||
|
const pageReadmeContent = readFile(`${destinationPath}/category/page1.md`)
|
||||||
|
expect(pageReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a category/page2.md file using the page template', () => {
|
||||||
|
const pageReadmeContent = readFile(`${destinationPath}/category/page2.md`)
|
||||||
|
expect(pageReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('two categories, one page in each', () => {
|
||||||
|
beforeEach(() =>
|
||||||
|
callWriteTree({
|
||||||
|
categories: [
|
||||||
|
{
|
||||||
|
folder: 'category1',
|
||||||
|
name: 'Category 1',
|
||||||
|
description: 'Category 1 description.',
|
||||||
|
keys: [
|
||||||
|
{
|
||||||
|
key: 'page',
|
||||||
|
domain: 'com.apple.category1',
|
||||||
|
title: 'Page',
|
||||||
|
description: 'Page description.',
|
||||||
|
param: { type: 'bool' },
|
||||||
|
examples: [
|
||||||
|
{
|
||||||
|
value: true,
|
||||||
|
default: true,
|
||||||
|
text: 'output when value is true'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: false,
|
||||||
|
text: 'output when value is false'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
versions: ['Big Sur']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
folder: 'category2',
|
||||||
|
name: 'Category 2',
|
||||||
|
description: 'Category 2 description.',
|
||||||
|
keys: [
|
||||||
|
{
|
||||||
|
key: 'page',
|
||||||
|
domain: 'com.apple.category2',
|
||||||
|
title: 'Page',
|
||||||
|
description: 'Page description.',
|
||||||
|
param: { type: 'bool' },
|
||||||
|
examples: [
|
||||||
|
{
|
||||||
|
value: true,
|
||||||
|
text: 'output when value is true'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: false,
|
||||||
|
default: true,
|
||||||
|
text: 'output when value is false'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
versions: ['Big Sur']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
it('should copy some static files', () => {
|
||||||
|
copiedFiles.forEach(file => {
|
||||||
|
const fileContent = readFile(`${destinationPath}/${file}`)
|
||||||
|
expect(fileContent).toEqual(`copied:./templates/${file}`)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a readme.md file using the home template', () => {
|
||||||
|
const rootReadmeContent = readFile(`${destinationPath}/readme.md`)
|
||||||
|
expect(rootReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a vuepress config.yml file using the template', () => {
|
||||||
|
const vuepressConfigContent = readFile(
|
||||||
|
`${destinationPath}/.vuepress/config.yml`
|
||||||
|
)
|
||||||
|
expect(vuepressConfigContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a category1/readme.md file using the category template', () => {
|
||||||
|
const categoryReadmeContent = readFile(
|
||||||
|
`${destinationPath}/category1/readme.md`
|
||||||
|
)
|
||||||
|
expect(categoryReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a category2/readme.md file using the category template', () => {
|
||||||
|
const categoryReadmeContent = readFile(
|
||||||
|
`${destinationPath}/category2/readme.md`
|
||||||
|
)
|
||||||
|
expect(categoryReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a category1/page.md file using the page template', () => {
|
||||||
|
const pageReadmeContent = readFile(`${destinationPath}/category1/page.md`)
|
||||||
|
expect(pageReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should write a category2/page.md file using the page template', () => {
|
||||||
|
const pageReadmeContent = readFile(`${destinationPath}/category2/page.md`)
|
||||||
|
expect(pageReadmeContent).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
const callWriteTree = sourceFile => writeTree(sourceFile, destinationPath)
|
||||||
|
const readFile = file => fs.readFakeFileSync(file, 'utf8')
|
9567
build/production/yarn.lock
Normal file
9567
build/production/yarn.lock
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue