@madhanmaaz/udane 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app.js +95 -0
- package/config/udane.config.js +47 -0
- package/constants/index.constant.js +4 -0
- package/helpers/directory.helper.js +74 -0
- package/helpers/getConfig.helper.js +187 -0
- package/helpers/ignore.helper.js +47 -0
- package/helpers/templateEngine.helper.js +10 -0
- package/lib/bin.js +125 -0
- package/lib/udane.js +134 -0
- package/license +21 -0
- package/middleware/inject.middleware.js +42 -0
- package/package.json +42 -5
- package/public/css/base/global.css +10 -0
- package/public/css/base/root.css +136 -0
- package/public/css/components/input.css +41 -0
- package/public/css/pages/listing.css +88 -0
- package/public/favicon.ico +0 -0
- package/public/fonts/Roboto-Medium.ttf +0 -0
- package/public/images/file.png +0 -0
- package/public/images/folder.png +0 -0
- package/public/images/logo.png +0 -0
- package/public/js/client.js +56 -0
- package/readme.md +124 -0
- package/views/error.tark +35 -0
- package/views/listing.tark +102 -0
- package/README.md +0 -3
package/readme.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/madhanmaaz/udane/master/public/images/logo.png" width="150px" alt="udane" />
|
|
3
|
+
</p>
|
|
4
|
+
<h1 align="center">
|
|
5
|
+
Udane
|
|
6
|
+
</h1>
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
<a href="https://github.com/madhanmaaz/udane/blob/main/license"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License" /></a>
|
|
10
|
+
<a href="https://github.com/madhanmaaz/udane/issues"><img src="https://img.shields.io/github/issues/madhanmaaz/udane" alt="Open Issues" /></a>
|
|
11
|
+
<a href="https://github.com/madhanmaaz/udane/stargazers"><img src="https://img.shields.io/github/stars/madhanmaaz/udane" alt="Stars" /></a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
Udane is a fast, lightweight development server with live reload, built on Fastify.
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install -g @madhanmaaz/udane
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
udane [root] [options]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Start Udane from the current directory:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
udane
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Serve a specific directory:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
udane ./public
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Commands
|
|
43
|
+
|
|
44
|
+
#### `init`
|
|
45
|
+
|
|
46
|
+
Create a default `udane.config.js` in the current directory.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
udane init
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Use `--force` to overwrite an existing configuration file:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
udane init --force
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Options
|
|
59
|
+
|
|
60
|
+
| Option | Description |
|
|
61
|
+
| ---------------------- | -------------------------------------------------------------------------------- |
|
|
62
|
+
| `-p, --port <number>` | Port to listen on |
|
|
63
|
+
| `-H, --host <address>` | Interface to bind (`0.0.0.0` = network, `127.0.0.1` = local only) |
|
|
64
|
+
| `--cors` | Send `Access-Control-Allow-Origin: *` |
|
|
65
|
+
| `--debounce <ms>` | Wait time after the last file change |
|
|
66
|
+
| `--watch <path>` | Path to watch (repeatable) |
|
|
67
|
+
| `--ignore <pattern>` | Pattern to ignore (repeatable) |
|
|
68
|
+
| `-f, --force` | Overwrite an existing config file (`init` only) |
|
|
69
|
+
| `-h, --help` | Show this help |
|
|
70
|
+
| `-v, --version` | Show the version |
|
|
71
|
+
|
|
72
|
+
## Examples
|
|
73
|
+
|
|
74
|
+
### Serve a directory
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
udane ./dist
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Use a custom port
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
udane --port 3000
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Allow network access
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
udane --host 0.0.0.0
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Enable CORS
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
udane --cors
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Watch specific paths
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
udane --watch src --watch public
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Ignore files
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
udane --ignore node_modules --ignore "*.log"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Configuration
|
|
111
|
+
|
|
112
|
+
Generate a configuration file:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
udane init # This creates: udane.config.js
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The configuration file allows you to keep your development-server settings in the project instead of passing them through the CLI every time.
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
This project is licensed under the MIT License — Copyright (c) 2026 Madhan (Madhanmaaz)
|
|
123
|
+
|
|
124
|
+
[View the full license](https://github.com/madhanmaaz/udane/blob/main/LICENSE)
|
package/views/error.tark
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>{{ statusCode }} - {{ title }}</title>
|
|
7
|
+
<link rel="shortcut icon" href="/{{ PUBLIC_DIR_PREFIX }}/favicon.ico" />
|
|
8
|
+
<link
|
|
9
|
+
rel="stylesheet"
|
|
10
|
+
href="/{{ PUBLIC_DIR_PREFIX }}/css/base/global.css"
|
|
11
|
+
/>
|
|
12
|
+
<style>
|
|
13
|
+
.container {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
gap: calc(var(--sp) * 6);
|
|
18
|
+
padding: calc(var(--sp) * 4);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.container span {
|
|
22
|
+
width: 2px;
|
|
23
|
+
height: 40px;
|
|
24
|
+
background: hsl(var(--bc));
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
27
|
+
</head>
|
|
28
|
+
<body>
|
|
29
|
+
<div class="container">
|
|
30
|
+
<h1>{{ statusCode }}</h1>
|
|
31
|
+
<span></span>
|
|
32
|
+
<p>{{ title }}</p>
|
|
33
|
+
</div>
|
|
34
|
+
</body>
|
|
35
|
+
</html>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>listing - {{ listing.base }}</title>
|
|
7
|
+
<link rel="icon" href="/{{ PUBLIC_DIR_PREFIX }}/favicon.ico" />
|
|
8
|
+
|
|
9
|
+
<link
|
|
10
|
+
rel="stylesheet"
|
|
11
|
+
href="/{{ PUBLIC_DIR_PREFIX }}/css/base/global.css"
|
|
12
|
+
/>
|
|
13
|
+
|
|
14
|
+
<link
|
|
15
|
+
rel="stylesheet"
|
|
16
|
+
href="/{{ PUBLIC_DIR_PREFIX }}/css/components/input.css"
|
|
17
|
+
/>
|
|
18
|
+
|
|
19
|
+
<link
|
|
20
|
+
rel="stylesheet"
|
|
21
|
+
href="/{{ PUBLIC_DIR_PREFIX }}/css/pages/listing.css"
|
|
22
|
+
/>
|
|
23
|
+
</head>
|
|
24
|
+
<body>
|
|
25
|
+
<header>
|
|
26
|
+
<img
|
|
27
|
+
class="logo"
|
|
28
|
+
src="/{{ PUBLIC_DIR_PREFIX }}/images/logo.png"
|
|
29
|
+
alt="udane"
|
|
30
|
+
/>
|
|
31
|
+
|
|
32
|
+
<input
|
|
33
|
+
id="directory-input"
|
|
34
|
+
class="input"
|
|
35
|
+
type="text"
|
|
36
|
+
value="{{ listing.base }}"
|
|
37
|
+
placeholder="Directory bar..."
|
|
38
|
+
/>
|
|
39
|
+
|
|
40
|
+
<input
|
|
41
|
+
id="search-input"
|
|
42
|
+
class="input"
|
|
43
|
+
type="search"
|
|
44
|
+
placeholder="Search files..."
|
|
45
|
+
/>
|
|
46
|
+
</header>
|
|
47
|
+
|
|
48
|
+
<main id="files">
|
|
49
|
+
{{:for file in listing.entries }}
|
|
50
|
+
<a href="{{ file.href }}">
|
|
51
|
+
<img
|
|
52
|
+
src="/{{ PUBLIC_DIR_PREFIX }}/images/{{ file.isDirectory ? 'folder' : 'file' }}.png"
|
|
53
|
+
alt=""
|
|
54
|
+
/>
|
|
55
|
+
<span>{{ file.name }}</span>
|
|
56
|
+
</a>
|
|
57
|
+
{{/for}}
|
|
58
|
+
</main>
|
|
59
|
+
|
|
60
|
+
<footer>
|
|
61
|
+
<p>
|
|
62
|
+
<a
|
|
63
|
+
href="https://github.com/madhanmaaz/udane"
|
|
64
|
+
style="color: hsl(var(--primary))"
|
|
65
|
+
target="_blank"
|
|
66
|
+
>
|
|
67
|
+
Udane
|
|
68
|
+
</a>
|
|
69
|
+
Developed by
|
|
70
|
+
<a href="https://madhanmaaz.netlify.app" target="_blank">
|
|
71
|
+
madhanmaaz
|
|
72
|
+
</a>
|
|
73
|
+
</p>
|
|
74
|
+
</footer>
|
|
75
|
+
|
|
76
|
+
<script>
|
|
77
|
+
const filesContainer = document.getElementById("files");
|
|
78
|
+
const directoryInput = document.getElementById("directory-input");
|
|
79
|
+
const searchInput = document.getElementById("search-input");
|
|
80
|
+
|
|
81
|
+
const files = [...filesContainer.querySelectorAll("a")];
|
|
82
|
+
|
|
83
|
+
// directory input
|
|
84
|
+
directoryInput.addEventListener("keydown", (e) => {
|
|
85
|
+
if (e.key !== "Enter") return;
|
|
86
|
+
|
|
87
|
+
const value = directoryInput.value.trim() || "/";
|
|
88
|
+
location.pathname = value.endsWith("/") ? value : `${value}/`;
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// search
|
|
92
|
+
searchInput.addEventListener("input", (e) => {
|
|
93
|
+
const value = e.target.value.trim().toLowerCase();
|
|
94
|
+
|
|
95
|
+
for (const file of files) {
|
|
96
|
+
const name = file.textContent.trim().toLowerCase();
|
|
97
|
+
file.classList.toggle("hide", !name.includes(value));
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
</script>
|
|
101
|
+
</body>
|
|
102
|
+
</html>
|
package/README.md
DELETED