bfg-common 1.0.97 → 1.0.98
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/components/common/{content → help}/navbar/left/Left.vue +2 -2
- package/components/common/{content → help}/navbar/left/utils/constructAccordion.ts +1 -1
- package/components/common/{content → help}/navbar/right/Right.vue +1 -1
- package/modules/fixContentBuild/index.ts +49 -101
- package/package.json +1 -1
- package/utils/contentBuild.ts +34 -0
- /package/components/common/{content → help}/navbar/left/models/interfaces.ts +0 -0
- /package/components/common/{content → help}/navbar/right/models/interfaces.ts +0 -0
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
import type { UI_I_Localization } from '~/models/interfaces'
|
|
31
31
|
import type { UI_T_ShowType } from '~/components/common/accordion/models/types'
|
|
32
32
|
import type { UI_I_AccordionRecursion } from '~/components/common/accordion/models/interfaces'
|
|
33
|
-
import type { UI_I_ContentNavigation } from '~/components/common/
|
|
34
|
-
import { constructItems } from '~/components/common/
|
|
33
|
+
import type { UI_I_ContentNavigation } from '~/components/common/help/navbar/left/models/interfaces'
|
|
34
|
+
import { constructItems } from '~/components/common/help/navbar/left/utils/constructAccordion'
|
|
35
35
|
|
|
36
36
|
const props = defineProps<{
|
|
37
37
|
items: UI_I_ContentNavigation[] | null
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UI_I_ContentNavigation } from '~/components/common/
|
|
1
|
+
import type { UI_I_ContentNavigation } from '~/components/common/help/navbar/left/models/interfaces'
|
|
2
2
|
import type { UI_I_AccordionRecursion } from '~/components/common/accordion/models/interfaces'
|
|
3
3
|
|
|
4
4
|
export const constructItems = (
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
</template>
|
|
25
25
|
|
|
26
26
|
<script setup lang="ts">
|
|
27
|
-
import type { UI_I_ContentNavbarItem } from '~/components/common/
|
|
27
|
+
import type { UI_I_ContentNavbarItem } from '~/components/common/help/navbar/right/models/interfaces'
|
|
28
28
|
|
|
29
29
|
const props = defineProps<{
|
|
30
30
|
title: string
|
|
@@ -8,110 +8,58 @@ import {
|
|
|
8
8
|
updateImagesPath,
|
|
9
9
|
} from './utils/methods'
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
//
|
|
23
|
-
// // Правим путь к файлу
|
|
24
|
-
// const filePath = path.join(
|
|
25
|
-
// __dirname.replace('/modules/fixContentBuild', ''),
|
|
26
|
-
// 'node_modules',
|
|
27
|
-
// '@nuxt',
|
|
28
|
-
// 'content',
|
|
29
|
-
// 'dist',
|
|
30
|
-
// 'runtime',
|
|
31
|
-
// 'legacy',
|
|
32
|
-
// 'composables',
|
|
33
|
-
// 'query.mjs'
|
|
34
|
-
// )
|
|
35
|
-
// const searchString = '/query/${hash(params)}'
|
|
36
|
-
// const replacementString = 'cache'
|
|
37
|
-
// replaceFileContent(filePath, searchString, replacementString)
|
|
38
|
-
// // End block
|
|
39
|
-
//
|
|
40
|
-
// // Переносим весь контент и удаляем все файлы кроме картинок
|
|
41
|
-
// const contentPath = path.join(
|
|
42
|
-
// __dirname.replace('/modules/fixContentBuild', ''),
|
|
43
|
-
// 'content',
|
|
44
|
-
// 'help'
|
|
45
|
-
// )
|
|
46
|
-
// if (!fs.existsSync(contentPath)) return;
|
|
47
|
-
//
|
|
48
|
-
// const publicPath = path.join(
|
|
49
|
-
// __dirname.replace('/modules/fixContentBuild', ''),
|
|
50
|
-
// 'public',
|
|
51
|
-
// 'help',
|
|
52
|
-
// 'images'
|
|
53
|
-
// )
|
|
54
|
-
// fs.cp(contentPath, publicPath, { recursive: true }, () => {
|
|
55
|
-
// // Удаляем все файлы кроме картинок
|
|
56
|
-
// removeNonImageFiles(publicPath)
|
|
57
|
-
//
|
|
58
|
-
// // Удаляем картинки из папки content
|
|
59
|
-
// removeImagesFromContent(contentPath)
|
|
60
|
-
// })
|
|
61
|
-
// // End block
|
|
62
|
-
//
|
|
63
|
-
// // Правим путь к картинкам
|
|
64
|
-
// updateImagesPath(contentPath)
|
|
65
|
-
// }
|
|
66
|
-
// })
|
|
67
|
-
// @ts-ignore
|
|
68
|
-
export default defineNuxtModule(() => {
|
|
69
|
-
if (
|
|
70
|
-
process.env.NODE_ENV === 'development' ||
|
|
71
|
-
process.env.npm_command !== 'exec'
|
|
72
|
-
)
|
|
73
|
-
return
|
|
11
|
+
export default defineNuxtModule({
|
|
12
|
+
meta: {
|
|
13
|
+
name: 'fix-content-build',
|
|
14
|
+
configKey: 'fixContentBuild',
|
|
15
|
+
},
|
|
16
|
+
setup() {
|
|
17
|
+
if (
|
|
18
|
+
process.env.NODE_ENV === 'development' ||
|
|
19
|
+
process.env.npm_command !== 'exec'
|
|
20
|
+
)
|
|
21
|
+
return
|
|
74
22
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
// End block
|
|
23
|
+
// Правим путь к файлу
|
|
24
|
+
const filePath = path.join(
|
|
25
|
+
__dirname.replace('/bfg-common/modules/fixContentBuild', ''),
|
|
26
|
+
'@nuxt',
|
|
27
|
+
'content',
|
|
28
|
+
'dist',
|
|
29
|
+
'runtime',
|
|
30
|
+
'legacy',
|
|
31
|
+
'composables',
|
|
32
|
+
'query.mjs'
|
|
33
|
+
)
|
|
34
|
+
const searchString = '/query/${hash(params)}'
|
|
35
|
+
const replacementString = 'cache'
|
|
36
|
+
replaceFileContent(filePath, searchString, replacementString)
|
|
37
|
+
// End block
|
|
91
38
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
39
|
+
// Переносим весь контент и удаляем все файлы кроме картинок
|
|
40
|
+
const contentPath = path.join(
|
|
41
|
+
__dirname.replace('/node_modules/bfg-common/modules/fixContentBuild', ''),
|
|
42
|
+
'content',
|
|
43
|
+
'help'
|
|
44
|
+
)
|
|
45
|
+
if (!fs.existsSync(contentPath)) return
|
|
99
46
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
47
|
+
const publicPath = path.join(
|
|
48
|
+
__dirname.replace('/node_modules/bfg-common/modules/fixContentBuild', ''),
|
|
49
|
+
'public',
|
|
50
|
+
'help',
|
|
51
|
+
'images'
|
|
52
|
+
)
|
|
53
|
+
fs.cp(contentPath, publicPath, { recursive: true }, () => {
|
|
54
|
+
// Удаляем все файлы кроме картинок
|
|
55
|
+
removeNonImageFiles(publicPath)
|
|
109
56
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
57
|
+
// Удаляем картинки из папки content
|
|
58
|
+
removeImagesFromContent(contentPath)
|
|
59
|
+
})
|
|
60
|
+
// End block
|
|
114
61
|
|
|
115
|
-
|
|
116
|
-
|
|
62
|
+
// Правим путь к картинкам
|
|
63
|
+
updateImagesPath(contentPath)
|
|
64
|
+
},
|
|
117
65
|
})
|
package/package.json
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
import type{ NuxtPage } from '@nuxt/schema'
|
|
4
|
+
|
|
5
|
+
export const getMaxDepth = (dirPath: string, currentDepth = 0) => {
|
|
6
|
+
let maxDepth = currentDepth
|
|
7
|
+
|
|
8
|
+
const contents = fs.readdirSync(dirPath)
|
|
9
|
+
for (const item of contents) {
|
|
10
|
+
const itemPath = path.join(dirPath, item)
|
|
11
|
+
if (fs.statSync(itemPath).isDirectory()) {
|
|
12
|
+
const depth = getMaxDepth(itemPath, currentDepth + 1)
|
|
13
|
+
maxDepth = Math.max(maxDepth, depth)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return maxDepth
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const addContentPageRecursion = (
|
|
21
|
+
pages?: NuxtPage[],
|
|
22
|
+
length?: number
|
|
23
|
+
): void => {
|
|
24
|
+
if (!pages || !length) return
|
|
25
|
+
|
|
26
|
+
pages.push({
|
|
27
|
+
name: `help-slug-${length}`,
|
|
28
|
+
path: `:slug${length}()`,
|
|
29
|
+
file: '~/pages/help/[slug].vue',
|
|
30
|
+
children: [],
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
addContentPageRecursion(pages[0].children, length - 1)
|
|
34
|
+
}
|
|
File without changes
|
|
File without changes
|