🔧 Global formatting and update formatting
This commit is contained in:
56
rollup.config.js
vendored
56
rollup.config.js
vendored
@@ -1,40 +1,40 @@
|
||||
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';
|
||||
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 isProduction = process.env.NODE_ENV === "production";
|
||||
const devPlugins = !isProduction ? [pakeCliDevPlugin()] : [];
|
||||
|
||||
export default {
|
||||
input: isProduction ? 'bin/cli.ts' : 'bin/dev.ts',
|
||||
input: isProduction ? "bin/cli.ts" : "bin/dev.ts",
|
||||
output: {
|
||||
file: isProduction ? 'dist/cli.js' : 'dist/dev.js',
|
||||
format: 'es',
|
||||
file: isProduction ? "dist/cli.js" : "dist/dev.js",
|
||||
format: "es",
|
||||
sourcemap: !isProduction,
|
||||
},
|
||||
watch: {
|
||||
include: 'bin/**',
|
||||
exclude: 'node_modules/**',
|
||||
include: "bin/**",
|
||||
exclude: "node_modules/**",
|
||||
},
|
||||
plugins: [
|
||||
json(),
|
||||
typescript({
|
||||
tsconfig: 'tsconfig.json',
|
||||
tsconfig: "tsconfig.json",
|
||||
clean: true, // Clear cache
|
||||
}),
|
||||
commonjs(),
|
||||
replace({
|
||||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
|
||||
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
|
||||
preventAssignment: true,
|
||||
}),
|
||||
alias({
|
||||
entries: [{ find: '@', replacement: path.join(appRootPath.path, 'bin') }],
|
||||
entries: [{ find: "@", replacement: path.join(appRootPath.path, "bin") }],
|
||||
}),
|
||||
...devPlugins,
|
||||
],
|
||||
@@ -47,38 +47,38 @@ function pakeCliDevPlugin() {
|
||||
let devHasStarted = false;
|
||||
|
||||
return {
|
||||
name: 'pake-cli-dev-plugin',
|
||||
name: "pake-cli-dev-plugin",
|
||||
buildEnd() {
|
||||
const command = 'node';
|
||||
const cliCmdArgs = ['./dist/dev.js'];
|
||||
const command = "node";
|
||||
const cliCmdArgs = ["./dist/dev.js"];
|
||||
|
||||
cliChildProcess = spawn(command, cliCmdArgs, { detached: true });
|
||||
|
||||
cliChildProcess.stdout.on('data', data => {
|
||||
cliChildProcess.stdout.on("data", (data) => {
|
||||
console.log(chalk.green(data.toString()));
|
||||
});
|
||||
|
||||
cliChildProcess.stderr.on('data', data => {
|
||||
cliChildProcess.stderr.on("data", (data) => {
|
||||
console.error(chalk.yellow(data.toString()));
|
||||
});
|
||||
|
||||
cliChildProcess.on('close', async code => {
|
||||
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',
|
||||
"npm run tauri dev -- --config ./src-tauri/.pake/tauri.conf.json --features cli-build",
|
||||
);
|
||||
|
||||
devChildProcess.stdout.on('data', data => {
|
||||
devChildProcess.stdout.on("data", (data) => {
|
||||
console.log(chalk.green(data.toString()));
|
||||
});
|
||||
|
||||
devChildProcess.stderr.on('data', data => {
|
||||
devChildProcess.stderr.on("data", (data) => {
|
||||
console.error(chalk.yellow(data.toString()));
|
||||
});
|
||||
|
||||
devChildProcess.on('close', code => {
|
||||
devChildProcess.on("close", (code) => {
|
||||
console.log(chalk.yellow(`dev running end: ${code}`));
|
||||
process.exit(code);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user