Skip to content

Commit b394afb

Browse files
committed
Take advantage of pnpm monorepo tooling
1 parent 2e41324 commit b394afb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+249
-434
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ build
55
dist
66
*.log
77
**/*.js
8+
**/*.tsbuildinfo

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pnpm precommit
1+
pnpm lint-staged

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# See: https://github.com/pnpm/pnpm/issues/7158
2+
shared-workspace-lockfile=false

.vscode/settings.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
{
2-
}
1+
{}

bootstrap/esbuild.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ await esbuild.build({
8787
format: "cjs",
8888
outfile: "dist/index.js",
8989
packages: "bundle",
90-
external: ["./fancontrol"],
90+
external: ["./fancontrol/index.js"],
9191
plugins: [
9292
prebuildifyPlugin({
9393
prebuildifyTargets: "win32-x64",

bootstrap/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const sudoOptions = {
1414

1515
const openBrowser = () => {
1616
const start = process.platform === "win32" ? "start" : "open";
17-
require("child_process").exec(`${start} http://localhost:5522`);
17+
exec(`${start} http://localhost:5522`);
1818
};
1919

2020
const sudoOutputHandler: Parameters<(typeof sudo)["exec"]>[2] = (
@@ -148,7 +148,8 @@ switch (process.argv[2]) {
148148
process.chdir(__dirname);
149149
process.env.NODE_ENV = "production";
150150

151-
require("./fancontrol");
151+
// @ts-expect-error This is only available after bundling
152+
import("./fancontrol/index.js");
152153
break;
153154
default:
154155
console.error("If you can read this, either you or I did something wrong.");

bootstrap/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
"main": "index.ts",
55
"license": "MIT",
66
"scripts": {
7-
"build": "rimraf dist && pnpm tsx esbuild.mts",
7+
"build": "tsc --noEmit && rimraf dist && pnpm tsx esbuild.mts",
88
"build:esfirsttry": "esbuild index.ts --bundle --platform=node --target=node22 --external:*.node --outfile=dist/index.cjs",
99
"build:old": "rimraf dist && ncc build index.ts",
10-
"start": "tsx ."
10+
"start": "tsx .",
11+
"type-check": "tsc --noEmit"
1112
},
1213
"dependencies": {
1314
"@neuralegion/os-service": "^1.2.6",

bootstrap/tsconfig.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
{
2-
// ncc boundary
3-
"extends": "../tsconfig.json",
4-
"include": ["index.ts"]
2+
"extends": "../tsconfig.base.json"
53
}

build.bat

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,35 @@
1+
@echo off
12
rmdir /S /Q dist
23

3-
cd bootstrap
4-
call pnpm build
5-
cd ..\server
6-
call pnpm build
7-
cd ..\frontend
8-
call pnpm build
9-
cd ..
4+
call pnpm build || exit /b
105

11-
xcopy /I /E bootstrap\dist dist
12-
copy bootstrap\scripts\*.* dist
6+
xcopy /I /E bootstrap\dist dist || exit /b
7+
copy bootstrap\scripts\*.* dist || exit /b
138

14-
xcopy /I /E server\dist dist\fancontrol
15-
copy server\native\windows\*.dll dist\fancontrol
9+
xcopy /I /E server\dist dist\fancontrol || exit /b
10+
copy server\native\windows\*.dll dist\fancontrol || exit /b
1611

17-
xcopy /I /E frontend\build dist\fancontrol\frontend
12+
xcopy /I /E frontend\build dist\fancontrol\frontend || exit /b
1813

1914
@REM Remove excess versions of native dependencies
20-
cd dist\fancontrol\native\win32
21-
rmdir /S /Q arm64
22-
rmdir /S /Q ia32
23-
cd x64
24-
move 22 ..\
25-
for /d %%i in (*) do rd /s /q "%%i"
26-
move ..\22 .
27-
cd ..\..\..\..\..\
15+
cd dist\fancontrol\native\win32 || exit /b
16+
rmdir /S /Q arm64 || exit /b
17+
rmdir /S /Q ia32 || exit /b
18+
cd x64 || exit /b
19+
move 22 ..\ || exit /b
20+
for /d %%i in (*) do rd /s /q "%%i" || exit /b
21+
move ..\22 . || exit /b
22+
cd ..\..\..\..\..\ || exit /b
2823

2924
@REM Add default config and package.json
30-
copy alfc.config.json dist
31-
copy package.json dist
25+
copy alfc.config.json dist || exit /b
26+
copy package.json dist || exit /b
3227

33-
cd dist
34-
powershell Compress-Archive * alfc-without-node.zip
35-
move alfc-without-node.zip ..\alfc-without-node.zip
36-
curl -L --output node.exe https://nodejs.org/dist/v22.11.0/win-x64/node.exe
37-
powershell Compress-Archive * alfc.zip
38-
move ..\alfc-without-node.zip alfc-without-node.zip
28+
cd dist || exit /b
29+
powershell Compress-Archive * alfc-without-node.zip || exit /b
30+
move alfc-without-node.zip ..\alfc-without-node.zip || exit /b
31+
curl -L --output node.exe https://nodejs.org/dist/v22.11.0/win-x64/node.exe || exit /b
32+
powershell Compress-Archive * alfc.zip || exit /b
33+
move ..\alfc-without-node.zip alfc-without-node.zip || exit /b
3934

40-
cd ..
35+
cd .. || exit /b

common/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "../tsconfig.base.json",
3+
}

0 commit comments

Comments
 (0)