From b4c148a655ab0193ac68728dbacb3452c0d45933 Mon Sep 17 00:00:00 2001 From: naskya Date: Mon, 12 Feb 2024 23:31:04 +0900 Subject: [PATCH] dev: build backend-rs and firefish-js first these packages are imported in other places --- package.json | 6 +++--- scripts/build-greet.sh | 11 ----------- scripts/build.mjs | 35 +++++++++++++++++++++++++++++++++++ scripts/dev-build.mjs | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 14 deletions(-) delete mode 100755 scripts/build-greet.sh create mode 100644 scripts/build.mjs create mode 100644 scripts/dev-build.mjs diff --git a/package.json b/package.json index d757d7f6ef..77be90d525 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "private": true, "scripts": { "rebuild": "pnpm run clean && pnpm run build", - "build": "./scripts/build-greet.sh && pnpm --filter firefish-js run build && pnpm --filter !firefish-js -r --parallel run build && pnpm run gulp", + "build": "pnpm node ./scripts/build.mjs && pnpm run gulp", "start": "pnpm --filter backend run start", "start:test": "pnpm --filter backend run start:test", "init": "pnpm run migrate", @@ -24,8 +24,8 @@ "dev:init": "pnpm run dev:down && pnpm run dev:up", "dev:staging": "NODE_OPTIONS=--max_old_space_size=3072 NODE_ENV=development pnpm run build && pnpm run start", "lint": "pnpm -r --parallel run lint", - "debug": "pnpm run clean && pnpm run build:debug && pnpm run start", - "build:debug": "pnpm -r --parallel run build:debug && pnpm run gulp", + "debug": "pnpm run build:debug && pnpm run start", + "build:debug": "pnpm run clean && pnpm node ./scripts/dev-build.mjs && pnpm run gulp", "mocha": "pnpm --filter backend run mocha", "test": "pnpm run mocha", "format": "pnpm -r --parallel run format", diff --git a/scripts/build-greet.sh b/scripts/build-greet.sh deleted file mode 100755 index c0f43eee9c..0000000000 --- a/scripts/build-greet.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -echo -e "\e[49;38;2;49;116;143m" -echo -e "██████╗ ██╗██████╗ ███████╗███████╗██╗███████╗██╗ ██╗ ○ ▄ ▄ " -echo -e "██╔════╝██║██╔══██╗██╔════╝██╔════╝██║██╔════╝██║ ██║ ⚬ █▄▄ █▄▄" -echo -e "█████╗ ██║██████╔╝█████╗ █████╗ ██║███████╗███████║ ▄▄▄▄▄▄ ▄ " -echo -e "██╔══╝ ██║██╔══██╗██╔══╝ ██╔══╝ ██║╚════██║██╔══██║ █ █ █▄▄" -echo -e "██║ ██║██║ ██║███████╗██║ ██║███████║██║ ██║ █ ● ● █ " -echo -e "╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ▀▄▄▄▄▄▄▀\e[0m\n" -echo -e "\e[1;34mCurrently building Firefish!\e[0m" -echo -e "\e[1;38;2;255;136;0mThis may take a while...\e[0m\n" diff --git a/scripts/build.mjs b/scripts/build.mjs new file mode 100644 index 0000000000..7a4b3daa81 --- /dev/null +++ b/scripts/build.mjs @@ -0,0 +1,35 @@ +import path, { join } from "node:path"; +import { fileURLToPath } from "node:url"; +import { execa } from "execa"; + +(async () => { + const __dirname = path.dirname(fileURLToPath(import.meta.url)); + + await execa( + "pnpm", [ + "--recursive", + "--parallel", + "--filter=backend-rs", + "--filter=firefish-js", + "run", + "build", + ], { + cwd: join(__dirname, "/../"), + stdio: "inherit", + } + ); + + await execa( + "pnpm", [ + "--recursive", + "--parallel", + "--filter=!backend-rs", + "--filter=!firefish-js", + "run", + "build", + ], { + cwd: join(__dirname, "/../"), + stdio: "inherit", + } + ); +})(); diff --git a/scripts/dev-build.mjs b/scripts/dev-build.mjs new file mode 100644 index 0000000000..5e8805a200 --- /dev/null +++ b/scripts/dev-build.mjs @@ -0,0 +1,35 @@ +import path, { join } from "node:path"; +import { fileURLToPath } from "node:url"; +import { execa } from "execa"; + +(async () => { + const __dirname = path.dirname(fileURLToPath(import.meta.url)); + + await execa( + "pnpm", [ + "--recursive", + "--parallel", + "--filter=backend-rs", + "--filter=firefish-js", + "run", + "build:debug", + ], { + cwd: join(__dirname, "/../"), + stdio: "inherit", + } + ); + + await execa( + "pnpm", [ + "--recursive", + "--parallel", + "--filter=!backend-rs", + "--filter=!firefish-js", + "run", + "build:debug", + ], { + cwd: join(__dirname, "/../"), + stdio: "inherit", + } + ); +})();