@felixicaza/mrm-presets 0.1.1 → 0.1.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 - PRESENT, Felix Icaza <https://github.com/felixicaza>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -11,7 +11,7 @@ Una colección de [presets de mrm](https://mrm.js.org/docs/making-presets) para
11
11
  ## ✨ Características
12
12
 
13
13
  - 🔒 Medidas de seguridad ante afectaciones a la cadena de suministro mediante `.npmrc` y `pnpm-workspace.yaml`.
14
- - ⚙️ Configuración automática de Oxlint.
14
+ - ⚙️ Configuración automática de Oxlint, ESLint y Precommit Hooks.
15
15
 
16
16
  ## ⚡ Uso
17
17
 
@@ -31,10 +31,18 @@ Windows:
31
31
  $ npm exec --package=@felixicaza/mrm-presets --package=mrm -- mrm security --preset @felixicaza/mrm-presets
32
32
  ```
33
33
 
34
- ### ⚓ Oxlint
34
+ ### ⚓ Lint
35
+
36
+ Linux/MacOS:
35
37
 
36
38
  ```sh
37
- $ npx mrm oxlint --preset @felixicaza/mrm-presets
39
+ $ npx mrm lint --preset @felixicaza/mrm-presets
40
+ ```
41
+
42
+ Windows:
43
+
44
+ ```powershell
45
+ $ npm exec --package=@felixicaza/mrm-presets --package=mrm -- mrm lint --preset @felixicaza/mrm-presets
38
46
  ```
39
47
 
40
48
  ## 📚 Proyectos Relacionados
package/config.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "aliases": {
3
+ "all": ["npmrc", "pnpm-workspace", "lint"],
3
4
  "security": ["npmrc", "pnpm-workspace"]
4
5
  }
5
6
  }
package/lint/index.js ADDED
@@ -0,0 +1,110 @@
1
+ const { lines, yaml, json, packageJson, install } = require('mrm-core')
2
+
3
+ const oxlintPackages = ['@felixicaza/oxlint-config', 'oxlint']
4
+ const precommitsPackages = ['simple-git-hooks', 'nano-staged']
5
+ const eslintPackages = ['@felixicaza/eslint-config', 'eslint@9', 'jiti']
6
+
7
+ function task({ precommits, eslintConfig, usingAstro }) {
8
+ lines('oxlint.config.ts')
9
+ .add([
10
+ 'import { felixicaza } from \'@felixicaza/oxlint-config\'',
11
+ '',
12
+ 'export default felixicaza()'
13
+ ])
14
+ .save()
15
+
16
+ packageJson()
17
+ .setScript('linx', 'oxlint .')
18
+ .setScript('lint:fix', 'oxlint . --fix')
19
+ .save()
20
+
21
+ json('.vscode/extensions.json', {})
22
+ .merge({
23
+ recommendations: ['oxc.oxc-vscode']
24
+ })
25
+ .save()
26
+
27
+ json('.vscode/settings.json', {})
28
+ .merge({
29
+ 'prettier.enable': false,
30
+ 'editor.codeActionsOnSave': {
31
+ 'source.fixAll.oxc': 'explicit',
32
+ 'source.organizeImports': 'never'
33
+ }
34
+ })
35
+ .save()
36
+
37
+ install(oxlintPackages, { dev: true, pnpm: true })
38
+
39
+ if (precommits.toLowerCase() === 'y') {
40
+ packageJson()
41
+ .setScript('prepare', 'simple-git-hooks')
42
+ .merge({
43
+ 'simple-git-hooks': {
44
+ 'pre-commit': 'pnpm nano-staged'
45
+ },
46
+ 'nano-staged': {
47
+ '*': 'pnpm lint:fix'
48
+ }
49
+ })
50
+ .save()
51
+
52
+ yaml('pnpm-workspace.yaml')
53
+ .merge({
54
+ allowBuilds: {
55
+ 'simple-git-hooks': true
56
+ }
57
+ })
58
+ .save()
59
+
60
+ install(precommitsPackages, { dev: true, pnpm: true })
61
+ }
62
+
63
+ if (eslintConfig.toLowerCase() === 'y') {
64
+ lines('eslint.config.ts')
65
+ .add([
66
+ 'import { felixicaza } from \'@felixicaza/eslint-config\'',
67
+ '',
68
+ `export default felixicaza(${usingAstro.toLowerCase() === 'n' ? '{ astro: false }' : ''})`
69
+ ])
70
+ .save()
71
+
72
+ json('.vscode/settings.json', {})
73
+ .merge({
74
+ 'eslint.validate': [
75
+ 'astro',
76
+ 'json',
77
+ 'jsonc',
78
+ 'json5',
79
+ 'yaml'
80
+ ]
81
+ })
82
+ .save()
83
+ }
84
+
85
+ install(eslintPackages, { dev: true, pnpm: true })
86
+ }
87
+ task.description = 'Adds linter configurations'
88
+
89
+ module.exports = task
90
+
91
+ module.exports.parameters = {
92
+ precommits: {
93
+ type: 'input',
94
+ message: 'Setup precommits? (y/n)',
95
+ default: 'y',
96
+ validate: (value) => ['y', 'n'].includes(value.toLowerCase()) || 'Please enter y or n'
97
+ },
98
+ eslintConfig: {
99
+ type: 'input',
100
+ message: 'Want to set up ESLint? (y/n)',
101
+ default: 'y',
102
+ validate: (value) => ['y', 'n'].includes(value.toLowerCase()) || 'Please enter y or n'
103
+ },
104
+ usingAstro: {
105
+ type: 'input',
106
+ message: 'Using Astro? (y/n)',
107
+ default: 'n',
108
+ validate: (value) => ['y', 'n'].includes(value.toLowerCase()) || 'Please enter y or n'
109
+ }
110
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@felixicaza/mrm-presets",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Una colección de presets de mrm para configuraciones automáticas.",
5
5
  "keywords": [
6
6
  "mrm",
@@ -21,13 +21,17 @@
21
21
  "sideEffects": false,
22
22
  "type": "commonjs",
23
23
  "main": "config.json",
24
- "scripts": {
25
- "test": "mkdir -p .temp; cd .temp; mrm security --dir .."
26
- },
24
+ "files": [
25
+ "**/index.js"
26
+ ],
27
27
  "dependencies": {
28
28
  "mrm-core": "7.1.22"
29
29
  },
30
30
  "devDependencies": {
31
31
  "mrm": "4.1.22"
32
+ },
33
+ "scripts": {
34
+ "test": "node ./scripts/test.js --interactive",
35
+ "test:ci": "node ./scripts/test.js"
32
36
  }
33
- }
37
+ }