build: liteloader

Co-Authored-By: Wesley F. Young <25684570+Wesley-Young@users.noreply.github.com>
This commit is contained in:
手瓜一十雪 2024-08-08 20:57:10 +08:00
parent b39cbffe14
commit 3c4cd3743f
4 changed files with 67 additions and 9 deletions

View File

@ -1 +1,2 @@
VITE_BUILD_TYPE = Development
VITE_BUILD_TYPE = Production
VITE_BUILD_PLATFORM = LiteLoader

View File

@ -1 +1,2 @@
VITE_BUILD_TYPE = Production
VITE_BUILD_PLATFORM = Shell

33
manifest.json Normal file
View File

@ -0,0 +1,33 @@
{
"manifest_version": 4,
"type": "extension",
"name": "NapCat",
"slug": "NapCat",
"description": "OneBot v11 protocol implementation with NapCat logic",
"version": "1.8.4",
"icon": "./logo.png",
"authors": [
{
"name": "MliKiowa",
"link": "https://github.com/MliKiowa"
},
{
"name": "Young",
"link": "https://github.com/Wesley-Young"
}
],
"repository": {
"repo": "NapNeko/NapCatQQ",
"branch": "main"
},
"platform": [
"win32",
"linux",
"darwin"
],
"injects": {
"renderer": "./renderer.cjs",
"main": "./napcat.cjs",
"preload": "./preload.cjs"
}
}

View File

@ -28,8 +28,33 @@ if (process.env.NAPCAT_BUILDSYS == 'linux') {
} else {
startScripts = ['./script/BootWay05.bat', './script/BootWay05.utf8.bat', './script/dbghelp.dll', './script/BootWay05.ps1', './script/napcat.sh', './script/napcat.ps1', './script/napcat.bat', './script/napcat-utf8.bat', './script/napcat-utf8.ps1', './script/napcat-log.ps1', './script/napcat-9912.ps1', './script/napcat-9912-utf8.ps1', './script/napcat-9912.bat', './script/napcat-9912-utf8.bat'];
}
const baseConfigPlugin: PluginOption[] = [
const LLBaseConfigPlugin: PluginOption[] = [
// PreprocessorDirectives(),
babel({
filter: /.*\.(ts|js)$/,
babelConfig: {
babelrc: false,
configFile: false,
presets: ["@babel/preset-typescript"],
plugins: [
//'2018-09', decoratorsBeforeExport: true
['@babel/plugin-proposal-decorators', { legacy: true }],
'@babel/plugin-proposal-class-properties',
],
},
}),
cp({
targets: [
{ src: './manifest.json', dest: 'dist' },
{ src: './src/liteloader/napcat.cjs', dest: 'dist' },
{ src: './src/liteloader/preload.cjs', dest: 'dist' },
{ src: './src/liteloader/renderer.cjs', dest: 'dist' },
{ src: './logo.png', dest: 'dist' },
]
}),
nodeResolve(),
];
const ShellBaseConfigPlugin: PluginOption[] = [
// PreprocessorDirectives(),
babel({
filter: /.*\.(ts|js)$/,
@ -99,7 +124,7 @@ const LLBaseConfig = () => defineConfig({
target: 'esnext',
minify: false,
lib: {
entry: "src/liteloader/napcat.ts",
entry: "src/liteloader/napcat.ts",
formats: ['es'],
fileName: () => 'napcat.mjs',
},
@ -113,14 +138,12 @@ export default defineConfig(({ mode }): UserConfig => {
if (mode === 'shell') {
return {
...ShellBaseConfig(),
plugins: [
...baseConfigPlugin
]
plugins: [...ShellBaseConfigPlugin]
};
} else {
return {
...LLBaseConfig(),
plugins: baseConfigPlugin,
plugins: [...LLBaseConfigPlugin],
};
}
});