This commit is contained in:
手瓜一十雪
2024-05-03 21:03:13 +08:00
parent e5144f08cd
commit b06989216a

View File

@@ -22,18 +22,31 @@ function genCpModule(module: string) {
} }
const systemPlatform = os.platform(); const systemPlatform = os.platform();
let startScripts: string[] | undefined = undefined; let startScripts: string[] | undefined = undefined;
let baseConfigPlugin: PluginOption[] | undefined = undefined;
if (systemPlatform == "linux") { if (systemPlatform == "linux") {
startScripts = ['./script/napcat.sh']; startScripts = ['./script/napcat.sh'];
baseConfigPlugin = [
// PreprocessorDirectives(),
cp({
targets: [
// ...external.map(genCpModule),
{ src: './src/napcat.json', dest: 'dist/config/' },
{ src: './src/onebot11/onebot11.json', dest: 'dist/config/' },
{ src: './package.json', dest: 'dist' },
{ src: './README.md', dest: 'dist' },
{ src: './logo.png', dest: 'dist/logs' },
{ src: './src/core.lib/MoeHoo-linux-x64.node', dest: 'dist' },
...(startScripts.map((startScript) => {
return { src: startScript, dest: 'dist' };
})),
]
}),
nodeResolve(),
commonjs(),
];
} else { } else {
startScripts = ['./script/napcat.ps1', './script/napcat.bat', './script/napcat-utf8.bat', './script/napcat-utf8.ps1', './script/napcat-log.ps1']; startScripts = ['./script/napcat.ps1', './script/napcat.bat', './script/napcat-utf8.bat', './script/napcat-utf8.ps1', './script/napcat-log.ps1'];
} baseConfigPlugin = [
// if (os.platform() !== 'win32') {
// startScripts = ['./script/napcat.sh'];
// }
const baseConfigPlugin: PluginOption[] = [
// PreprocessorDirectives(), // PreprocessorDirectives(),
cp({ cp({
targets: [ targets: [
@@ -44,7 +57,6 @@ const baseConfigPlugin: PluginOption[] = [
{ src: './README.md', dest: 'dist' }, { src: './README.md', dest: 'dist' },
{ src: './logo.png', dest: 'dist/logs' }, { src: './logo.png', dest: 'dist/logs' },
{ src: './src/core.lib/MoeHoo-win32-x64.node', dest: 'dist' }, { src: './src/core.lib/MoeHoo-win32-x64.node', dest: 'dist' },
{ src: './src/core.lib/MoeHoo-linux-x64.node', dest: 'dist' },
...(startScripts.map((startScript) => { ...(startScripts.map((startScript) => {
return { src: startScript, dest: 'dist' }; return { src: startScript, dest: 'dist' };
})), })),
@@ -54,6 +66,15 @@ const baseConfigPlugin: PluginOption[] = [
commonjs(), commonjs(),
]; ];
}
// if (os.platform() !== 'win32') {
// startScripts = ['./script/napcat.sh'];
// }
let corePath = resolve(__dirname, './src/core/src'); let corePath = resolve(__dirname, './src/core/src');
if (!fs.existsSync(corePath)) { if (!fs.existsSync(corePath)) {
corePath = resolve(__dirname, './src/core.lib/src'); corePath = resolve(__dirname, './src/core.lib/src');