fix: make clean/dev commands work

This commit is contained in:
naskya 2023-11-06 10:30:00 +09:00
parent 712fab5b45
commit beca3eac55
Signed by: naskya
GPG key ID: 164DFF24E2D40139
4 changed files with 25 additions and 16 deletions

View file

@ -18,14 +18,14 @@
"migrateandstart": "pnpm run migrate && pnpm run start", "migrateandstart": "pnpm run migrate && pnpm run start",
"gulp": "gulp build", "gulp": "gulp build",
"watch": "pnpm run dev", "watch": "pnpm run dev",
"dev": "pnpm node ./scripts/dev.js", "dev": "pnpm node ./scripts/dev.mjs",
"dev:staging": "NODE_OPTIONS=--max_old_space_size=3072 NODE_ENV=development pnpm run build && pnpm run start", "dev:staging": "NODE_OPTIONS=--max_old_space_size=3072 NODE_ENV=development pnpm run build && pnpm run start",
"lint": "pnpm -r --parallel run lint", "lint": "pnpm -r --parallel run lint",
"debug": "pnpm run build:debug && pnpm run start", "debug": "pnpm run build:debug && pnpm run start",
"build:debug": "pnpm -r --parallel run build:debug && pnpm run gulp", "build:debug": "pnpm -r --parallel run build:debug && pnpm run gulp",
"format": "pnpm -r --parallel run format", "format": "pnpm -r --parallel run format",
"clean": "pnpm node ./scripts/clean.js", "clean": "pnpm node ./scripts/clean.mjs",
"clean-all": "pnpm node ./scripts/clean-all.js", "clean-all": "pnpm node ./scripts/clean-all.mjs",
"cleanall": "pnpm run clean-all" "cleanall": "pnpm run clean-all"
}, },
"resolutions": { "resolutions": {

View file

@ -1,8 +1,11 @@
const fs = require("node:fs"); import fs from "node:fs";
const execa = require("execa"); import path, { join } from "node:path";
const { join } = require("node:path"); import { fileURLToPath } from "node:url";
import { execa } from "execa";
(async () => { (async () => {
const __dirname = path.dirname(fileURLToPath(import.meta.url));
fs.rmSync(join(__dirname, "/../packages/backend/built"), { fs.rmSync(join(__dirname, "/../packages/backend/built"), {
recursive: true, recursive: true,
force: true, force: true,

View file

@ -1,8 +1,10 @@
const fs = require("node:fs"); import fs from "node:fs";
const execa = require("execa"); import path, { join } from "node:path";
const { join } = require("node:path"); import { fileURLToPath } from "node:url";
(async () => { (async () => {
const __dirname = path.dirname(fileURLToPath(import.meta.url));
fs.rmSync(join(__dirname, "/../packages/backend/built"), { fs.rmSync(join(__dirname, "/../packages/backend/built"), {
recursive: true, recursive: true,
force: true, force: true,

View file

@ -1,32 +1,36 @@
const execa = require("execa"); import path, { join } from "node:path";
import { fileURLToPath } from "node:url";
import { execa } from "execa";
(async () => { (async () => {
const __dirname = path.dirname(fileURLToPath(import.meta.url));
await execa("pnpm", ["clean"], { await execa("pnpm", ["clean"], {
cwd: __dirname + "/../", cwd: join(__dirname, "/../"),
stdout: process.stdout, stdout: process.stdout,
stderr: process.stderr, stderr: process.stderr,
}); });
execa("pnpm", ["dlx", "gulp", "watch"], { execa("pnpm", ["dlx", "gulp", "watch"], {
cwd: __dirname + "/../", cwd: join(__dirname, "/../"),
stdout: process.stdout, stdout: process.stdout,
stderr: process.stderr, stderr: process.stderr,
}); });
execa("pnpm", ["--filter", "backend", "watch"], { execa("pnpm", ["--filter", "backend", "watch"], {
cwd: __dirname + "/../", cwd: join(__dirname, "/../"),
stdout: process.stdout, stdout: process.stdout,
stderr: process.stderr, stderr: process.stderr,
}); });
execa("pnpm", ["--filter", "client", "watch"], { execa("pnpm", ["--filter", "client", "watch"], {
cwd: __dirname + "/../", cwd: join(__dirname, "/../"),
stdout: process.stdout, stdout: process.stdout,
stderr: process.stderr, stderr: process.stderr,
}); });
execa("pnpm", ["--filter", "sw", "watch"], { execa("pnpm", ["--filter", "sw", "watch"], {
cwd: __dirname + "/../", cwd: join(__dirname, "/../"),
stdout: process.stdout, stdout: process.stdout,
stderr: process.stderr, stderr: process.stderr,
}); });
@ -34,7 +38,7 @@ const execa = require("execa");
const start = async () => { const start = async () => {
try { try {
await execa("pnpm", ["start"], { await execa("pnpm", ["start"], {
cwd: __dirname + "/../", cwd: join(__dirname, "/../"),
stdout: process.stdout, stdout: process.stdout,
stderr: process.stderr, stderr: process.stderr,
}); });