@foxford/cli 1.0.0-beta-6f7848f0-20250318 → 1.1.0-beta-0acd9fac-20250513
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.mdx +56 -1
- package/fox.d.ts +1031 -0
- package/fox.js +682 -643
- package/fox.js.map +1 -1
- package/package.json +7 -4
package/README.mdx
CHANGED
|
@@ -35,4 +35,59 @@ npx fox optimize ./src/packages/navigation/**/*.png --list
|
|
|
35
35
|
|
|
36
36
|
Ваши ресурсы будут оптимизированы и по завершению будет предоставлена сводная таблица
|
|
37
37
|
|
|
38
|
-

|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
## Плагины
|
|
41
|
+
|
|
42
|
+
Fox-cli может быть расширен плагинами. Плагин - это пакет, который установлен в проекте и имеет в своем package.json в секции `keywords` значение `foxford-cli-plugin`
|
|
43
|
+
|
|
44
|
+
Пример:
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"name": "@foxford/cli-analyze-plugin",
|
|
49
|
+
"version": "1.0.0",
|
|
50
|
+
"description": "Package cli-analyze-plugin",
|
|
51
|
+
"keywords": [
|
|
52
|
+
"foxford-cli-plugin"
|
|
53
|
+
],
|
|
54
|
+
"license": "MIT",
|
|
55
|
+
"exports": {
|
|
56
|
+
".": {
|
|
57
|
+
"import": "./dist/index.mjs",
|
|
58
|
+
"types": "./dist/index.d.ts",
|
|
59
|
+
"default": "./dist/index.js"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"commander": "13.1.0"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
К примеру исходный код точки входа плагина
|
|
69
|
+
|
|
70
|
+
```ts title="index.mjs"
|
|
71
|
+
import { Command } from 'commander'
|
|
72
|
+
import type { Program } from 'commander'
|
|
73
|
+
|
|
74
|
+
export default function (program: Program) {
|
|
75
|
+
const command = new Command()
|
|
76
|
+
|
|
77
|
+
const contextifyCommand = new Command('awesome')
|
|
78
|
+
.description('Инструмент')
|
|
79
|
+
.requiredOption('-p, --param <path>', 'Мой параметр')
|
|
80
|
+
.action((options) => {
|
|
81
|
+
const { param } = options
|
|
82
|
+
// код экшена
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
program.addCommand(contextifyCommand)
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
После установки плагина команда CLI автоматически зарегистрирует вашу команду и она станет доступна для выполнения:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npx fox awesome -p TEST
|
|
93
|
+
```
|