lenix 1.4.4 β 1.6.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/Readme.md +25 -12
- package/index.ts +17 -0
- package/modules/src/edge/index.ts +11 -11
- package/modules/src/entries/index.ts +9 -6
- package/modules/src/fetch/index.ts +16 -9
- package/modules/src/fxmanifest/fxmanifest.json +7 -13
- package/modules/src/fxmanifest/index.ts +12 -12
- package/modules/src/fxmanifest/tsconfig.json +6 -6
- package/modules/src/guard/index.ts +11 -0
- package/modules/src/index.ts +1 -1
- package/modules/src/lint/preset.json +347 -360
- package/modules/src/raise/index.ts +9 -0
- package/modules/src/wait/index.ts +3 -1
- package/oop/README.md +4 -1
- package/package.json +15 -9
- package/lint/dist/lint.mjs +0 -275
package/Readme.md
CHANGED
|
@@ -3,9 +3,13 @@
|
|
|
3
3
|
The All-in-one Repository
|
|
4
4
|
|
|
5
5
|
## πΊοΈ Roadmap
|
|
6
|
+
|
|
6
7
|
### Lint
|
|
8
|
+
|
|
7
9
|
- [ ] fix the lint tsconfig.json file creation when no file is found
|
|
10
|
+
|
|
8
11
|
### Extension
|
|
12
|
+
|
|
9
13
|
- [x] trim the diff's unusefull text
|
|
10
14
|
- [ ] use walkthrough instead of custom page
|
|
11
15
|
- [ ] use webview to add quick settings
|
|
@@ -14,25 +18,34 @@ The All-in-one Repository
|
|
|
14
18
|
- [ ] use add commit reminder
|
|
15
19
|
- ~~[/] add a revert last commit button~~ (use amend instead)
|
|
16
20
|
- [ ] add more configuration to the commit composer extension
|
|
21
|
+
|
|
17
22
|
### OOP
|
|
23
|
+
|
|
18
24
|
- [ ] Implement the complete annotation
|
|
19
25
|
- [ ] Provide Documentation
|
|
20
26
|
- [ ] Clearify the installation steps
|
|
21
27
|
|
|
22
28
|
## Usage
|
|
29
|
+
|
|
23
30
|
### Lint
|
|
31
|
+
|
|
24
32
|
```ts
|
|
25
33
|
import lint from 'lenix/lint' with { type: "json" }
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
{
|
|
35
|
+
...
|
|
36
|
+
languageOptions: {
|
|
37
|
+
...,
|
|
38
|
+
parserOptions: {
|
|
39
|
+
projectService: true,
|
|
40
|
+
tsconfigRootDir: import.meta.dirname,
|
|
41
|
+
},
|
|
42
|
+
...,
|
|
31
43
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
44
|
+
rules: {
|
|
45
|
+
...,
|
|
46
|
+
...lint.strict,
|
|
47
|
+
...,
|
|
48
|
+
}
|
|
49
|
+
...
|
|
50
|
+
},
|
|
51
|
+
```
|
package/index.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const [, , cmd] = process.argv
|
|
3
|
+
|
|
4
|
+
switch (cmd) {
|
|
5
|
+
case 'format':
|
|
6
|
+
await import('./format/index')
|
|
7
|
+
break
|
|
8
|
+
case '--lint':
|
|
9
|
+
await import('./lint/src/lint.mts')
|
|
10
|
+
break
|
|
11
|
+
default:
|
|
12
|
+
process.stdout.write(
|
|
13
|
+
'Usage: lenix <command>\n\nCommands:\n format Setup prettier\n --lint Setup eslint\n',
|
|
14
|
+
)
|
|
15
|
+
process.exit(0)
|
|
16
|
+
}
|
|
17
|
+
export {}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export type Events =
|
|
1
|
+
export type Events = 'users-management'
|
|
2
2
|
export interface CreateUser<Role> {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
identifier: string
|
|
4
|
+
role: Role
|
|
5
|
+
password: string
|
|
6
6
|
}
|
|
7
|
-
export interface UserAccount<Role, Label =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
export interface UserAccount<Role, Label = string> {
|
|
8
|
+
id: string
|
|
9
|
+
identifier: string
|
|
10
|
+
role: Role
|
|
11
|
+
roleLabel: Label
|
|
12
12
|
}
|
|
13
13
|
export interface DeleteUser {
|
|
14
|
-
|
|
14
|
+
identifier: string
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -19,4 +19,4 @@ export interface DeleteUser {
|
|
|
19
19
|
* DON NOT USE
|
|
20
20
|
* @description
|
|
21
21
|
* A proxy between client and server contexts that can provide a one source of truth instead of duplicating codes, lack of clearancy, race conditions, ...
|
|
22
|
-
*/
|
|
22
|
+
*/
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
* Get typed entries from an object (Typed Object.entries)
|
|
3
3
|
* @param object - Object to get entries from
|
|
4
4
|
* @returns Array of the passed entries
|
|
5
|
-
*/
|
|
6
|
-
export const entries = <T extends Record<string, unknown>>(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
*/
|
|
6
|
+
export const entries = <T extends Record<string, unknown>>(
|
|
7
|
+
object: T,
|
|
8
|
+
): {
|
|
9
|
+
[K in keyof T]: [K, T[K]]
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
11
|
+
}[keyof T][] => Object.entries(object) as {
|
|
12
|
+
[K in keyof T]: [K, T[K]]
|
|
13
|
+
}[keyof T][]
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* A wrapper for fetch that throws an error if the request fails.
|
|
2
3
|
* @param domain - domain of the URL (e.g. api.github.com)
|
|
3
4
|
* @param endpoint - endpoint of the URL (e.g. users/lenixdev)
|
|
4
5
|
* @param request - request options (e.g. { method: 'GET' })
|
|
5
6
|
*/
|
|
6
|
-
export const caughtFetch = async (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
export const caughtFetch = async (
|
|
8
|
+
domain: string,
|
|
9
|
+
endpoint: string,
|
|
10
|
+
request?: RequestInit,
|
|
11
|
+
): Promise<Response> => {
|
|
12
|
+
try {
|
|
13
|
+
return await fetch(`https://${domain}/${endpoint}`, request)
|
|
14
|
+
} catch (error) {
|
|
15
|
+
throw new Error('An error occurred while making the request.', {
|
|
16
|
+
cause: error,
|
|
17
|
+
})
|
|
18
|
+
} finally {
|
|
19
|
+
console.debug(`End of ${domain}/${endpoint} request`)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
],
|
|
10
|
-
"ui_page": "client/nui/dist/index.html",
|
|
11
|
-
"files": [
|
|
12
|
-
"client/nui/dist/**"
|
|
13
|
-
]
|
|
14
|
-
}
|
|
2
|
+
"fx_version": "cerulean",
|
|
3
|
+
"game": "gta5",
|
|
4
|
+
"client_scripts": ["dist/client.js"],
|
|
5
|
+
"server_scripts": ["dist/server.js"],
|
|
6
|
+
"ui_page": "client/nui/dist/index.html",
|
|
7
|
+
"files": ["client/nui/dist/**"]
|
|
8
|
+
}
|
|
@@ -4,21 +4,21 @@ type FileContent = Parameters<typeof writeFile>[1]
|
|
|
4
4
|
const fxmanifest = Object.entries((await import('./fxmanifest.json')).default)
|
|
5
5
|
|
|
6
6
|
const generateContent = () => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
`${key} {
|
|
7
|
+
let defaultContent: FileContent = ''
|
|
8
|
+
for (const [key, value] of fxmanifest) {
|
|
9
|
+
if (Array.isArray(value)) {
|
|
10
|
+
defaultContent += `${key} {
|
|
12
11
|
"${value}",
|
|
13
12
|
}
|
|
14
13
|
`
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
`${key} "${value}"
|
|
14
|
+
} else if (typeof value === 'string') {
|
|
15
|
+
defaultContent += `${key} "${value}"
|
|
18
16
|
`
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
} else throw new Error('Invalid value type')
|
|
18
|
+
}
|
|
19
|
+
return defaultContent
|
|
22
20
|
}
|
|
23
21
|
|
|
24
|
-
export const createFxmanifest = async (content?: FileContent) =>
|
|
22
|
+
export const createFxmanifest = async (content?: FileContent) => {
|
|
23
|
+
await writeFile('fxmanifest.lua', content || generateContent())
|
|
24
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
2
|
+
"extends": "../../../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"moduleResolution": "bundler",
|
|
5
|
+
"resolveJsonModule": true
|
|
6
|
+
}
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the value is one of the values in the array
|
|
3
|
+
* @param value - The value to check
|
|
4
|
+
* @param from - The array of values to check from
|
|
5
|
+
* @returns boolean, True if the value is one of the values in the array, False otherwise
|
|
6
|
+
* @example
|
|
7
|
+
* guard(1, [1, 2, 3]): true
|
|
8
|
+
* guard(4, [1, 2, 3]): false
|
|
9
|
+
*/
|
|
10
|
+
export const guard = <T>(value: unknown, from: readonly T[]): value is T =>
|
|
11
|
+
(from as readonly unknown[]).includes(value)
|
package/modules/src/index.ts
CHANGED