Skip to content

Commit f95e0a9

Browse files
authored
chore: improve dx for scripting & setup (#969)
* chore: rm vs code visual customizations * chore(api): fix vscode eslint extension * chore(web): update env.example for local development * chore: add justfiles to simplify workflows * chore: stub monorepo readme * chore: add nvmrc to monorepo root * refactor: improve error handling in `just ignore` * doc(web): explain TAILWIND_BASE_FONT_SIZE in .env.example * chore: add logo to readme
1 parent 0d65e12 commit f95e0a9

File tree

9 files changed

+319
-21
lines changed

9 files changed

+319
-21
lines changed

.github/unraid.svg

Lines changed: 1 addition & 0 deletions
Loading

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20

.vscode/settings.json

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,6 @@
66
"source.fixAll": "never",
77
"source.fixAll.eslint": "explicit"
88
},
9-
"workbench.colorCustomizations": {
10-
"activityBar.activeBackground": "#78797d",
11-
"activityBar.background": "#78797d",
12-
"activityBar.foreground": "#e7e7e7",
13-
"activityBar.inactiveForeground": "#e7e7e799",
14-
"activityBarBadge.background": "#df9fac",
15-
"activityBarBadge.foreground": "#15202b",
16-
"commandCenter.border": "#e7e7e799",
17-
"sash.hoverBorder": "#78797d",
18-
"statusBar.background": "#5f6063",
19-
"statusBar.foreground": "#e7e7e7",
20-
"statusBarItem.hoverBackground": "#78797d",
21-
"statusBarItem.remoteBackground": "#5f6063",
22-
"statusBarItem.remoteForeground": "#e7e7e7",
23-
"titleBar.activeBackground": "#5f6063",
24-
"titleBar.activeForeground": "#e7e7e7",
25-
"titleBar.inactiveBackground": "#5f606399",
26-
"titleBar.inactiveForeground": "#e7e7e799"
27-
},
28-
"peacock.color": "#5f6063",
299
"i18n-ally.localesPaths": [
3010
"locales"
3111
],

api/.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"eslint.lintTask.options": "--flag unstable_ts_config",
3+
"eslint.options": {
4+
"flags": ["unstable_ts_config"],
5+
"overrideConfigFile": ".eslintrc.ts"
6+
}
7+
}

api/justfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
set fallback
2+
3+
default:
4+
@just --list --justfile {{justfile()}} --list-heading $'\nAPI project recipes:\n'
5+
@just list-commands
6+
7+
setup:
8+
npm install
9+
npm run container:build

justfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# The first recipe in a justfile is considered the default recipe,
2+
# which means it runs when `just` is called with no arguments
3+
4+
default: list-commands
5+
6+
list-commands:
7+
@just --list --justfile {{justfile()}} --list-heading $'\nMonorepo recipes:\n'
8+
9+
# Prepares the repo for development
10+
setup:
11+
# ignore personal vscode settings. to contribute a change, use `just stop-ignore $file`
12+
@just ignore .vscode/settings.json api/.vscode/settings.json web/.vscode/settings.json
13+
# ignore api local-state files
14+
@just ignore api/dev/states/myservers.cfg api/dev/Unraid.net/myservers.cfg
15+
16+
just api/setup
17+
just web/setup
18+
19+
20+
# starts ignoring a file already tracked by git. (gitignore will not apply to these files)
21+
[group('git')]
22+
[no-cd]
23+
ignore +files:
24+
#!/usr/bin/env bash
25+
for file in {{ files }}; do
26+
if [ ! -f "$file" ]; then
27+
echo "Warning: $file does not exist"
28+
continue
29+
fi
30+
git update-index --skip-worktree "$file"
31+
done
32+
33+
# resumes normal tracking of an ignored tracked file.
34+
[group('git')]
35+
[no-cd]
36+
stop-ignoring file:
37+
git update-index --no-skip-worktree {{ file }}
38+
39+
# lists tracked files where further changes are being ignored.
40+
[group('git')]
41+
list-ignored:
42+
-git ls-files -v | grep '^S'

readme.md

Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
<!-- Adapted from: https://github.com/othneildrew/Best-README-Template -->
2+
<!-- Improved compatibility of back to top link: See: https://github.com/othneildrew/Best-README-Template/pull/73 -->
3+
<a id="readme-top"></a>
4+
5+
<!-- PROJECT SHIELDS -->
6+
<!--
7+
*** I'm using markdown "reference style" links for readability.
8+
*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
9+
*** See the bottom of this document for the declaration of the reference variables
10+
*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.
11+
*** https://www.markdownguide.org/basic-syntax/#reference-style-links
12+
-->
13+
[![Contributors][contributors-shield]][contributors-url]
14+
[![Forks][forks-shield]][forks-url]
15+
[![Stargazers][stars-shield]][stars-url]
16+
[![Issues][issues-shield]][issues-url]
17+
[![MIT License][license-shield]][license-url]
18+
[![LinkedIn][linkedin-shield]][linkedin-url]
19+
20+
21+
22+
<!-- PROJECT LOGO -->
23+
<br />
24+
<div align="center">
25+
<a href="https://github.com/unraid/api">
26+
<img src=".github/unraid.svg" alt="Logo" width="80" height="80">
27+
</a>
28+
29+
<h3 align="center">Unraid Connect</h3>
30+
31+
<p align="center">
32+
Monorepo for Unraid Connect and the Unraid API.
33+
<br />
34+
<a href="https://docs.unraid.net/"><strong>Explore the docs »</strong></a>
35+
<br />
36+
<br />
37+
<a href="https://github.com/unraid/api">View Demo</a>
38+
·
39+
<a href="https://github.com/unraid/api/issues/new?labels=bug&template=bug-report---.md">Report Bug</a>
40+
·
41+
<a href="https://github.com/unraid/api/issues/new?labels=enhancement&template=feature-request---.md">Request Feature</a>
42+
</p>
43+
</div>
44+
45+
46+
47+
<!-- TABLE OF CONTENTS -->
48+
<details>
49+
<summary>Table of Contents</summary>
50+
<ol>
51+
<li>
52+
<a href="#about-the-project">About The Project</a>
53+
<ul>
54+
<li><a href="#built-with">Built With</a></li>
55+
</ul>
56+
</li>
57+
<li>
58+
<a href="#getting-started">Getting Started</a>
59+
<ul>
60+
<li><a href="#prerequisites">Prerequisites</a></li>
61+
<li><a href="#installation">Installation</a></li>
62+
</ul>
63+
</li>
64+
<li><a href="#usage">Usage</a></li>
65+
<li><a href="#roadmap">Roadmap</a></li>
66+
<li><a href="#contributing">Contributing</a></li>
67+
<li><a href="#license">License</a></li>
68+
<li><a href="#contact">Contact</a></li>
69+
<li><a href="#acknowledgments">Acknowledgments</a></li>
70+
</ol>
71+
</details>
72+
73+
74+
<!-- ABOUT THE PROJECT -->
75+
## About The Project
76+
77+
<!-- [![Product Name Screen Shot][product-screenshot]](https://unraid.net)
78+
79+
<p align="right">(<a href="#readme-top">back to top</a>)</p> -->
80+
81+
### Built With
82+
83+
* [![Unraid][Unraid]][Unraid-url]
84+
* [![Node.js][Node.js]][Node-url]
85+
* [![Nuxt][Nuxt.js]][Nuxt-url]
86+
* [![PHP][PHP]][PHP-url]
87+
88+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
89+
90+
91+
92+
<!-- GETTING STARTED -->
93+
## Getting Started
94+
95+
This section will guide you through the steps necessary to get the monorepo projects running and
96+
communicating with each other.
97+
98+
### Prerequisites
99+
100+
Make sure the following software is installed before proceeding.
101+
102+
- Bash
103+
- Docker (for macOS folks, Orbstack works too)
104+
- [Node.js (v20)][Node-url]
105+
- [Just](https://github.com/casey/just)
106+
- An [Unraid][Unraid-url] server for development
107+
108+
Next, create an SSH key if you haven't already.
109+
Once you have your key pair, add your public SSH key to your Unraid server:
110+
111+
1. Log in to your Unraid development server.
112+
2. Use the navigation menu to go to 'Users'.
113+
3. Click on the user you logged in with (e.g. `root`)
114+
4. Paste your SSH public key into 'SSH authorized keys' and click 'Save'.
115+
116+
### Installation
117+
118+
1. Clone and enter the repo
119+
```sh
120+
# Optionally, give the cloned folder a more specific name
121+
gh repo clone unraid/api api-monorepo
122+
cd api-monorepo
123+
```
124+
2. Run the monorepo setup command.
125+
```sh
126+
just setup
127+
```
128+
This will run installation scripts, container builds, and some git scripts to reduce noise (i.e. personal editor customizations, etc).
129+
3. Run the API container
130+
```sh
131+
cd api
132+
npm run container:start
133+
```
134+
4. This should bring you inside the API container. There, run the following command to start the server:
135+
```js
136+
npm run dev
137+
```
138+
5. In another terminal, open the project and navigate to the web directory. Then, run the dev server:
139+
```sh
140+
cd web
141+
npm install # just in case
142+
npm run dev
143+
```
144+
145+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
146+
147+
148+
<!-- USAGE EXAMPLES -->
149+
## Usage
150+
151+
Use this space to show useful examples of how a project can be used. Additional screenshots, code examples and demos work well in this space. You may also link to more resources.
152+
153+
_For more examples, please refer to the [Documentation](https://docs.unraid.net/)_
154+
155+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
156+
157+
158+
159+
<!-- ROADMAP -->
160+
<!-- ## Roadmap
161+
162+
- [ ] Feature 1
163+
- [ ] Feature 2
164+
- [ ] Feature 3
165+
- [ ] Nested Feature
166+
167+
See the [open issues](https://github.com/unraid/api/issues) for a full list of proposed features (and known issues).
168+
169+
<p align="right">(<a href="#readme-top">back to top</a>)</p> -->
170+
171+
<!-- CONTRIBUTING -->
172+
<!-- ## Contributing
173+
174+
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
175+
176+
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
177+
Don't forget to give the project a star! Thanks again!
178+
179+
1. Fork the Project
180+
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
181+
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
182+
4. Push to the Branch (`git push origin feature/AmazingFeature`)
183+
5. Open a Pull Request
184+
185+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
186+
187+
### Top contributors:
188+
189+
<a href="https://github.com/unraid/api/graphs/contributors">
190+
<img src="https://contrib.rocks/image?repo=unraid/api" alt="contrib.rocks image" />
191+
</a> -->
192+
193+
194+
195+
<!-- LICENSE -->
196+
<!-- ## License
197+
198+
<p align="right">(<a href="#readme-top">back to top</a>)</p> -->
199+
200+
201+
<!-- CONTACT -->
202+
## Contact
203+
204+
[@UnraidOfficial](https://twitter.com/UnraidOfficial) - [email protected]
205+
206+
Project Link: [https://github.com/unraid/api](https://github.com/unraid/api)
207+
208+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
209+
210+
211+
<!-- ACKNOWLEDGMENTS -->
212+
## Acknowledgments
213+
214+
* []()
215+
* []()
216+
* []()
217+
218+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
219+
220+
221+
222+
<!-- MARKDOWN LINKS & IMAGES -->
223+
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
224+
[contributors-shield]: https://img.shields.io/github/contributors/unraid/api.svg?style=for-the-badge
225+
[contributors-url]: https://github.com/unraid/api/graphs/contributors
226+
[forks-shield]: https://img.shields.io/github/forks/unraid/api.svg?style=for-the-badge
227+
[forks-url]: https://github.com/unraid/api/network/members
228+
[stars-shield]: https://img.shields.io/github/stars/unraid/api.svg?style=for-the-badge
229+
[stars-url]: https://github.com/unraid/api/stargazers
230+
[issues-shield]: https://img.shields.io/github/issues/unraid/api.svg?style=for-the-badge
231+
[issues-url]: https://github.com/unraid/api/issues
232+
[license-shield]: https://img.shields.io/github/license/unraid/api.svg?style=for-the-badge
233+
[license-url]: https://github.com/unraid/api/blob/master/LICENSE.txt
234+
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
235+
[linkedin-url]: https://www.linkedin.com/company/unraid
236+
[product-screenshot]: images/screenshot.png
237+
[Nuxt.js]: https://img.shields.io/badge/Nuxt-002E3B?style=for-the-badge&logo=nuxtdotjs&logoColor=#00DC82
238+
[Node.js]: https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white
239+
[PHP]: https://img.shields.io/badge/php-%23777BB4.svg?style=for-the-badge&logo=php&logoColor=white
240+
[Unraid]: https://img.shields.io/badge/unraid-%23F15A2C.svg?style=for-the-badge&logo=unraid&logoColor=white
241+
[Unraid-url]: https://unraid.net
242+
[Nuxt-url]: https://nuxt.com/
243+
[Node-url]: https://nodejs.org/
244+
[PHP-url]: https://php.net/

web/.env.example

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@ VITE_UNRAID_NET=https://unraid.ddev.site
44
VITE_OS_RELEASES="https://releases.unraid.net/os"
55
VITE_CALLBACK_KEY=aNotSoSecretKeyUsedToObfuscateQueryParams
66
VITE_ALLOW_CONSOLE_LOGS=true
7-
VITE_TAILWIND_BASE_FONT_SIZE=10
7+
# Base font size in pixels for Tailwind CSS. Used by the tailwind-rem-to-rem plugin to scale rem values.
8+
# This lets us use rem's in our css instead of pixels while remaining webgui-compatible without additional hacks.
9+
# This should match your root font size. Default: 16
10+
# For an Unraid Webgui deployment, set this to 10.
11+
VITE_TAILWIND_BASE_FONT_SIZE=16
12+
VITE_WEBGUI=http://localhost:3001

web/justfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
set fallback
2+
3+
default:
4+
@just --list --justfile {{justfile()}} --list-heading $'\nWeb project recipes:\n'
5+
@just list-commands
6+
7+
setup:
8+
cp .env.example .env
9+
npm install

0 commit comments

Comments
 (0)