Skip to content

Commit 8218fab

Browse files
authored
fix: one-command dev & web env files (#1214)
- fixes `pnpm dev` - fixes `just setup` - Prevents env pollution in nuxt dev/build
1 parent d8b8339 commit 8218fab

File tree

11 files changed

+42
-31
lines changed

11 files changed

+42
-31
lines changed

api/justfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ default:
44
@just --list --justfile {{justfile()}} --list-heading $'\nAPI project recipes:\n'
55
@just list-commands
66

7-
setup:
8-
pnpm install
9-
pnpm run container:build
10-
117
# builds js files that can run on an unraid server
128
@build:
139
pnpm run build

api/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717
"start": "node dist/main.js",
1818
"dev": "vite",
1919
"command": "pnpm run build && clear && ./dist/cli.js",
20-
"// Build": "",
20+
"// Build and Deploy": "",
2121
"build": "vite build --mode=production",
2222
"postbuild": "chmod +x dist/main.js && chmod +x dist/cli.js",
2323
"build:docker": "./scripts/dc.sh run --rm builder",
2424
"build-and-pack": "tsx ./scripts/build.ts",
25+
"preunraid:deploy": "pnpm build",
26+
"unraid:deploy": "./scripts/deploy-dev.sh",
2527
"// GraphQL Codegen": "",
2628
"codegen": "MOTHERSHIP_GRAPHQL_LINK='https://staging.mothership.unraid.net/ws' graphql-codegen --config codegen.ts -r dotenv/config './.env.staging'",
2729
"codegen:watch": "DOTENV_CONFIG_PATH='./.env.staging' graphql-codegen --config codegen.ts --watch -r dotenv/config",

justfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ setup:
1212
@just ignore .vscode/settings.json api/.vscode/settings.json web/.vscode/settings.json
1313
# ignore api local-state files
1414
@just ignore api/dev/states/myservers.cfg api/dev/Unraid.net/myservers.cfg
15-
16-
just api/setup
17-
just web/setup
15+
16+
pnpm install
17+
just unraid-ui/setup
1818

1919
# restore notification files under api/dev
2020
restore-notifications:

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"scripts": {
66
"build": "pnpm -r build",
77
"dev": "pnpm -r dev",
8+
"unraid:deploy": "pnpm -r unraid:deploy",
89
"test": "pnpm -r test",
910
"lint": "pnpm -r lint",
1011
"lint:fix": "pnpm -r lint:fix",

readme.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ Make sure the following software is installed before proceeding.
9696
* Docker (for macOS folks, Orbstack works too)
9797
* [Node.js (v20)][Node-url]
9898
* [Just](https://github.com/casey/just)
99+
* libvirt (macOS folks can run `brew install libvirt`)
99100
* An [Unraid][Unraid-url] server for development
100101

101102
Next, create an SSH key if you haven't already.
@@ -123,27 +124,28 @@ Once you have your key pair, add your public SSH key to your Unraid server:
123124
```
124125

125126
This will run installation scripts, container builds, and some git scripts to reduce noise (i.e. personal editor customizations, etc).
126-
3. Run the API container
127+
128+
Alternatively, run `pnpm install` for a lighter, less opinionated setup.
129+
3. Run dev servers
127130

128131
```sh
129-
cd api
130-
npm run container:start
132+
pnpm dev
131133
```
132134

133-
4. This should bring you inside the API container. There, run the following command to start the server:
135+
This will run every dev server in the monorepo. By default, this means:
134136

135-
```js
136-
npm run dev
137-
```
137+
* The unraid-api will be available at localhost:3001
138+
* The dev server for "rich" web components (like the User Profile Component) will be at localhost:4321 -- Note that shipping to unraid is preferred, as the dev environment is significantly different.
139+
* The vite server for unraid-ui development will be at localhost:5173
138140

139-
5. In another terminal, open the project and navigate to the web directory. Then, run the dev server:
141+
4. Test on Unraid
140142

141-
```sh
142-
cd web
143-
npm install # just in case
144-
npm run dev
143+
```js
144+
pnpm unraid:deploy <SERVER_IP>
145145
```
146146

147+
This will ship a staging build of unraid-api, unraid-ui, and unraid-components to an Unraid server located at `<SERVER_IP>`.
148+
147149
<p align="right">(<a href="#readme-top">back to top</a>)</p>
148150

149151
<!-- USAGE EXAMPLES -->

unraid-ui/justfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ list-commands:
55

66
# Prepares the repo for development
77
setup:
8-
pnpm install
98
pnpm run build
109

1110
clean:

unraid-ui/package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,22 @@
1313
"tailwind.config.ts"
1414
],
1515
"scripts": {
16+
"// Development": "",
1617
"dev": "vite",
17-
"build": "vite build",
18-
"build:wc": "REM_PLUGIN=true vite build -c vite.web-component.ts --mode production",
1918
"preview": "vite preview",
2019
"test": "vitest",
2120
"test:ui": "vitest --ui",
2221
"coverage": "vitest run --coverage",
23-
"clean": "rm -rf dist",
22+
"// Build": "",
2423
"prebuild": "npm run clean",
24+
"build": "vite build",
25+
"build:wc": "REM_PLUGIN=true vite build -c vite.web-component.ts --mode production",
26+
"clean": "rm -rf dist",
2527
"typecheck": "vue-tsc --noEmit",
28+
"// Deploy to Unraid Server": "",
29+
"preunraid:deploy": "pnpm build:wc",
30+
"unraid:deploy": "just deploy",
31+
"// Storybook": "",
2632
"storybook": "storybook dev -p 6006",
2733
"build-storybook": "storybook build"
2834
},

web/.env.production

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
VITE_ACCOUNT=https://account.unraid.net
2+
VITE_CONNECT=https://connect.myunraid.net
3+
VITE_UNRAID_NET=https://unraid.net
4+
VITE_CALLBACK_KEY=Uyv2o8e*FiQe8VeLekTqyX6Z*8XonB
5+
# Keep console logs until components are stabilized
6+
VITE_ALLOW_CONSOLE_LOGS=true

web/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
!.env.staging
1+
!.env.staging
2+
!.env.production

web/justfile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ default:
44
@just --list --justfile {{justfile()}} --list-heading $'\nWeb project recipes:\n'
55
@just list-commands
66

7-
setup:
8-
just ../unraid-ui/setup
9-
cp .env.example .env
10-
npm install
11-
127
clean:
138
rm -rf .nuxt
149
rm -rf node_modules

0 commit comments

Comments
 (0)