@felixicaza/mrm-presets 0.1.0 → 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 +21 -0
- package/README.md +21 -11
- package/{dist/config.json → config.json} +1 -0
- package/lint/index.js +110 -0
- package/npmrc/index.js +16 -0
- package/package.json +13 -12
- package/pnpm-workspace/index.js +17 -0
- package/dist/npmrc/index.js +0 -16
- package/dist/package.json +0 -32
- package/dist/pnpm-workspace/index.js +0 -17
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[](https://npmx.dev/package/@felixicaza/mrm-presets)
|
|
2
2
|
|
|
3
3
|
# 🛠️ @felixicaza/mrm-presets
|
|
4
4
|
|
|
@@ -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
|
|
|
@@ -19,14 +19,30 @@ Para usar los presets de configuración, simplemente ejecuta los comandos de [mr
|
|
|
19
19
|
|
|
20
20
|
### 🔒 Security
|
|
21
21
|
|
|
22
|
+
Linux/MacOS:
|
|
23
|
+
|
|
22
24
|
```sh
|
|
23
25
|
$ npx mrm security --preset @felixicaza/mrm-presets
|
|
24
26
|
```
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
Windows:
|
|
29
|
+
|
|
30
|
+
```powershell
|
|
31
|
+
$ npm exec --package=@felixicaza/mrm-presets --package=mrm -- mrm security --preset @felixicaza/mrm-presets
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### ⚓ Lint
|
|
35
|
+
|
|
36
|
+
Linux/MacOS:
|
|
27
37
|
|
|
28
38
|
```sh
|
|
29
|
-
$ npx mrm
|
|
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
|
|
30
46
|
```
|
|
31
47
|
|
|
32
48
|
## 📚 Proyectos Relacionados
|
|
@@ -45,13 +61,7 @@ Las contribuciones a este repo no son necesarias, pero son bienvenidas. Igualmen
|
|
|
45
61
|
Para obtener este paquete de manera sencilla y sin el historial de Git por detrás, puedes usar [`giget`](https://github.com/unjs/giget) con el siguiente comando:
|
|
46
62
|
|
|
47
63
|
```sh
|
|
48
|
-
$ npx giget@latest gh:felixicaza/configs/packages/mrm-presets
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Instalar las dependencias de desarrollo:
|
|
52
|
-
|
|
53
|
-
```sh
|
|
54
|
-
$ npm install tsdown @felixicaza/tsdown-config vitest -D
|
|
64
|
+
$ npx giget@latest gh:felixicaza/configs/packages/mrm-presets mrm-presets
|
|
55
65
|
```
|
|
56
66
|
|
|
57
67
|
## 📄 Licencia
|
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/npmrc/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const { lines } = require('mrm-core')
|
|
2
|
+
|
|
3
|
+
function task() {
|
|
4
|
+
lines('.npmrc')
|
|
5
|
+
.add([
|
|
6
|
+
'save-exact = true',
|
|
7
|
+
'ignore-scripts = true',
|
|
8
|
+
'allow-git = none',
|
|
9
|
+
'min-release-age = 2',
|
|
10
|
+
'strict-peer-deps = true'
|
|
11
|
+
])
|
|
12
|
+
.save()
|
|
13
|
+
}
|
|
14
|
+
task.description = 'Adds npmrc security configuration'
|
|
15
|
+
|
|
16
|
+
module.exports = task
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@felixicaza/mrm-presets",
|
|
3
|
-
"version": "0.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",
|
|
7
7
|
"preset",
|
|
8
|
-
"mrm-
|
|
8
|
+
"mrm-presets"
|
|
9
9
|
],
|
|
10
10
|
"homepage": "https://github.com/felixicaza/configs/tree/main/packages/mrm-presets#readme",
|
|
11
11
|
"bugs": {
|
|
@@ -13,24 +13,25 @@
|
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "git+https://github.com/felixicaza/configs.git"
|
|
16
|
+
"url": "git+https://github.com/felixicaza/configs.git",
|
|
17
|
+
"directory": "packages/mrm-presets"
|
|
17
18
|
},
|
|
18
19
|
"license": "MIT",
|
|
19
20
|
"author": "Felix Icaza <fx.joliett17@gmail.com>",
|
|
20
21
|
"sideEffects": false,
|
|
21
|
-
"type": "
|
|
22
|
-
"main": "
|
|
22
|
+
"type": "commonjs",
|
|
23
|
+
"main": "config.json",
|
|
23
24
|
"files": [
|
|
24
|
-
"
|
|
25
|
+
"**/index.js"
|
|
25
26
|
],
|
|
26
|
-
"scripts": {
|
|
27
|
-
"build": "tsdown",
|
|
28
|
-
"dev": "tsdown --watch"
|
|
29
|
-
},
|
|
30
27
|
"dependencies": {
|
|
31
28
|
"mrm-core": "7.1.22"
|
|
32
29
|
},
|
|
33
30
|
"devDependencies": {
|
|
34
|
-
"
|
|
31
|
+
"mrm": "4.1.22"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"test": "node ./scripts/test.js --interactive",
|
|
35
|
+
"test:ci": "node ./scripts/test.js"
|
|
35
36
|
}
|
|
36
|
-
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const { yaml } = require('mrm-core')
|
|
2
|
+
|
|
3
|
+
function task() {
|
|
4
|
+
yaml('pnpm-workspace.yaml')
|
|
5
|
+
.merge({
|
|
6
|
+
blockExoticSubdeps: true,
|
|
7
|
+
autoInstallPeers: false,
|
|
8
|
+
minimumReleaseAge: 2880,
|
|
9
|
+
trustPolicy: 'no-downgrade',
|
|
10
|
+
strictPeerDependencies: true,
|
|
11
|
+
strictDepBuilds: true
|
|
12
|
+
})
|
|
13
|
+
.save()
|
|
14
|
+
}
|
|
15
|
+
task.description = 'Adds pnpm workspace security configuration'
|
|
16
|
+
|
|
17
|
+
module.exports = task
|
package/dist/npmrc/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
let mrm_core = require("mrm-core");
|
|
2
|
-
|
|
3
|
-
//#region src/npmrc.ts
|
|
4
|
-
function task() {
|
|
5
|
-
(0, mrm_core.lines)(".npmrc").add([
|
|
6
|
-
"save-exact = true",
|
|
7
|
-
"ignore-scripts = true",
|
|
8
|
-
"allow-git = none",
|
|
9
|
-
"min-release-age = 2",
|
|
10
|
-
"strict-peer-deps = true"
|
|
11
|
-
]).save();
|
|
12
|
-
}
|
|
13
|
-
task.description = "Adds npmrc security configuration";
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
|
-
module.exports = task;
|
package/dist/package.json
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@felixicaza/mrm-presets",
|
|
3
|
-
"version": "0.1.0",
|
|
4
|
-
"description": "Una colección de presets de mrm para configuraciones automáticas.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"mrm",
|
|
7
|
-
"preset",
|
|
8
|
-
"mrm-preset"
|
|
9
|
-
],
|
|
10
|
-
"homepage": "https://github.com/felixicaza/configs/tree/main/packages/mrm-presets#readme",
|
|
11
|
-
"bugs": {
|
|
12
|
-
"url": "https://github.com/felixicaza/configs/issues"
|
|
13
|
-
},
|
|
14
|
-
"repository": {
|
|
15
|
-
"type": "git",
|
|
16
|
-
"url": "git+https://github.com/felixicaza/configs.git"
|
|
17
|
-
},
|
|
18
|
-
"license": "MIT",
|
|
19
|
-
"author": "Felix Icaza <fx.joliett17@gmail.com>",
|
|
20
|
-
"sideEffects": false,
|
|
21
|
-
"type": "module",
|
|
22
|
-
"main": "./dist/config.json",
|
|
23
|
-
"files": [
|
|
24
|
-
"dist"
|
|
25
|
-
],
|
|
26
|
-
"dependencies": {
|
|
27
|
-
"mrm-core": "7.1.22"
|
|
28
|
-
},
|
|
29
|
-
"devDependencies": {
|
|
30
|
-
"@felixicaza/tsdown-config": "workspace:*"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
let mrm_core = require("mrm-core");
|
|
2
|
-
|
|
3
|
-
//#region src/pnpm-workpace.ts
|
|
4
|
-
function task() {
|
|
5
|
-
(0, mrm_core.yaml)("pnpm-workspace.yaml").merge([
|
|
6
|
-
"blockExoticSubdeps: true",
|
|
7
|
-
"autoInstallPeers: false",
|
|
8
|
-
"minimumReleaseAge: 2880",
|
|
9
|
-
"trustPolicy: no-downgrade",
|
|
10
|
-
"strictPeerDependencies: true",
|
|
11
|
-
"strictDepBuilds: true"
|
|
12
|
-
]).save();
|
|
13
|
-
}
|
|
14
|
-
task.description = "Adds pnpm workspace security configuration";
|
|
15
|
-
|
|
16
|
-
//#endregion
|
|
17
|
-
module.exports = task;
|