lenix 1.4.3 β†’ 1.5.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 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
- languageOptions: {
27
- [....],
28
- parserOptions: {
29
- projectService: true,
30
- tsconfigRootDir: import.meta.dirname,
34
+ {
35
+ ...
36
+ languageOptions: {
37
+ ...,
38
+ parserOptions: {
39
+ projectService: true,
40
+ tsconfigRootDir: import.meta.dirname,
41
+ },
42
+ ...,
31
43
  },
32
- [....],
33
- }
34
- rules: {
35
- [....],
36
- ...lint.strict
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 = "users-management"
1
+ export type Events = 'users-management'
2
2
  export interface CreateUser<Role> {
3
- identifier: string
4
- role: Role
5
- password: string
3
+ identifier: string
4
+ role: Role
5
+ password: string
6
6
  }
7
- export interface UserAccount<Role, Label> {
8
- id: string
9
- identifier: string
10
- role: Role
11
- roleLabel: Label
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
- identifier: string
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>>(object: T) => {
7
- return Object.entries(object) as Array<{
8
- [K in keyof T]: [K, T[K]]
9
- }[keyof T]>
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 (domain: string, endpoint: string, request?: RequestInit) => {
7
- try {
8
- return await fetch(`https://${domain}/${endpoint}`, request)
9
- } catch(error) {
10
- throw new Error('An error occurred while making the request.', { cause: error })
11
- } finally {
12
- console.debug(`End of ${domain}/${endpoint} request`)
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
- "fx_version": "cerulean",
3
- "game": "gta5",
4
- "client_scripts": [
5
- "dist/client.js"
6
- ],
7
- "server_scripts": [
8
- "dist/server.js"
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
- let defaultContent: FileContent = ''
8
- for (const [key, value] of fxmanifest) {
9
- if (Array.isArray(value)) {
10
- defaultContent +=
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
- } else if (typeof value === 'string') {
16
- defaultContent +=
17
- `${key} "${value}"
14
+ } else if (typeof value === 'string') {
15
+ defaultContent += `${key} "${value}"
18
16
  `
19
- } else throw new Error('Invalid value type')
20
- }
21
- return defaultContent
17
+ } else throw new Error('Invalid value type')
18
+ }
19
+ return defaultContent
22
20
  }
23
21
 
24
- export const createFxmanifest = async (content?: FileContent) => await writeFile('fxmanifest.lua', content || generateContent())
22
+ export const createFxmanifest = async (content?: FileContent) => {
23
+ await writeFile('fxmanifest.lua', content || generateContent())
24
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
- "extends": "../../../tsconfig.json",
3
- "compilerOptions": {
4
- "moduleResolution": "bundler",
5
- "resolveJsonModule": true,
6
- },
7
- }
2
+ "extends": "../../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "moduleResolution": "bundler",
5
+ "resolveJsonModule": true
6
+ }
7
+ }
@@ -1,4 +1,4 @@
1
1
  export { wait } from './wait'
2
2
  export { caughtFetch } from './fetch'
3
3
  export { entries } from './entries'
4
- export * as edge from './edge'
4
+ export type * as edge from './edge'