@docsector/docsector-reader 0.2.9 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/docsector.js +10 -3
- package/package.json +1 -1
- package/src/boot/i18n.js +11 -1
package/bin/docsector.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import { execSync, spawn } from 'child_process'
|
|
15
|
-
import { existsSync, mkdirSync, writeFileSync } from 'fs'
|
|
15
|
+
import { existsSync, mkdirSync, writeFileSync, copyFileSync } from 'fs'
|
|
16
16
|
import { resolve, dirname, basename } from 'path'
|
|
17
17
|
import { fileURLToPath } from 'url'
|
|
18
18
|
|
|
@@ -23,7 +23,7 @@ const packageRoot = resolve(__dirname, '..')
|
|
|
23
23
|
const args = process.argv.slice(2)
|
|
24
24
|
const command = args[0]
|
|
25
25
|
|
|
26
|
-
const VERSION = '0.
|
|
26
|
+
const VERSION = '0.3.1'
|
|
27
27
|
|
|
28
28
|
const HELP = `
|
|
29
29
|
Docsector Reader v${VERSION}
|
|
@@ -71,7 +71,7 @@ function getTemplatePackageJson (name) {
|
|
|
71
71
|
serve: 'docsector serve'
|
|
72
72
|
},
|
|
73
73
|
dependencies: {
|
|
74
|
-
'@docsector/docsector-reader': '^0.
|
|
74
|
+
'@docsector/docsector-reader': '^0.3.1',
|
|
75
75
|
'@quasar/extras': '^1.16.12',
|
|
76
76
|
'quasar': '^2.16.6',
|
|
77
77
|
'vue': '^3.5.13',
|
|
@@ -836,6 +836,12 @@ function initProject (name) {
|
|
|
836
836
|
writeFileSync(resolve(projectDir, filePath), content, 'utf-8')
|
|
837
837
|
}
|
|
838
838
|
|
|
839
|
+
// Copy logo from package
|
|
840
|
+
const packageLogo = resolve(packageRoot, 'public/images/logo.png')
|
|
841
|
+
if (existsSync(packageLogo)) {
|
|
842
|
+
copyFileSync(packageLogo, resolve(projectDir, 'public/images/logo.png'))
|
|
843
|
+
}
|
|
844
|
+
|
|
839
845
|
console.log(' Project structure:')
|
|
840
846
|
console.log(` ${name}/`)
|
|
841
847
|
console.log(' ├── docsector.config.js')
|
|
@@ -846,6 +852,7 @@ function initProject (name) {
|
|
|
846
852
|
console.log(' ├── .gitignore')
|
|
847
853
|
console.log(' ├── public/')
|
|
848
854
|
console.log(' │ └── images/')
|
|
855
|
+
console.log(' │ └── logo.png')
|
|
849
856
|
console.log(' └── src/')
|
|
850
857
|
console.log(' ├── css/')
|
|
851
858
|
console.log(' │ └── app.sass')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docsector/docsector-reader",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "A documentation rendering engine built with Vue 3, Quasar v2 and Vite. Transform Markdown into beautiful, navigable documentation sites.",
|
|
5
5
|
"productName": "Docsector Reader",
|
|
6
6
|
"author": "Rodrigo de Araujo Vieira",
|
package/src/boot/i18n.js
CHANGED
|
@@ -4,9 +4,19 @@ import { createI18n } from 'vue-i18n'
|
|
|
4
4
|
import messages from 'src/i18n'
|
|
5
5
|
|
|
6
6
|
export default boot(({ app }) => {
|
|
7
|
+
// Detect available locales from messages and pick the best match
|
|
8
|
+
const availableLocales = Object.keys(messages)
|
|
9
|
+
const browserLang = navigator?.language || 'en-US'
|
|
10
|
+
const locale = availableLocales.includes(browserLang)
|
|
11
|
+
? browserLang
|
|
12
|
+
: availableLocales[0] || 'en-US'
|
|
13
|
+
|
|
7
14
|
const i18n = createI18n({
|
|
8
15
|
legacy: false,
|
|
9
|
-
locale
|
|
16
|
+
locale,
|
|
17
|
+
fallbackLocale: locale,
|
|
18
|
+
missingWarn: false,
|
|
19
|
+
fallbackWarn: false,
|
|
10
20
|
messages
|
|
11
21
|
})
|
|
12
22
|
|