-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
20 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* @Blog: https://hotaru.icu | ||
* @Date: 2023-06-24 15:12:55 | ||
* @LastEditors: Hotaru [email protected] | ||
* @LastEditTime: 2024-08-09 18:33:51 | ||
* @LastEditTime: 2024-08-11 13:58:37 | ||
*/ | ||
// import '@kotori-bot/core/src/utils/internal' | ||
import { | ||
|
@@ -408,10 +408,8 @@ export class Loader extends Core { | |
throw new DevError(`illegal package.json ${pkgPath}`) | ||
} | ||
|
||
const main = path.resolve( | ||
dir, | ||
this.isDev && fs.existsSync(path.join(dir, 'src/index.ts')) ? 'src/index.ts' : pkg.main | ||
) | ||
const loadTs = this.isDev && fs.existsSync(path.join(dir, 'src/index.ts')) | ||
const main = path.resolve(dir, loadTs ? 'src/index.ts' : pkg.main) | ||
if (!fs.existsSync(main)) throw new DevError(`cannot find main file ${main}`) | ||
|
||
const getDirFiles = (rootDir: string) => { | ||
|
@@ -430,7 +428,7 @@ export class Loader extends Core { | |
return list | ||
} | ||
|
||
const files = getDirFiles(path.join(dir, this.isDev ? 'src' : path.parse(pkg.main).dir)) | ||
const files = getDirFiles(path.join(dir, loadTs ? 'src' : path.parse(pkg.main).dir)) | ||
|
||
const [pkgScope, pkgName] = pkg.name.split('/') | ||
const pluginName = `${pkgScope.startsWith('@') && pkgScope !== '@kotori-bot' ? `${pkgScope.slice(1)}/` : ''}${(pkgName ?? pkgScope).replace(PLUGIN_PREFIX, '')}` | ||
|