node-karin 0.1.1 → 0.1.2
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/lib/core/dir.js +1 -1
- package/lib/core/plugin.loader.js +0 -1
- package/lib/tools/init.js +8 -2
- package/package.json +1 -1
package/lib/core/dir.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import path from 'path'
|
|
2
2
|
import { fileURLToPath } from 'url'
|
|
3
3
|
const filename = fileURLToPath(import.meta.url)
|
|
4
|
-
export const karinDir = path.resolve(filename, '
|
|
4
|
+
export const karinDir = path.resolve(filename, '../../../').replace(/\\/g, '/').replace(/\/$/, '')
|
package/lib/tools/init.js
CHANGED
|
@@ -14,8 +14,14 @@ function mkdir (dirname) {
|
|
|
14
14
|
const delList = ['./config/defSet', './config/view']
|
|
15
15
|
for (const dir of delList) {
|
|
16
16
|
if (fs.existsSync(dir)) { fs.rmdirSync(dir, { recursive: true }) }
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
mkdir(dir)
|
|
18
|
+
const root = `${karinDir}${dir.replace('.', '')}`
|
|
19
|
+
const files = fs.readdirSync(root).filter(file => file.endsWith('.yaml'))
|
|
20
|
+
for (const file of files) {
|
|
21
|
+
const path = `${dir}/${file}`
|
|
22
|
+
const pathDef = `${root}/${file}`
|
|
23
|
+
if (!fs.existsSync(path)) { fs.copyFileSync(pathDef, path) }
|
|
24
|
+
}
|
|
19
25
|
}
|
|
20
26
|
// 判断是否为第一次使用
|
|
21
27
|
if (!fs.existsSync('./index.js') && !fs.existsSync('./plugins')) {
|