代码拉取完成,页面将自动刷新
同步操作将从 Gitee 极速下载/Pake 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import path from 'path';
import appRootPath from 'app-root-path';
import typescript from 'rollup-plugin-typescript2';
import alias from '@rollup/plugin-alias';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import replace from '@rollup/plugin-replace';
import chalk from 'chalk';
import { spawn, exec } from 'child_process';
const isProduction = process.env.NODE_ENV === 'production';
const devPlugins = !isProduction ? [pakeCliDevPlugin()] : [];
export default {
input: isProduction ? 'bin/cli.ts' : 'bin/dev.ts',
output: {
file: isProduction ? 'dist/cli.js' : 'dist/dev.js',
format: 'es',
sourcemap: !isProduction,
},
watch: {
include: 'bin/**',
exclude: 'node_modules/**',
},
plugins: [
json(),
typescript({
tsconfig: 'tsconfig.json',
clean: true, // Clear cache
}),
commonjs(),
replace({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
preventAssignment: true,
}),
alias({
entries: [{ find: '@', replacement: path.join(appRootPath.path, 'bin') }],
}),
...devPlugins,
],
};
function pakeCliDevPlugin() {
let devChildProcess;
let cliChildProcess;
let devHasStarted = false;
return {
name: 'pake-cli-dev-plugin',
buildEnd() {
const command = 'node';
const cliCmdArgs = ['./dist/dev.js'];
cliChildProcess = spawn(command, cliCmdArgs, { detached: true });
cliChildProcess.stdout.on('data', data => {
console.log(chalk.green(data.toString()));
});
cliChildProcess.stderr.on('data', data => {
console.error(chalk.yellow(data.toString()));
});
cliChildProcess.on('close', async code => {
console.log(chalk.yellow(`cli running end with code: ${code}`));
if (devHasStarted) return;
devHasStarted = true;
devChildProcess = await exec(
'npm run tauri dev -- --config ./src-tauri/.pake/tauri.conf.json --features cli-build',
);
devChildProcess.stdout.on('data', data => {
console.log(chalk.green(data.toString()));
});
devChildProcess.stderr.on('data', data => {
console.error(chalk.yellow(data.toString()));
});
devChildProcess.on('close', code => {
console.log(chalk.yellow(`dev running end: ${code}`));
process.exit(code);
});
});
},
};
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。