incur 0.3.5 → 0.3.7
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 +61 -0
- package/dist/Cli.d.ts +15 -0
- package/dist/Cli.d.ts.map +1 -1
- package/dist/Cli.js +300 -25
- package/dist/Cli.js.map +1 -1
- package/dist/Filter.js +0 -18
- package/dist/Filter.js.map +1 -1
- package/dist/Help.d.ts +4 -0
- package/dist/Help.d.ts.map +1 -1
- package/dist/Help.js +17 -14
- package/dist/Help.js.map +1 -1
- package/dist/Parser.d.ts +2 -0
- package/dist/Parser.d.ts.map +1 -1
- package/dist/Parser.js +69 -37
- package/dist/Parser.js.map +1 -1
- package/dist/bin.d.ts +1 -0
- package/dist/bin.d.ts.map +1 -1
- package/dist/bin.js +17 -2
- package/dist/bin.js.map +1 -1
- package/dist/internal/command.d.ts +2 -0
- package/dist/internal/command.d.ts.map +1 -1
- package/dist/internal/command.js +1 -0
- package/dist/internal/command.js.map +1 -1
- package/dist/internal/configSchema.d.ts +8 -0
- package/dist/internal/configSchema.d.ts.map +1 -0
- package/dist/internal/configSchema.js +57 -0
- package/dist/internal/configSchema.js.map +1 -0
- package/dist/internal/helpers.d.ts +9 -0
- package/dist/internal/helpers.d.ts.map +1 -0
- package/dist/internal/helpers.js +39 -0
- package/dist/internal/helpers.js.map +1 -0
- package/examples/npm/.npmrc.json +21 -0
- package/examples/npm/config.schema.json +137 -0
- package/package.json +1 -1
- package/src/Cli.test-d.ts +39 -0
- package/src/Cli.test.ts +714 -25
- package/src/Cli.ts +353 -27
- package/src/Filter.ts +0 -17
- package/src/Help.test.ts +66 -0
- package/src/Help.ts +20 -13
- package/src/Openapi.test.ts +6 -1
- package/src/Parser.test-d.ts +22 -0
- package/src/Parser.test.ts +89 -0
- package/src/Parser.ts +86 -35
- package/src/bin.ts +21 -2
- package/src/e2e.test.ts +22 -19
- package/src/internal/command.ts +3 -0
- package/src/internal/configSchema.test.ts +193 -0
- package/src/internal/configSchema.ts +66 -0
- package/src/internal/helpers.test.ts +54 -0
- package/src/internal/helpers.ts +41 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"additionalProperties": false,
|
|
4
|
+
"properties": {
|
|
5
|
+
"$schema": {
|
|
6
|
+
"type": "string"
|
|
7
|
+
},
|
|
8
|
+
"commands": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"additionalProperties": false,
|
|
11
|
+
"properties": {
|
|
12
|
+
"install": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"additionalProperties": false,
|
|
15
|
+
"properties": {
|
|
16
|
+
"options": {
|
|
17
|
+
"type": "object",
|
|
18
|
+
"additionalProperties": false,
|
|
19
|
+
"properties": {
|
|
20
|
+
"saveDev": {
|
|
21
|
+
"description": "Save as dev dependency",
|
|
22
|
+
"type": "boolean"
|
|
23
|
+
},
|
|
24
|
+
"saveExact": {
|
|
25
|
+
"description": "Save exact version",
|
|
26
|
+
"type": "boolean"
|
|
27
|
+
},
|
|
28
|
+
"global": {
|
|
29
|
+
"description": "Install globally",
|
|
30
|
+
"type": "boolean"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"info": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"additionalProperties": false
|
|
39
|
+
},
|
|
40
|
+
"init": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"additionalProperties": false,
|
|
43
|
+
"properties": {
|
|
44
|
+
"options": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"additionalProperties": false,
|
|
47
|
+
"properties": {
|
|
48
|
+
"yes": {
|
|
49
|
+
"type": "boolean",
|
|
50
|
+
"description": "Skip prompts and use defaults"
|
|
51
|
+
},
|
|
52
|
+
"scope": {
|
|
53
|
+
"description": "Package scope",
|
|
54
|
+
"type": "string"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"publish": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"additionalProperties": false,
|
|
63
|
+
"properties": {
|
|
64
|
+
"options": {
|
|
65
|
+
"type": "object",
|
|
66
|
+
"additionalProperties": false,
|
|
67
|
+
"properties": {
|
|
68
|
+
"tag": {
|
|
69
|
+
"default": "latest",
|
|
70
|
+
"description": "Distribution tag",
|
|
71
|
+
"type": "string"
|
|
72
|
+
},
|
|
73
|
+
"access": {
|
|
74
|
+
"default": "public",
|
|
75
|
+
"description": "Package access level",
|
|
76
|
+
"type": "string",
|
|
77
|
+
"enum": [
|
|
78
|
+
"public",
|
|
79
|
+
"restricted"
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
"dryRun": {
|
|
83
|
+
"type": "boolean",
|
|
84
|
+
"description": "Report what would be published"
|
|
85
|
+
},
|
|
86
|
+
"otp": {
|
|
87
|
+
"description": "One-time password for 2FA",
|
|
88
|
+
"type": "string"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"run": {
|
|
95
|
+
"type": "object",
|
|
96
|
+
"additionalProperties": false
|
|
97
|
+
},
|
|
98
|
+
"uninstall": {
|
|
99
|
+
"type": "object",
|
|
100
|
+
"additionalProperties": false,
|
|
101
|
+
"properties": {
|
|
102
|
+
"options": {
|
|
103
|
+
"type": "object",
|
|
104
|
+
"additionalProperties": false,
|
|
105
|
+
"properties": {
|
|
106
|
+
"global": {
|
|
107
|
+
"type": "boolean",
|
|
108
|
+
"description": "Remove global package"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"outdated": {
|
|
115
|
+
"type": "object",
|
|
116
|
+
"additionalProperties": false,
|
|
117
|
+
"properties": {
|
|
118
|
+
"options": {
|
|
119
|
+
"type": "object",
|
|
120
|
+
"additionalProperties": false,
|
|
121
|
+
"properties": {
|
|
122
|
+
"global": {
|
|
123
|
+
"type": "boolean",
|
|
124
|
+
"description": "Check global packages"
|
|
125
|
+
},
|
|
126
|
+
"long": {
|
|
127
|
+
"type": "boolean",
|
|
128
|
+
"description": "Show extended information"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
package/package.json
CHANGED
package/src/Cli.test-d.ts
CHANGED
|
@@ -289,3 +289,42 @@ test('run() context exposes format metadata', () => {
|
|
|
289
289
|
},
|
|
290
290
|
})
|
|
291
291
|
})
|
|
292
|
+
|
|
293
|
+
test('create() accepts config-file defaults options', () => {
|
|
294
|
+
Cli.create('test', {
|
|
295
|
+
config: {},
|
|
296
|
+
})
|
|
297
|
+
|
|
298
|
+
Cli.create('test', {
|
|
299
|
+
config: { flag: 'config' },
|
|
300
|
+
})
|
|
301
|
+
|
|
302
|
+
Cli.create('test', {
|
|
303
|
+
config: { files: ['.myrc.json', '~/.config/my/config.json'] },
|
|
304
|
+
})
|
|
305
|
+
|
|
306
|
+
Cli.create('test', {
|
|
307
|
+
config: {
|
|
308
|
+
flag: 'config',
|
|
309
|
+
files: ['config.toml'],
|
|
310
|
+
loader: async (path) => {
|
|
311
|
+
if (!path) return undefined
|
|
312
|
+
return { key: 'value' }
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
})
|
|
316
|
+
|
|
317
|
+
Cli.create('test', {
|
|
318
|
+
config: { loader: async () => ({ key: 'value' }) },
|
|
319
|
+
})
|
|
320
|
+
|
|
321
|
+
Cli.create('test', {
|
|
322
|
+
// @ts-expect-error — flag must be a string
|
|
323
|
+
config: { flag: true },
|
|
324
|
+
})
|
|
325
|
+
|
|
326
|
+
Cli.create('test', {
|
|
327
|
+
// @ts-expect-error — files must be string[]
|
|
328
|
+
config: { files: [42] },
|
|
329
|
+
})
|
|
330
|
+
})
|