bfg-common 1.0.93 → 1.0.94

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