Skip to content

Commit f990a5b

Browse files
committed
feat: create filesystem package
1 parent a4b4cea commit f990a5b

19 files changed

Lines changed: 379 additions & 89 deletions

File tree

.barrelize

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@
4343
"**/*.d.ts"
4444
]
4545
},
46+
{
47+
"name": "index.ts",
48+
"root": "packages/filesystem/src",
49+
"exclude": [
50+
"**/*.test.ts",
51+
"**/*.d.ts"
52+
]
53+
},
4654
{
4755
"name": "index.ts",
4856
"root": "packages/http/src",

examples/basic-app/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"build": "NODE_ENV=production tsdown --config-loader unconfig -c tsdown.default.config.ts",
99
"devx": "tsx watch ./src/server.ts",
1010
"dev": "NODE_ENV=development pnpm tsdown --config-loader unconfig -c tsdown.default.config.ts",
11-
"start": "SRC_PATH=dist node -r tsconfig-paths/register dist/server.js",
11+
"start": "SRC_PATH=dist node -r source-map-support/register dist/server.js",
1212
"lint": "eslint . --ext .ts",
1313
"mosket": "node node_modules/@h3ravel/console/bin/fire"
1414
},
@@ -18,6 +18,7 @@
1818
"@h3ravel/config": "workspace:^",
1919
"@h3ravel/console": "workspace:^",
2020
"@h3ravel/core": "workspace:^",
21+
"@h3ravel/filesystem": "workspace:^",
2122
"@h3ravel/database": "workspace:^",
2223
"@h3ravel/http": "workspace:^",
2324
"@h3ravel/mail": "workspace:^",

examples/basic-app/src/bootstrap/providers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { CacheServiceProvider } from '@h3ravel/cache'
77
import { QueueServiceProvider } from '@h3ravel/queue'
88
import { MailServiceProvider } from '@h3ravel/mail'
99
import { ConfigServiceProvider } from '@h3ravel/config'
10+
import { FilesystemProvider } from '@h3ravel/filesystem'
1011
import { AppServiceProvider } from 'src/app/Providers/AppServiceProvider'
1112

1213
/**
@@ -23,4 +24,5 @@ export default <Array<new (_app: Application) => IServiceProvider>>[
2324
QueueServiceProvider,
2425
MailServiceProvider,
2526
AppServiceProvider,
27+
FilesystemProvider,
2628
]

packages/console/src/Utils.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,6 @@ export class Utils {
2727
return path.join(path.dirname(resolved), parts.join('/'))
2828
}
2929

30-
static async getMigrationPaths (cwd: string, migrator: any, defaultPath: string, path: string) {
31-
if (path) {
32-
return [join(cwd, path)]
33-
}
34-
return [
35-
...migrator.getPaths(),
36-
join(cwd, defaultPath),
37-
]
38-
}
39-
4030
/**
4131
* Check if file exists
4232
*

packages/core/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<a href="https://h3ravel.toneflix.net" target="_blank">
33
<img src="https://raw.githubusercontent.com/h3ravel/assets/refs/heads/main/logo-full.svg" width="200" alt="H3ravel Logo">
44
</a>
5-
<h1 align="center"><a href="https://h3ravel.toneflix.net/arquebus">H3ravel Core</a></h1>
5+
<h1 align="center"><a href="https://h3ravel.toneflix.net">H3ravel Core</a></h1>
66

77
[![Framework][ix]][lx]
88
[![Core Package Version][i1]][l1]

packages/core/package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
"version": "1.8.0",
44
"description": "Core application container, lifecycle management and service providers for H3ravel.",
55
"type": "module",
6-
"main": "./dist/index.js",
7-
"types": "./dist/index.d.ts",
8-
"module": "./dist/index.js",
96
"exports": {
107
".": {
118
"types": "./dist/index.d.ts",
@@ -54,14 +51,15 @@
5451
"@h3ravel/shared": "workspace:^",
5552
"@h3ravel/support": "workspace:^",
5653
"chalk": "^5.6.2",
54+
"commander": "^14.0.1",
55+
"detect-port": "^2.1.0",
5756
"dotenv": "^17.2.2",
5857
"dotenv-expand": "^12.0.3",
5958
"edge.js": "^6.3.0",
6059
"h3": "2.0.0-beta.4",
6160
"reflect-metadata": "^0.2.2",
6261
"srvx": "^0.8.7",
63-
"tslib": "^2.8.1",
64-
"detect-port": "^2.1.0"
62+
"tslib": "^2.8.1"
6563
},
6664
"devDependencies": {
6765
"typescript": "^5.9.2"
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import { Application } from "../Application";
2+
import type { Argument } from "commander";
3+
import { ConsoleKernel } from "./ConsoleKernel";
4+
import { XGeneric } from "@h3ravel/support";
5+
6+
export class ConsoleCommand {
7+
constructor(protected app: Application, protected kernel: ConsoleKernel) { }
8+
9+
/**
10+
* The name and signature of the console command.
11+
*
12+
* @var string
13+
*/
14+
protected signature!: string;
15+
16+
/**
17+
* A dictionary of signatures or what not.
18+
*
19+
* @var object
20+
*/
21+
protected dictionary: Record<string, any> = {}
22+
23+
/**
24+
* The console command description.
25+
*
26+
* @var string
27+
*/
28+
protected description?: string;
29+
30+
/**
31+
* The console command input.
32+
*
33+
* @var object
34+
*/
35+
private input: XGeneric<{ options: Record<string, any>, arguments: Record<string, any> }> = {
36+
options: {},
37+
arguments: {},
38+
}
39+
40+
/**
41+
* Execute the console command.
42+
*/
43+
public async handle (..._args: any[]): Promise<void> { }
44+
45+
setApplication (app: Application) {
46+
this.app = app
47+
}
48+
49+
setInput (options: XGeneric, args: string[], regArgs: readonly Argument[], dictionary: Record<string, any>) {
50+
this.dictionary = dictionary
51+
this.input.options = options
52+
this.input.arguments = regArgs
53+
.map((e, i) => ({ [e.name()]: args[i] }))
54+
.reduce((e, x) => Object.assign(e, x), {})
55+
}
56+
57+
getSignature () {
58+
return this.signature
59+
}
60+
61+
getDescription () {
62+
return this.description
63+
}
64+
65+
option (key: string, def?: any) {
66+
return this.input.options[key] ?? def
67+
}
68+
69+
options (key?: string) {
70+
if (key) {
71+
return this.input.options[key]
72+
}
73+
return this.input.options
74+
}
75+
76+
argument (key: string, def?: any) {
77+
return this.input.arguments[key] ?? def
78+
}
79+
80+
arguments () {
81+
return this.input.arguments
82+
}
83+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export class ConsoleKernel { }

packages/core/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
export * from './Application'
2+
export * from './Console/ConsoleCommand'
3+
export * from './Console/ConsoleKernel'
24
export * from './Container'
35
export * from './Contracts/ServiceProviderConstructor'
46
export * from './Controller'

packages/filesystem/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<div align="center">
2+
<a href="https://h3ravel.toneflix.net" target="_blank">
3+
<img src="https://raw.githubusercontent.com/h3ravel/assets/refs/heads/main/logo-full.svg" width="200" alt="H3ravel Logo">
4+
</a>
5+
<h1 align="center"><a href="https://h3ravel.toneflix.net">H3ravel Filesystem</a></h1>
6+
7+
[![Framework][ix]][lx]
8+
[![Filesystem Package Version][i1]][l1]
9+
[![Downloads][d1]][d1]
10+
[![Tests][tei]][tel]
11+
[![License][lini]][linl]
12+
13+
</div>
14+
15+
# About H3ravel/filesystem
16+
17+
This is the filesystem manager for the [H3ravel](https://h3ravel.toneflix.net) framework.
18+
19+
## Contributing
20+
21+
Thank you for considering contributing to the H3ravel framework! The [Contribution Guide](https://h3ravel.toneflix.net/contributing) can be found in the H3ravel documentation and will provide you with all the information you need to get started.
22+
23+
## Code of Conduct
24+
25+
In order to ensure that the H3ravel community is welcoming to all, please review and abide by the [Code of Conduct](#).
26+
27+
## Security Vulnerabilities
28+
29+
If you discover a security vulnerability within H3ravel, please send an e-mail to Legacy via hamzas.legacy@toneflix.ng. All security vulnerabilities will be promptly addressed.
30+
31+
## License
32+
33+
The H3ravel framework is open-sourced software licensed under the [MIT license](LICENSE).
34+
35+
[ix]: https://img.shields.io/npm/v/%40h3ravel%2Fcore?style=flat-square&label=Framework&color=%230970ce
36+
[lx]: https://www.npmjs.com/package/@h3ravel/core
37+
[i1]: https://img.shields.io/npm/v/%40h3ravel%2Fhttp?style=flat-square&label=@h3ravel/filesystem&color=%230970ce
38+
[l1]: https://www.npmjs.com/package/@h3ravel/filesystem
39+
[d1]: https://img.shields.io/npm/dt/%40h3ravel%2Fhttp?style=flat-square&label=Downloads&link=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2F%40h3ravel%2Fhttp
40+
[linl]: https://github.com/h3ravel/framework/blob/main/LICENSE
41+
[lini]: https://img.shields.io/github/license/h3ravel/framework
42+
[tel]: https://github.com/h3ravel/framework/actions/workflows/test.yml
43+
[tei]: https://github.com/h3ravel/framework/actions/workflows/test.yml/badge.svg

0 commit comments

Comments
 (0)