lenix 1.6.2 → 1.6.4
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 +9 -1
- package/format/index.ts +69 -0
- package/format/preset.json +10 -0
- package/modules/src/entries/index.ts +5 -4
- package/modules/src/fxmanifest/index.ts +5 -6
- package/modules/src/lint/preset.json +1 -1
- package/modules/src/raise/index.ts +3 -1
- package/modules/src/wait/index.ts +4 -2
- package/package.json +3 -5
package/Readme.md
CHANGED
|
@@ -43,9 +43,17 @@ import lint from 'lenix/lint' with { type: "json" }
|
|
|
43
43
|
},
|
|
44
44
|
rules: {
|
|
45
45
|
...,
|
|
46
|
-
...lint.strict,
|
|
46
|
+
...lint.strict as any,
|
|
47
47
|
...,
|
|
48
48
|
}
|
|
49
49
|
...
|
|
50
50
|
},
|
|
51
51
|
```
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
"compilerOptions": {
|
|
55
|
+
...,
|
|
56
|
+
"types": ["node"],
|
|
57
|
+
...
|
|
58
|
+
}
|
|
59
|
+
```
|
package/format/index.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { intro, outro, confirm, log, spinner } from '@clack/prompts'
|
|
2
|
+
import { execSync } from 'child_process'
|
|
3
|
+
import fs from 'fs'
|
|
4
|
+
|
|
5
|
+
intro('Prettier Setup')
|
|
6
|
+
|
|
7
|
+
const install = await confirm({
|
|
8
|
+
message:
|
|
9
|
+
'Install prettier + eslint-config-prettier(to prevent conflicts)? (see https://prettier.io/docs/install)',
|
|
10
|
+
})
|
|
11
|
+
if (install === true) {
|
|
12
|
+
const span = spinner()
|
|
13
|
+
span.start('Installing...')
|
|
14
|
+
execSync('pnpm add --save-dev --save-exact prettier eslint-config-prettier', {
|
|
15
|
+
stdio: 'pipe',
|
|
16
|
+
})
|
|
17
|
+
span.stop('Installed')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const prompt = await confirm({ message: 'Create .prettierrc with a preset?' })
|
|
21
|
+
if (prompt === true) {
|
|
22
|
+
const preset = await import('./preset.json').then(file =>
|
|
23
|
+
JSON.stringify(file.default, null, 2),
|
|
24
|
+
)
|
|
25
|
+
fs.writeFileSync('.prettierrc', `${preset}\n`)
|
|
26
|
+
log.success('Created .prettierrc with a preset')
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const ignore = await confirm({
|
|
30
|
+
message: 'Create .prettierignore? (see https://prettier.io/docs/ignore)',
|
|
31
|
+
})
|
|
32
|
+
if (ignore === true) {
|
|
33
|
+
fs.writeFileSync('.prettierignore', '# Ignore artifacts:\nbuild\ncoverage\n')
|
|
34
|
+
log.success('Created .prettierignore')
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
log.warn(
|
|
38
|
+
'Manual (optional) — copy paste the import below and add "prettier" to the `end` of your ESLint extends',
|
|
39
|
+
)
|
|
40
|
+
log.info("---> import prettier from 'eslint-config-prettier' <---")
|
|
41
|
+
await confirm({ message: 'Done?' })
|
|
42
|
+
|
|
43
|
+
log.warn(
|
|
44
|
+
'Manual — add to .vscode/settings.json:\n "editor.formatOnSave": true,\n "editor.defaultFormatter": "esbenp.prettier-vscode"',
|
|
45
|
+
)
|
|
46
|
+
await confirm({ message: 'Done?' })
|
|
47
|
+
|
|
48
|
+
log.warn(
|
|
49
|
+
'Manual (optional) — add to .vscode/extensions.json (inside "recommendations" array):\n "esbenp.prettier-vscode"',
|
|
50
|
+
)
|
|
51
|
+
log.info('like: "recommendations": ["esbenp.prettier-vscode"]')
|
|
52
|
+
await confirm({ message: 'Done?' })
|
|
53
|
+
|
|
54
|
+
log.warn(
|
|
55
|
+
'Manual (optional) - add the following script into your package.json\'s scripts object : "format": "pnpm exec prettier . --write",',
|
|
56
|
+
)
|
|
57
|
+
await confirm({ message: 'Done?' })
|
|
58
|
+
|
|
59
|
+
const format = await confirm({
|
|
60
|
+
message: 'Run prettier on existing files now to test it out?',
|
|
61
|
+
})
|
|
62
|
+
if (format === true) {
|
|
63
|
+
const span = spinner()
|
|
64
|
+
span.start('Formatting...')
|
|
65
|
+
execSync('pnpm exec prettier . --write', { stdio: 'pipe' })
|
|
66
|
+
span.stop('Formatted')
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
outro('Prettier setup complete!')
|
|
@@ -7,7 +7,8 @@ export const entries = <T extends Record<string, unknown>>(
|
|
|
7
7
|
object: T,
|
|
8
8
|
): {
|
|
9
9
|
[K in keyof T]: [K, T[K]]
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
}[keyof T][] =>
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
12
|
+
Object.entries(object) as {
|
|
13
|
+
[K in keyof T]: [K, T[K]]
|
|
14
|
+
}[keyof T][]
|
|
@@ -5,20 +5,19 @@ const fxmanifest = Object.entries((await import('./fxmanifest.json')).default)
|
|
|
5
5
|
|
|
6
6
|
const generateContent = () => {
|
|
7
7
|
let defaultContent: FileContent = ''
|
|
8
|
-
for (const [key, value] of fxmanifest)
|
|
9
|
-
if (Array.isArray(value))
|
|
8
|
+
for (const [key, value] of fxmanifest)
|
|
9
|
+
if (Array.isArray(value))
|
|
10
10
|
defaultContent += `${key} {
|
|
11
11
|
"${value}",
|
|
12
12
|
}
|
|
13
13
|
`
|
|
14
|
-
|
|
14
|
+
else if (typeof value === 'string')
|
|
15
15
|
defaultContent += `${key} "${value}"
|
|
16
16
|
`
|
|
17
|
-
|
|
18
|
-
}
|
|
17
|
+
else throw new Error('Invalid value type')
|
|
19
18
|
return defaultContent
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
export const createFxmanifest = async (content?: FileContent) => {
|
|
23
|
-
await writeFile('fxmanifest.lua', content
|
|
22
|
+
await writeFile('fxmanifest.lua', content ?? generateContent())
|
|
24
23
|
}
|
|
@@ -6,4 +6,6 @@
|
|
|
6
6
|
* @example
|
|
7
7
|
* foo().catch(raise)
|
|
8
8
|
*/
|
|
9
|
-
export const raise = (error: unknown, cause?: unknown): never => {
|
|
9
|
+
export const raise = (error: unknown, cause?: unknown): never => {
|
|
10
|
+
throw new Error(String(error), { cause })
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lenix",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4",
|
|
4
4
|
"description": "The All-in-one Package",
|
|
5
5
|
"author": "Lenix",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"files": [
|
|
34
34
|
"modules/src",
|
|
35
|
+
"format",
|
|
35
36
|
"oop",
|
|
36
37
|
"lint/dist"
|
|
37
38
|
],
|
|
@@ -40,10 +41,7 @@
|
|
|
40
41
|
"lenix": "./index.ts"
|
|
41
42
|
},
|
|
42
43
|
"dependencies": {
|
|
43
|
-
"@clack/prompts": "^1.1.0"
|
|
44
|
-
"eslint-plugin-import": "^2.32.0",
|
|
45
|
-
"eslint-plugin-react": "^7.37.5",
|
|
46
|
-
"eslint-plugin-react-hooks": "^7.0.1"
|
|
44
|
+
"@clack/prompts": "^1.1.0"
|
|
47
45
|
},
|
|
48
46
|
"devDependencies": {
|
|
49
47
|
"@eslint/js": "^10.0.1",
|