Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Prettier formatting for docs #187

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Lint

on:
workflow_dispatch:
push:
pull_request:

jobs:
prettier:
name: Verify formatting
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v2

- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: '14.x'

# We do it this way so that we can just use the existing package.json script
# to make future changes to the formatting script easier
- name: Set up Prettier
run: npm i -g prettier

- name: Check formatting
run: npm run format -- --check
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ docs/it/extend/update-b14.md
docs/it/extend/update-b13.md
docs/it/extend/update-b12.md
docs/it/extend/update-b10.md
.vscode
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 150,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5"
}
18 changes: 11 additions & 7 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const locales = require('./config/locales');

module.exports = ctx => ({
module.exports = (ctx) => ({
base: '/',

head: require('./config/head'),
Expand All @@ -10,21 +10,25 @@ module.exports = ctx => ({

head: [
['link', { href: 'https://fonts.googleapis.com/css2?family=Mukta:wght@200;400;600&display=swap', rel: 'stylesheet' }],
['script', {id: "scriptImporter"}, `
[
'script',
{ id: 'scriptImporter' },
`
(function() {
var script = document.createElement("script");
script.src = "/js/i18n.js";
setTimeout(() => document.body.append(script))
})();
`]
`,
],
],

themeConfig: {
logo: "/logo-docs.svg",
logo: '/logo-docs.svg',

algolia: ctx.isProd && {
apiKey: '8f760cdb850b1e696b72329eed96b01b',
indexName: 'flarum'
apiKey: '8f760cdb850b1e696b72329eed96b01b',
indexName: 'flarum',
},
searchPlaceholder: 'Search Docs',

Expand All @@ -34,4 +38,4 @@ module.exports = ctx => ({

locales: locales.theme(),
},
})
});
15 changes: 8 additions & 7 deletions docs/.vuepress/config/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ module.exports = [
rel: 'icon',
type: 'image/png',
size: '32x32',
href: '/favicon-32x32.png'
}
], [
href: '/favicon-32x32.png',
},
],
[
'link',
{
rel: 'icon',
type: 'image/png',
size: '192x192',
href: '/favicon-192x192.png'
}
]
]
href: '/favicon-192x192.png',
},
],
];
6 changes: 3 additions & 3 deletions docs/.vuepress/config/locales/en/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
lang: 'en',
title: 'Flarum Documentation',
}
lang: 'en',
title: 'Flarum Documentation',
};
24 changes: 12 additions & 12 deletions docs/.vuepress/config/locales/en/nav.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module.exports = [
{ text: 'Guide', link: '/' },
{ text: 'Extend', link: '/extend/' },
{ text: 'API Reference', link: 'https://api.docs.flarum.org/' },
{
text: 'Flarum',
items: [
{ text: 'Home', link: 'https://flarum.org/' },
{ text: 'Community', link: 'https://discuss.flarum.org/' },
{ text: 'GitHub', link: 'https://github.com/flarum/flarum/' },
]
}
]
{ text: 'Guide', link: '/' },
{ text: 'Extend', link: '/extend/' },
{ text: 'API Reference', link: 'https://api.docs.flarum.org/' },
{
text: 'Flarum',
items: [
{ text: 'Home', link: 'https://flarum.org/' },
{ text: 'Community', link: 'https://discuss.flarum.org/' },
{ text: 'GitHub', link: 'https://github.com/flarum/flarum/' },
],
},
];
62 changes: 12 additions & 50 deletions docs/.vuepress/config/locales/en/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@ module.exports = {
{
title: 'Main Concepts',
collapsable: false,
children: [
'',
'start',
'frontend',
'routes',
'models',
'api',
'distribution'
]
children: ['', 'start', 'frontend', 'routes', 'models', 'api', 'distribution'],
},
{
title: 'Reference Guides',
Expand All @@ -27,8 +19,8 @@ module.exports = {
'permissions',
'settings',
'testing',
'theme'
]
'theme',
],
},
{
title: 'Advanced Guides',
Expand All @@ -45,21 +37,13 @@ module.exports = {
'notifications',
'post-types',
'search',
'service-provider'
]
'service-provider',
],
},
{
title: 'Update Guides',
collapsable: false,
children: [
'update-b16',
'update-b15',
'update-b14',
'update-b13',
'update-b12',
'update-b10',
'update-b8',
]
children: ['update-b16', 'update-b15', 'update-b14', 'update-b13', 'update-b12', 'update-b10', 'update-b8'],
},
// {
// title: 'Themes',
Expand All @@ -80,44 +64,22 @@ module.exports = {
{
title: 'Introduction',
collapsable: false,
children: [
'',
'code-of-conduct',
'releases',
'contributing',
'bugs',
'faq'
]
children: ['', 'code-of-conduct', 'releases', 'contributing', 'bugs', 'faq'],
},
{
title: 'Setting Up',
collapsable: false,
children: [
'composer',
'install',
'update',
'troubleshoot'
]
children: ['composer', 'install', 'update', 'troubleshoot'],
},
{
title: 'Management',
collapsable: false,
children: [
'admin',
'config',
'extensions',
'languages',
'themes',
'mail',
'console'
]
children: ['admin', 'config', 'extensions', 'languages', 'themes', 'mail', 'console'],
},
{
title: 'Advanced',
collapsable: false,
children: [
'extenders'
]
}
children: ['extenders'],
},
],
}
};
18 changes: 9 additions & 9 deletions docs/.vuepress/config/locales/en/theme.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module.exports = {
selectText: 'Languages',
label: 'English',
selectText: 'Languages',
label: 'English',

searchPlaceholder: 'Search Docs',

editLinkText: 'Edit this page',
lastUpdated: 'Last Updated',
searchPlaceholder: 'Search Docs',

nav: require('./nav'),
sidebar: require('./sidebar'),
}
editLinkText: 'Edit this page',
lastUpdated: 'Last Updated',

nav: require('./nav'),
sidebar: require('./sidebar'),
};
6 changes: 3 additions & 3 deletions docs/.vuepress/config/locales/es/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
lang: 'es',
title: 'Documentación de Flarum',
}
lang: 'es',
title: 'Documentación de Flarum',
};
24 changes: 12 additions & 12 deletions docs/.vuepress/config/locales/es/nav.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module.exports = [
{ text: 'Guía', link: '/es/' },
{ text: 'Extender', link: '/es/extend/' },
{ text: 'Referencia de la API', link: 'https://api.docs.flarum.org/' },
{
text: 'Flarum',
items: [
{ text: 'Inicio', link: 'https://flarum.org/' },
{ text: 'Comunidad', link: 'https://discuss.flarum.org/' },
{ text: 'GitHub', link: 'https://github.com/flarum/flarum/' },
]
}
]
{ text: 'Guía', link: '/es/' },
{ text: 'Extender', link: '/es/extend/' },
{ text: 'Referencia de la API', link: 'https://api.docs.flarum.org/' },
{
text: 'Flarum',
items: [
{ text: 'Inicio', link: 'https://flarum.org/' },
{ text: 'Comunidad', link: 'https://discuss.flarum.org/' },
{ text: 'GitHub', link: 'https://github.com/flarum/flarum/' },
],
},
];
49 changes: 8 additions & 41 deletions docs/.vuepress/config/locales/es/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,12 @@ module.exports = {
{
title: 'Conceptos Principales',
collapsable: false,
children: [
'',
'start',
'frontend',
'routes',
'data',
'distribution',
'update-b16',
]
children: ['', 'start', 'frontend', 'routes', 'data', 'distribution', 'update-b16'],
},
{
title: 'Guías de Referencia',
collapsable: false,
children: [
'admin',
'frontend-pages',
'interactive-components',
'forms',
'backend-events',
]
children: ['admin', 'frontend-pages', 'interactive-components', 'forms', 'backend-events'],
},
{
title: 'Guías Avanzadas',
Expand All @@ -43,7 +29,7 @@ module.exports = {
'service-provider',
'settings',
'testing',
]
],
},
// {
// title: 'Themes',
Expand All @@ -64,36 +50,17 @@ module.exports = {
{
title: 'Introducción',
collapsable: false,
children: [
'',
'code-of-conduct',
'releases',
'contributing',
'bugs',
'faq'
]
children: ['', 'code-of-conduct', 'releases', 'contributing', 'bugs', 'faq'],
},
{
title: 'Configuración',
collapsable: false,
children: [
'install',
'update',
'troubleshoot'
]
children: ['install', 'update', 'troubleshoot'],
},
{
title: 'Gestión',
collapsable: false,
children: [
'admin',
'config',
'extensions',
'languages',
'themes',
'mail',
'console'
]
}
children: ['admin', 'config', 'extensions', 'languages', 'themes', 'mail', 'console'],
},
],
}
};
Loading