vovk-cli 0.0.1-draft.362 → 0.0.1-draft.364
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/dist/index.mjs
CHANGED
|
@@ -156,12 +156,12 @@ program
|
|
|
156
156
|
.alias('n')
|
|
157
157
|
.description('Create new components. "vovk new [...components] [segmentName/]moduleName" to create a new module or "vovk new segment [segmentName]" to create a new segment')
|
|
158
158
|
.option('-o, --overwrite', 'overwrite existing files')
|
|
159
|
-
.option('--
|
|
160
|
-
.option('--
|
|
161
|
-
.option('--
|
|
162
|
-
.option('--no-segment-update', 'do not update segment files when creating a new module')
|
|
159
|
+
.option('--static', '(new segment only) if the segment is static')
|
|
160
|
+
.option('--template, --templates <templates...>', '(new module only) override config template; accepts an array of strings that correspond the order of the components')
|
|
161
|
+
.option('--out, --out-dir <dirname>', '(new module only) override outDir in template file; relative to the root of the project')
|
|
162
|
+
.option('--no-segment-update', '(new module only) do not update segment files when creating a new module')
|
|
163
|
+
.option('--empty', '(new module only) create an empty module')
|
|
163
164
|
.option('--dry-run', 'do not write files to disk')
|
|
164
|
-
.option('--static', 'if the segment is static')
|
|
165
165
|
.option('--log-level <level>', 'set the log level')
|
|
166
166
|
.action(async (components, newOptions) => newComponents(components, await getProjectInfo({
|
|
167
167
|
logLevel: newOptions.logLevel,
|
|
@@ -4,12 +4,17 @@ import getRelativeSrcRoot from '../getProjectInfo/getConfig/getRelativeSrcRoot.m
|
|
|
4
4
|
function getCode(validationLibrary) {
|
|
5
5
|
if (validationLibrary === 'valibot') {
|
|
6
6
|
return `
|
|
7
|
-
import { createStandardValidation
|
|
7
|
+
import { createStandardValidation } from 'vovk';
|
|
8
8
|
import { toJsonSchema } from '@valibot/to-json-schema';
|
|
9
|
-
import * as v from 'valibot';
|
|
10
9
|
|
|
11
10
|
const withValibot = createStandardValidation({
|
|
12
|
-
toJSONSchema: (model
|
|
11
|
+
toJSONSchema: (model) => toJsonSchema(model, {
|
|
12
|
+
overrideSchema(context) {
|
|
13
|
+
if (context.valibotSchema.type === 'file') {
|
|
14
|
+
return { type: 'string', format: 'binary' };
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
}),
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
export default withValibot;
|
|
@@ -18,10 +23,18 @@ export default withValibot;
|
|
|
18
23
|
if (validationLibrary === 'arktype') {
|
|
19
24
|
return `
|
|
20
25
|
import { createStandardValidation } from 'vovk';
|
|
21
|
-
import { type } from 'arktype';
|
|
26
|
+
import type { type } from 'arktype';
|
|
22
27
|
|
|
23
28
|
const withArk = createStandardValidation({
|
|
24
|
-
toJSONSchema: (model: type) => model.toJsonSchema(
|
|
29
|
+
toJSONSchema: (model: type) => model.toJsonSchema({
|
|
30
|
+
fallback: {
|
|
31
|
+
proto: (ctx) => ctx.proto === File ? {
|
|
32
|
+
type: "string",
|
|
33
|
+
format: "binary",
|
|
34
|
+
} : ctx.base,
|
|
35
|
+
default: (ctx) => ctx.base
|
|
36
|
+
}
|
|
37
|
+
})
|
|
25
38
|
});
|
|
26
39
|
|
|
27
40
|
export default withArk;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vovk-cli",
|
|
3
|
-
"version": "0.0.1-draft.
|
|
3
|
+
"version": "0.0.1-draft.364",
|
|
4
4
|
"bin": {
|
|
5
5
|
"vovk": "./dist/index.mjs"
|
|
6
6
|
},
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://vovk.dev",
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"vovk": "^3.0.0-draft.
|
|
38
|
+
"vovk": "^3.0.0-draft.420",
|
|
39
39
|
"vovk-ajv": "^0.0.0-draft.102",
|
|
40
40
|
"vovk-client": "^0.0.4-draft.130",
|
|
41
41
|
"vovk-python": "^0.0.1-draft.72",
|