bfg-common 1.0.88 → 1.0.89
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/modules/fixContentBuild/index.ts +101 -100
- package/package.json +1 -1
|
@@ -8,109 +8,110 @@ import {
|
|
|
8
8
|
updateImagesPath,
|
|
9
9
|
} from './utils/methods'
|
|
10
10
|
|
|
11
|
-
export default defineNuxtModule({
|
|
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
|
-
// export default defineNuxtModule(() => {
|
|
68
|
-
// if (
|
|
69
|
-
// process.env.NODE_ENV === 'development' ||
|
|
70
|
-
// process.env.npm_command !== 'exec'
|
|
71
|
-
// )
|
|
72
|
-
// 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
|
|
73
22
|
//
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
-
//
|
|
81
|
-
//
|
|
82
|
-
//
|
|
83
|
-
//
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
//
|
|
89
|
-
//
|
|
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
|
|
90
39
|
//
|
|
91
|
-
//
|
|
92
|
-
//
|
|
93
|
-
//
|
|
94
|
-
//
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
//
|
|
40
|
+
// // Переносим весь контент и удаляем все файлы кроме картинок
|
|
41
|
+
// const contentPath = path.join(
|
|
42
|
+
// __dirname.replace('/modules/fixContentBuild', ''),
|
|
43
|
+
// 'content',
|
|
44
|
+
// 'help'
|
|
45
|
+
// )
|
|
46
|
+
// if (!fs.existsSync(contentPath)) return;
|
|
98
47
|
//
|
|
99
|
-
//
|
|
100
|
-
//
|
|
101
|
-
//
|
|
102
|
-
//
|
|
103
|
-
//
|
|
104
|
-
//
|
|
105
|
-
//
|
|
106
|
-
//
|
|
107
|
-
//
|
|
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)
|
|
108
57
|
//
|
|
109
|
-
//
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
//
|
|
58
|
+
// // Удаляем картинки из папки content
|
|
59
|
+
// removeImagesFromContent(contentPath)
|
|
60
|
+
// })
|
|
61
|
+
// // End block
|
|
113
62
|
//
|
|
114
|
-
//
|
|
115
|
-
//
|
|
63
|
+
// // Правим путь к картинкам
|
|
64
|
+
// updateImagesPath(contentPath)
|
|
65
|
+
// }
|
|
116
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
|
|
74
|
+
|
|
75
|
+
// Правим путь к файлу
|
|
76
|
+
const filePath = path.join(
|
|
77
|
+
__dirname.replace('/modules/fixContentBuild', ''),
|
|
78
|
+
'node_modules',
|
|
79
|
+
'@nuxt',
|
|
80
|
+
'content',
|
|
81
|
+
'dist',
|
|
82
|
+
'runtime',
|
|
83
|
+
'legacy',
|
|
84
|
+
'composables',
|
|
85
|
+
'query.mjs'
|
|
86
|
+
)
|
|
87
|
+
const searchString = '/query/${hash(params)}'
|
|
88
|
+
const replacementString = 'cache'
|
|
89
|
+
replaceFileContent(filePath, searchString, replacementString)
|
|
90
|
+
// End block
|
|
91
|
+
|
|
92
|
+
// Переносим весь контент и удаляем все файлы кроме картинок
|
|
93
|
+
const contentPath = path.join(
|
|
94
|
+
__dirname.replace('/modules/fixContentBuild', ''),
|
|
95
|
+
'content',
|
|
96
|
+
'help'
|
|
97
|
+
)
|
|
98
|
+
if (!fs.existsSync(contentPath)) return;
|
|
99
|
+
|
|
100
|
+
const publicPath = path.join(
|
|
101
|
+
__dirname.replace('/modules/fixContentBuild', ''),
|
|
102
|
+
'public',
|
|
103
|
+
'help',
|
|
104
|
+
'images'
|
|
105
|
+
)
|
|
106
|
+
fs.cp(contentPath, publicPath, { recursive: true }, () => {
|
|
107
|
+
// Удаляем все файлы кроме картинок
|
|
108
|
+
removeNonImageFiles(publicPath)
|
|
109
|
+
|
|
110
|
+
// Удаляем картинки из папки content
|
|
111
|
+
removeImagesFromContent(contentPath)
|
|
112
|
+
})
|
|
113
|
+
// End block
|
|
114
|
+
|
|
115
|
+
// Правим путь к картинкам
|
|
116
|
+
updateImagesPath(contentPath)
|
|
117
|
+
})
|