node-karin 0.6.25 → 0.6.26
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/plugin.loader.js +1 -1
- package/lib/utils/common.js +14 -7
- package/package.json +1 -1
|
@@ -256,7 +256,7 @@ class PluginLoader {
|
|
|
256
256
|
async createdApp (dir, name, isOrderBy = false, isNpm = false) {
|
|
257
257
|
try {
|
|
258
258
|
const list = []
|
|
259
|
-
let path = `${this.dirPath}${isNpm ? 'node_modules
|
|
259
|
+
let path = `${this.dirPath}${isNpm ? 'node_modules' : 'plugins'}/${dir}/${name}`
|
|
260
260
|
if (isOrderBy) { path = path + `?${Date.now()}` }
|
|
261
261
|
const tmp = await import(path)
|
|
262
262
|
lodash.forEach(tmp, (App) => {
|
package/lib/utils/common.js
CHANGED
|
@@ -413,14 +413,21 @@ export const common = new (class Common {
|
|
|
413
413
|
try {
|
|
414
414
|
const pkgPath = path.join(process.cwd(), 'node_modules', name, 'package.json')
|
|
415
415
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'))
|
|
416
|
-
if (pkg?.karin
|
|
417
|
-
pkg
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
416
|
+
if (pkg?.karin) {
|
|
417
|
+
if (pkg?.main) {
|
|
418
|
+
const dir = `${name}/${path.dirname(pkg.main).replace(/\.\//, '')}`
|
|
419
|
+
list.push({ dir, name: path.basename(pkg.main) })
|
|
420
|
+
}
|
|
421
|
+
if (pkg?.karin?.apps?.length) {
|
|
422
|
+
pkg.karin.apps.forEach((app) => {
|
|
423
|
+
fs.readdirSync(`./node_modules/${name}/${app}`).forEach((name) => {
|
|
424
|
+
/** 忽略非js */
|
|
425
|
+
if (!name.endsWith('.js')) { return }
|
|
426
|
+
const dir = `${name}/${app}`
|
|
427
|
+
list.push({ dir, name })
|
|
428
|
+
})
|
|
422
429
|
})
|
|
423
|
-
}
|
|
430
|
+
}
|
|
424
431
|
}
|
|
425
432
|
} catch { }
|
|
426
433
|
}
|