Skip to content

Commit 1fbb9cf

Browse files
author
Andrey Helldar
committed
Added DocSearch for documentation
1 parent 193e753 commit 1fbb9cf

File tree

7 files changed

+39
-11
lines changed

7 files changed

+39
-11
lines changed

.env.example

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
VITE_APP_ALGOLIA_APP_ID=
2+
VITE_APP_ALGOLIA_API_KEY=
3+
VITE_APP_ALGOLIA_INDEX_NAME=

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ docs/ export-ignore
88
excludes/ export-ignore
99

1010
.editorconfig export-ignore
11+
.env.example export-ignore
1112
.gitattributes export-ignore
1213
.gitignore export-ignore
1314

.github/workflows/docs.yml

+8-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ name: docs
33
on:
44
workflow_dispatch:
55
repository_dispatch:
6-
types:
7-
- generate-docs
6+
types:
7+
- generate-docs
88
release:
9-
types:
10-
- created
9+
types:
10+
- created
1111

1212
jobs:
1313
handle-dispatch:
@@ -35,11 +35,14 @@ jobs:
3535
${{ runner.os }}-npm-
3636
3737
- name: Install dependencies
38-
if: steps.npm-cache.outputs.cache-hit != 'true'
3938
run: npm i
4039

4140
- name: Build VuePress site
4241
run: npm run build
42+
env:
43+
VITE_APP_ALGOLIA_APP_ID: ${{ secrets.VITE_APP_ALGOLIA_APP_ID }}
44+
VITE_APP_ALGOLIA_API_KEY: ${{ secrets.VITE_APP_ALGOLIA_API_KEY }}
45+
VITE_APP_ALGOLIA_INDEX_NAME: ${{ secrets.VITE_APP_ALGOLIA_INDEX_NAME }}
4346

4447
- name: Deploy to GitHub Pages
4548
uses: crazy-max/ghaction-github-pages@v2

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ vendor/
66

77
.cache
88
.DS_Store
9+
.env
910
.php_cs.cache
1011
.phpintel
1112
.temp

docs/.vuepress/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.cache/
2+
.temp/
3+
4+
dist/

docs/.vuepress/config.js

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
const fs = require('fs');
22
const path = require('path');
33

4+
require('dotenv').config();
5+
6+
const hostname = 'laravel-lang.com';
7+
48
module.exports = {
59
lang: 'en-US',
610
title: 'Laravel Lang',
711
description: 'List of 78 languages for Laravel Framework 4-9, Jetstream, Fortify, Breeze, Cashier, Nova, Spark and UI.',
812

913
head: [
1014
['link', { rel: 'icon', href: '/images/logo.svg' }],
11-
['meta', { name: 'twitter:image', content: 'https://laravel-lang.com/images/social-logo.png' }]
15+
['meta', { name: 'twitter:image', content: `https://${ hostname }/images/social-logo.png` }]
1216
],
1317

1418
theme: '@vuepress/theme-default',
1519
themeConfig: {
20+
hostname,
1621
base: '/',
1722

1823
logo: '/images/logo.svg',
@@ -88,7 +93,15 @@ module.exports = {
8893
description: $page => $page.frontmatter.description,
8994
type: _ => 'website',
9095
image: (_, $site) => $site.domain + '/images/social-logo.png'
91-
}
96+
},
97+
[
98+
'@vuepress/docsearch',
99+
{
100+
appId: process.env.VITE_APP_ALGOLIA_APP_ID,
101+
apiKey: process.env.VITE_APP_ALGOLIA_API_KEY,
102+
indexName: process.env.VITE_APP_ALGOLIA_INDEX_NAME
103+
}
104+
]
92105
]
93106
]
94107
};
@@ -118,7 +131,7 @@ function getChildren(folder, sort = 'asc') {
118131
}
119132

120133
function resolveNumeric(value) {
121-
const sub = value.substr(0, value.indexOf('.'));
134+
const sub = value.substring(0, value.indexOf('.'));
122135

123136
const num = Number(sub);
124137

package.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"url": "https://github.com/Laravel-Lang/lang/issues"
1010
},
1111
"scripts": {
12-
"dev": "vuepress dev docs",
12+
"dev": "vuepress dev docs --debug",
1313
"build": "vuepress build docs"
1414
},
1515
"repository": {
@@ -20,8 +20,11 @@
2020
"docs"
2121
],
2222
"devDependencies": {
23-
"@vuepress/plugin-theme-data": "^2.0.0-beta.33",
24-
"vuepress": "^2.0.0-beta.33",
23+
"@vuepress/plugin-docsearch": "^2.0.0-beta.35",
24+
"@vuepress/plugin-theme-data": "^2.0.0-beta.35",
25+
"@vueuse/core": "^7.5.5",
26+
"dotenv": "^15.0.0",
27+
"vuepress": "^2.0.0-beta.35",
2528
"vuepress-plugin-seo": "^0.2.0"
2629
}
2730
}

0 commit comments

Comments
 (0)