Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MliKiowa committed May 3, 2024
1 parent fb42729 commit dc34c4d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 45 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
strategy:
fail-fast: false
matrix:
target_platform: [linux,darwin]
target_platform: [linux]
target_arch: [x64, arm64]
steps:
- name: Clone Main Repository
Expand All @@ -53,6 +53,8 @@ jobs:

- name: Build NuCat Linux
run: |
export NAPCAT_BUILDSYS=${{ matrix.target_platform }}
export NAPCAT_BUILDARCH=${{ matrix.target_arch }}
npm i --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }}
npm run build:prod
cd dist
Expand Down Expand Up @@ -87,6 +89,8 @@ jobs:

- name: Build NuCat Linux
run: |
export NAPCAT_BUILDSYS=${{ matrix.target_platform }}
export NAPCAT_BUILDARCH=${{ matrix.target_arch }}
npm i --arch=${{ matrix.target_arch }} --platform=${{ matrix.target_platform }}
npm run build:prod
cd dist
Expand Down
75 changes: 31 additions & 44 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,55 +20,42 @@ const nodeModules = [...builtinModules, builtinModules.map(m => `node:${m}`)].fl
function genCpModule(module: string) {
return { src: `./node_modules/${module}`, dest: `dist/node_modules/${module}`, flatten: false };
}
const systemPlatform = os.platform();
let startScripts: string[] | undefined = undefined;
let baseConfigPlugin: PluginOption[] | undefined = undefined;
if (systemPlatform == "linux") {
let MoeHooModule: any = [];
if (process.env.NAPCAT_BUILDSYS == "linux") {
if (process.env.NAPCAT_BUILDARCH == "x64") {
MoeHooModule = [{ src: './src/core.lib/MoeHoo-linux-x64.node', dest: 'dist' }];
}
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 if (process.env.NAPCAT_BUILDSYS == "win32") {
if (process.env.NAPCAT_BUILDARCH == "x64") {
MoeHooModule = [{ src: './src/core.lib/MoeHoo-win32-x64.node', dest: 'dist' }];
}
startScripts = ['./script/napcat.ps1', './script/napcat.bat', './script/napcat-utf8.bat', './script/napcat-utf8.ps1', './script/napcat-log.ps1'];
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-win32-x64.node', dest: 'dist' },
...(startScripts.map((startScript) => {
return { src: startScript, dest: 'dist' };
})),
]
}),
nodeResolve(),
commonjs(),
];

} else {
MoeHooModule = [{ src: './src/core.lib/MoeHoo-win32-x64.node', dest: 'dist' }, { src: './src/core.lib/MoeHoo-linux-x64.node', dest: 'dist' }];
startScripts = ['./script/napcat.sh', './script/napcat.ps1', './script/napcat.bat', './script/napcat-utf8.bat', './script/napcat-utf8.ps1', './script/napcat-log.ps1'];
}


let baseConfigPlugin: PluginOption[] = [
// 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' },
...MoeHooModule,
...(startScripts.map((startScript) => {
return { src: startScript, dest: 'dist' };
})),
]
}),
nodeResolve(),
commonjs(),
];
// if (os.platform() !== 'win32') {
// startScripts = ['./script/napcat.sh'];
// }
Expand Down

0 comments on commit dc34c4d

Please sign in to comment.