@atcute/lex-cli 1.1.2 → 2.0.0
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/cli.mjs +1 -1
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +77 -0
- package/dist/cli.js.map +1 -0
- package/dist/codegen.d.ts +23 -0
- package/dist/codegen.js +552 -0
- package/dist/codegen.js.map +1 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.js +3 -125
- package/dist/index.js.map +1 -1
- package/dist/schema.d.ts +816 -1944
- package/dist/schema.js +152 -93
- package/dist/schema.js.map +1 -1
- package/package.json +9 -5
- package/src/cli.ts +100 -0
- package/src/codegen.ts +726 -0
- package/src/index.ts +9 -150
- package/src/schema.ts +391 -150
- package/dist/generator.d.ts +0 -7
- package/dist/generator.js +0 -579
- package/dist/generator.js.map +0 -1
- package/src/generator.ts +0 -664
package/dist/schema.js
CHANGED
|
@@ -1,174 +1,233 @@
|
|
|
1
1
|
import * as v from '@badrap/valita';
|
|
2
|
-
|
|
2
|
+
// tsc dislikes this schema with the amount of type expansion that happens here.
|
|
3
|
+
// the interface declaration allows tsc to just reference it instead of
|
|
4
|
+
// expanding on every type reference.
|
|
5
|
+
const _integer = v
|
|
3
6
|
.number()
|
|
4
|
-
.assert((
|
|
5
|
-
|
|
7
|
+
.assert((input) => input >= 0 && Number.isSafeInteger(input), `expected non-negative integer`);
|
|
8
|
+
const integer = _integer;
|
|
9
|
+
const _lexBoolean = v.object({
|
|
6
10
|
type: v.literal('boolean'),
|
|
7
11
|
description: v.string().optional(),
|
|
8
12
|
default: v.boolean().optional(),
|
|
9
13
|
const: v.boolean().optional(),
|
|
10
14
|
});
|
|
11
|
-
export const
|
|
15
|
+
export const lexBoolean = _lexBoolean;
|
|
16
|
+
const _lexInteger = v.object({
|
|
12
17
|
type: v.literal('integer'),
|
|
13
18
|
description: v.string().optional(),
|
|
14
|
-
default:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
default: integer.optional(),
|
|
20
|
+
minimum: integer.optional(),
|
|
21
|
+
maximum: integer.optional(),
|
|
22
|
+
enum: v.array(integer).optional(),
|
|
23
|
+
const: integer.optional(),
|
|
19
24
|
});
|
|
20
|
-
export const
|
|
25
|
+
export const lexInteger = _lexInteger;
|
|
26
|
+
const _lexStringFormat = v.union(v.literal('datetime'), v.literal('uri'), v.literal('at-uri'), v.literal('did'), v.literal('handle'), v.literal('at-identifier'), v.literal('nsid'), v.literal('cid'), v.literal('language'), v.literal('tid'), v.literal('record-key'));
|
|
27
|
+
export const lexStringFormat = _lexStringFormat;
|
|
28
|
+
const _lexString = v.object({
|
|
21
29
|
type: v.literal('string'),
|
|
30
|
+
format: lexStringFormat.optional(),
|
|
22
31
|
description: v.string().optional(),
|
|
23
|
-
format: v
|
|
24
|
-
.union(v.literal('at-identifier'), v.literal('at-uri'), v.literal('cid'), v.literal('datetime'), v.literal('did'), v.literal('handle'), v.literal('language'), v.literal('nsid'), v.literal('record-key'), v.literal('tid'), v.literal('uri'))
|
|
25
|
-
.optional(),
|
|
26
32
|
default: v.string().optional(),
|
|
27
|
-
|
|
33
|
+
minLength: integer.optional(),
|
|
34
|
+
maxLength: integer.optional(),
|
|
35
|
+
minGraphemes: integer.optional(),
|
|
36
|
+
maxGraphemes: integer.optional(),
|
|
28
37
|
enum: v.array(v.string()).optional(),
|
|
38
|
+
const: v.string().optional(),
|
|
29
39
|
knownValues: v.array(v.string()).optional(),
|
|
30
|
-
maxLength: integerType.optional(),
|
|
31
|
-
minLength: integerType.optional(),
|
|
32
|
-
maxGraphemes: integerType.optional(),
|
|
33
|
-
minGraphemes: integerType.optional(),
|
|
34
40
|
});
|
|
35
|
-
export const
|
|
41
|
+
export const lexString = _lexString;
|
|
42
|
+
const _lexUnknown = v.object({
|
|
36
43
|
type: v.literal('unknown'),
|
|
37
44
|
description: v.string().optional(),
|
|
38
45
|
});
|
|
39
|
-
export const
|
|
40
|
-
|
|
46
|
+
export const lexUnknown = _lexUnknown;
|
|
47
|
+
const _lexPrimitive = v.union(lexBoolean, lexInteger, lexString, lexUnknown);
|
|
48
|
+
export const lexPrimitive = _lexPrimitive;
|
|
49
|
+
const _lexBytes = v.object({
|
|
41
50
|
type: v.literal('bytes'),
|
|
42
51
|
description: v.string().optional(),
|
|
43
|
-
|
|
44
|
-
|
|
52
|
+
minLength: integer.optional(),
|
|
53
|
+
maxLength: integer.optional(),
|
|
45
54
|
});
|
|
46
|
-
export const
|
|
55
|
+
export const lexBytes = _lexBytes;
|
|
56
|
+
const _lexCidLink = v.object({
|
|
47
57
|
type: v.literal('cid-link'),
|
|
48
58
|
description: v.string().optional(),
|
|
49
59
|
});
|
|
50
|
-
export const
|
|
51
|
-
|
|
60
|
+
export const lexCidLink = _lexCidLink;
|
|
61
|
+
const _lexIpldType = v.union(lexBytes, lexCidLink);
|
|
62
|
+
export const lexIpldType = _lexIpldType;
|
|
63
|
+
const REF_RE = /^(?=.)(?:[a-zA-Z](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+\.[a-zA-Z][a-zA-Z0-9]{0,62}?)?(?:#[a-zA-Z][a-zA-Z0-9_]{0,62}?)?$/;
|
|
64
|
+
const refString = v.string().assert((input) => REF_RE.test(input));
|
|
65
|
+
const _lexRef = v.object({
|
|
52
66
|
type: v.literal('ref'),
|
|
53
67
|
description: v.string().optional(),
|
|
54
|
-
ref:
|
|
68
|
+
ref: refString,
|
|
55
69
|
});
|
|
56
|
-
export const
|
|
57
|
-
|
|
70
|
+
export const lexRef = _lexRef;
|
|
71
|
+
const _lexRefUnion = v.object({
|
|
58
72
|
type: v.literal('union'),
|
|
59
73
|
description: v.string().optional(),
|
|
60
|
-
refs: v.array(
|
|
74
|
+
refs: v.array(refString),
|
|
61
75
|
closed: v.boolean().optional(() => false),
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
export const
|
|
76
|
+
});
|
|
77
|
+
export const lexRefUnion = _lexRefUnion;
|
|
78
|
+
const _lexRefVariant = v.union(lexRef, lexRefUnion);
|
|
79
|
+
export const lexRefVariant = _lexRefVariant;
|
|
80
|
+
const _lexBlob = v.object({
|
|
66
81
|
type: v.literal('blob'),
|
|
67
82
|
description: v.string().optional(),
|
|
68
83
|
accept: v.array(v.string()).optional(),
|
|
69
|
-
maxSize:
|
|
84
|
+
maxSize: integer.optional(),
|
|
70
85
|
});
|
|
71
|
-
export const
|
|
86
|
+
export const lexBlob = _lexBlob;
|
|
87
|
+
const _lexArray = v.object({
|
|
72
88
|
type: v.literal('array'),
|
|
73
89
|
description: v.string().optional(),
|
|
74
|
-
items: v.union(
|
|
75
|
-
|
|
76
|
-
|
|
90
|
+
items: v.union(lexPrimitive, lexIpldType, lexRefVariant, lexBlob),
|
|
91
|
+
minLength: integer.optional(),
|
|
92
|
+
maxLength: integer.optional(),
|
|
77
93
|
});
|
|
78
|
-
export const
|
|
79
|
-
|
|
94
|
+
export const lexArray = _lexArray;
|
|
95
|
+
const _lexPrimitiveArray = lexArray.extend({
|
|
96
|
+
items: lexPrimitive,
|
|
80
97
|
});
|
|
81
|
-
export const
|
|
98
|
+
export const lexPrimitiveArray = _lexPrimitiveArray;
|
|
99
|
+
const _lexToken = v.object({
|
|
82
100
|
type: v.literal('token'),
|
|
83
101
|
description: v.string().optional(),
|
|
84
102
|
});
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
103
|
+
export const lexToken = _lexToken;
|
|
104
|
+
const KEY_RE = /^[a-zA-Z][a-zA-Z0-9_]{0,62}?$/;
|
|
105
|
+
const refineObjectProperties = (input) => {
|
|
106
|
+
const { required = [], properties } = input;
|
|
107
|
+
for (const key in properties) {
|
|
108
|
+
if (!KEY_RE.test(key)) {
|
|
109
|
+
return v.err({
|
|
110
|
+
message: `invalid property key`,
|
|
111
|
+
path: ['properties', key],
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (required.length > 0) {
|
|
116
|
+
if (properties === undefined) {
|
|
117
|
+
return v.err({
|
|
118
|
+
message: `required fields specified but no properties defined`,
|
|
119
|
+
path: ['properties'],
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
for (const key of required) {
|
|
123
|
+
if (properties[key] === undefined) {
|
|
124
|
+
return v.err({
|
|
125
|
+
message: `required fields not defined`,
|
|
126
|
+
path: ['properties', key],
|
|
127
|
+
});
|
|
128
|
+
}
|
|
89
129
|
}
|
|
90
130
|
}
|
|
91
|
-
return v.ok(
|
|
131
|
+
return v.ok(input);
|
|
92
132
|
};
|
|
93
|
-
|
|
133
|
+
const _lexObject = v
|
|
94
134
|
.object({
|
|
95
135
|
type: v.literal('object'),
|
|
96
136
|
description: v.string().optional(),
|
|
97
|
-
required: v.array(v.string()).optional(
|
|
98
|
-
nullable: v.array(v.string()).optional(
|
|
99
|
-
properties: v.record(v.union(
|
|
137
|
+
required: v.array(v.string()).optional(),
|
|
138
|
+
nullable: v.array(v.string()).optional(),
|
|
139
|
+
properties: v.record(v.union(lexArray, lexPrimitive, lexIpldType, lexRefVariant, lexBlob)).optional(),
|
|
100
140
|
})
|
|
101
|
-
.chain(
|
|
102
|
-
export const
|
|
141
|
+
.chain(refineObjectProperties);
|
|
142
|
+
export const lexObject = _lexObject;
|
|
143
|
+
const _lexXrpcParameters = v
|
|
103
144
|
.object({
|
|
104
145
|
type: v.literal('params'),
|
|
105
146
|
description: v.string().optional(),
|
|
106
|
-
required: v.array(v.string()).optional(
|
|
107
|
-
properties: v.record(v.union(
|
|
147
|
+
required: v.array(v.string()).optional(),
|
|
148
|
+
properties: v.record(v.union(lexPrimitive, lexPrimitiveArray)).optional(),
|
|
108
149
|
})
|
|
109
|
-
.chain(
|
|
110
|
-
export const
|
|
150
|
+
.chain(refineObjectProperties);
|
|
151
|
+
export const lexXrpcParameters = _lexXrpcParameters;
|
|
152
|
+
const _lexXrpcBody = v.object({
|
|
111
153
|
description: v.string().optional(),
|
|
112
154
|
encoding: v.string(),
|
|
113
|
-
schema: v.union(
|
|
155
|
+
schema: v.union(lexRefVariant, lexObject).optional(),
|
|
114
156
|
});
|
|
115
|
-
export const
|
|
157
|
+
export const lexXrpcBody = _lexXrpcBody;
|
|
158
|
+
const _lexXrpcSubscriptionMessage = v.object({
|
|
116
159
|
description: v.string().optional(),
|
|
117
|
-
schema: v.union(
|
|
160
|
+
schema: v.union(lexRefVariant, lexObject).optional(),
|
|
118
161
|
});
|
|
119
|
-
export const
|
|
162
|
+
export const lexXrpcSubscriptionMessage = _lexXrpcSubscriptionMessage;
|
|
163
|
+
const _lexXrpcError = v.object({
|
|
120
164
|
name: v.string(),
|
|
121
165
|
description: v.string().optional(),
|
|
122
166
|
});
|
|
123
|
-
export const
|
|
167
|
+
export const lexXrpcError = _lexXrpcError;
|
|
168
|
+
const _lexXrpcQuery = v.object({
|
|
124
169
|
type: v.literal('query'),
|
|
125
170
|
description: v.string().optional(),
|
|
126
|
-
parameters:
|
|
127
|
-
output:
|
|
128
|
-
errors: v.array(
|
|
171
|
+
parameters: lexXrpcParameters.optional(),
|
|
172
|
+
output: lexXrpcBody.optional(),
|
|
173
|
+
errors: v.array(lexXrpcError).optional(),
|
|
129
174
|
});
|
|
130
|
-
export const
|
|
175
|
+
export const lexXrpcQuery = _lexXrpcQuery;
|
|
176
|
+
const _lexXrpcProcedure = v.object({
|
|
131
177
|
type: v.literal('procedure'),
|
|
132
178
|
description: v.string().optional(),
|
|
133
|
-
parameters:
|
|
134
|
-
input:
|
|
135
|
-
output:
|
|
136
|
-
errors: v.array(
|
|
179
|
+
parameters: lexXrpcParameters.optional(),
|
|
180
|
+
input: lexXrpcBody.optional(),
|
|
181
|
+
output: lexXrpcBody.optional(),
|
|
182
|
+
errors: v.array(lexXrpcError).optional(),
|
|
137
183
|
});
|
|
138
|
-
export const
|
|
184
|
+
export const lexXrpcProcedure = _lexXrpcProcedure;
|
|
185
|
+
const _lexXrpcSubscription = v.object({
|
|
139
186
|
type: v.literal('subscription'),
|
|
140
187
|
description: v.string().optional(),
|
|
141
|
-
parameters:
|
|
142
|
-
message:
|
|
143
|
-
errors: v.array(
|
|
188
|
+
parameters: lexXrpcParameters.optional(),
|
|
189
|
+
message: lexXrpcSubscriptionMessage.optional(),
|
|
190
|
+
errors: v.array(lexXrpcError).optional(),
|
|
144
191
|
});
|
|
145
|
-
export const
|
|
192
|
+
export const lexXrpcSubscription = _lexXrpcSubscription;
|
|
193
|
+
const LITERAL_KEY_RE = /^literal:(.+)$/;
|
|
194
|
+
const _lexRecord = v.object({
|
|
146
195
|
type: v.literal('record'),
|
|
147
196
|
description: v.string().optional(),
|
|
148
|
-
key: v
|
|
149
|
-
|
|
197
|
+
key: v
|
|
198
|
+
.union(v.literal('tid'), v.literal('nsid'), v.literal('any'), v.string().assert((input) => LITERAL_KEY_RE.test(input)))
|
|
199
|
+
.optional(() => 'any'),
|
|
200
|
+
record: lexObject,
|
|
150
201
|
});
|
|
151
|
-
export const
|
|
152
|
-
const
|
|
153
|
-
const
|
|
154
|
-
|
|
202
|
+
export const lexRecord = _lexRecord;
|
|
203
|
+
const _lexUserType = v.union(lexRecord, lexXrpcQuery, lexXrpcProcedure, lexXrpcSubscription, lexObject, lexArray, lexToken, lexIpldType, lexBlob, lexPrimitive);
|
|
204
|
+
export const lexUserType = _lexUserType;
|
|
205
|
+
const NSID_RE = /^[a-zA-Z](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?:\.[a-zA-Z](?:[a-zA-Z0-9]{0,62})?)$/;
|
|
206
|
+
const _lexiconDoc = v
|
|
155
207
|
.object({
|
|
156
208
|
lexicon: v.literal(1),
|
|
157
|
-
id:
|
|
158
|
-
revision:
|
|
209
|
+
id: v.string().assert((input) => NSID_RE.test(input), `must be valid nsid`),
|
|
210
|
+
revision: integer.optional(),
|
|
159
211
|
description: v.string().optional(),
|
|
160
|
-
defs: v.record(
|
|
212
|
+
// defs: v.record(v.pipe(v.string(), v.regex(/^[a-zA-Z][a-zA-Z0-9_]{0,62}?$/)), lexUserType),
|
|
213
|
+
defs: v.record(lexUserType),
|
|
161
214
|
})
|
|
162
|
-
.chain((
|
|
163
|
-
const defs =
|
|
164
|
-
for (const
|
|
165
|
-
const def = defs[
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
215
|
+
.chain((input) => {
|
|
216
|
+
const { defs } = input;
|
|
217
|
+
for (const key in defs) {
|
|
218
|
+
const def = defs[key];
|
|
219
|
+
if (key !== 'main' &&
|
|
220
|
+
(def.type === 'record' ||
|
|
221
|
+
def.type === 'procedure' ||
|
|
222
|
+
def.type === 'query' ||
|
|
223
|
+
def.type === 'subscription')) {
|
|
224
|
+
return v.err({
|
|
225
|
+
message: `records, procedures, queries and subscriptions must be the main definition`,
|
|
226
|
+
path: ['defs', key],
|
|
227
|
+
});
|
|
170
228
|
}
|
|
171
229
|
}
|
|
172
|
-
return v.ok(
|
|
230
|
+
return v.ok(input);
|
|
173
231
|
});
|
|
232
|
+
export const lexiconDoc = _lexiconDoc;
|
|
174
233
|
//# sourceMappingURL=schema.js.map
|
package/dist/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAEpC,MAAM,
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAEpC,gFAAgF;AAChF,uEAAuE;AACvE,qCAAqC;AAErC,MAAM,QAAQ,GAAG,CAAC;KAChB,MAAM,EAAE;KACR,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,K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IAAI,IAAI,EAAE,CAAC;QACxB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QAEtB,IACC,GAAG,KAAK,MAAM;YACd,CAAC,GAAG,CAAC,IAAI,KAAK,QAAQ;gBACrB,GAAG,CAAC,IAAI,KAAK,WAAW;gBACxB,GAAG,CAAC,IAAI,KAAK,OAAO;gBACpB,GAAG,CAAC,IAAI,KAAK,cAAc,CAAC,EAC5B,CAAC;YACF,OAAO,CAAC,CAAC,GAAG,CAAC;gBACZ,OAAO,EAAE,4EAA4E;gBACrF,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC;aACnB,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IAED,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,UAAU,GAAG,WAAiC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@atcute/lex-cli",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"description": "cli tool to generate type definitions for atcute",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -16,14 +16,18 @@
|
|
|
16
16
|
"cli.mjs"
|
|
17
17
|
],
|
|
18
18
|
"bin": "./cli.mjs",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": "./dist/index.js"
|
|
21
|
+
},
|
|
19
22
|
"dependencies": {
|
|
20
|
-
"@badrap/valita": "^0.4.
|
|
21
|
-
"@externdefs/collider": "^0.
|
|
23
|
+
"@badrap/valita": "^0.4.4",
|
|
24
|
+
"@externdefs/collider": "^0.3.0",
|
|
22
25
|
"picocolors": "^1.1.1",
|
|
23
|
-
"prettier": "^3.
|
|
26
|
+
"prettier": "^3.5.3"
|
|
24
27
|
},
|
|
25
28
|
"devDependencies": {
|
|
26
|
-
"@types/node": "^22.
|
|
29
|
+
"@types/node": "^22.15.17",
|
|
30
|
+
"@atcute/lexicons": "^1.0.0"
|
|
27
31
|
},
|
|
28
32
|
"scripts": {
|
|
29
33
|
"build": "tsc",
|
package/src/cli.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import * as fs from 'node:fs/promises';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
|
|
4
|
+
import { Builtins, Command, Option, Program } from '@externdefs/collider';
|
|
5
|
+
import pc from 'picocolors';
|
|
6
|
+
|
|
7
|
+
import { generateLexiconApi } from './codegen.js';
|
|
8
|
+
import type { LexiconConfig } from './index.js';
|
|
9
|
+
import { lexiconDoc, type LexiconDoc } from './schema.js';
|
|
10
|
+
|
|
11
|
+
const program = new Program({ binaryName: 'lex-cli' });
|
|
12
|
+
|
|
13
|
+
program.register(Builtins.HelpCommand);
|
|
14
|
+
|
|
15
|
+
program.register(
|
|
16
|
+
class GenerateCommand extends Command {
|
|
17
|
+
static override paths = [['generate']];
|
|
18
|
+
|
|
19
|
+
static override usage = Command.Usage({
|
|
20
|
+
description: `Generates TypeScript schema`,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
config = Option.String(['-c', '--config'], {
|
|
24
|
+
required: true,
|
|
25
|
+
description: `Config file`,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
async execute(): Promise<number | void> {
|
|
29
|
+
const configFilename = path.resolve(this.config);
|
|
30
|
+
const configDirname = path.dirname(configFilename);
|
|
31
|
+
|
|
32
|
+
let config: LexiconConfig;
|
|
33
|
+
try {
|
|
34
|
+
const mod = (await import(path.resolve(configFilename))) as { default: LexiconConfig };
|
|
35
|
+
config = mod.default;
|
|
36
|
+
} catch (err) {
|
|
37
|
+
console.error(pc.bold(pc.red(`failed to import config:`)));
|
|
38
|
+
console.error(err);
|
|
39
|
+
|
|
40
|
+
return 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const documents: LexiconDoc[] = [];
|
|
44
|
+
|
|
45
|
+
for await (const filename of fs.glob(config.files, { cwd: configDirname })) {
|
|
46
|
+
let source: string;
|
|
47
|
+
try {
|
|
48
|
+
source = await fs.readFile(path.join(configDirname, filename), 'utf8');
|
|
49
|
+
} catch (err) {
|
|
50
|
+
console.error(pc.bold(pc.red(`file read error with "${filename}"`)));
|
|
51
|
+
console.error(err);
|
|
52
|
+
|
|
53
|
+
return 1;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
let json: unknown;
|
|
57
|
+
try {
|
|
58
|
+
json = JSON.parse(source);
|
|
59
|
+
} catch (err) {
|
|
60
|
+
console.error(pc.bold(pc.red(`json parse error in "${filename}"`)));
|
|
61
|
+
console.error(err);
|
|
62
|
+
|
|
63
|
+
return 1;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const result = lexiconDoc.try(json, { mode: 'strip' });
|
|
67
|
+
if (!result.ok) {
|
|
68
|
+
console.error(pc.bold(pc.red(`schema validation failed for "${filename}"`)));
|
|
69
|
+
|
|
70
|
+
for (const issue of result.issues) {
|
|
71
|
+
console.log(`- ${issue.code} at .${issue.path.join('.')}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return 1;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
documents.push(result.value);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const result = await generateLexiconApi({
|
|
81
|
+
documents: documents,
|
|
82
|
+
mappings: config.mappings ?? [],
|
|
83
|
+
prettier: {},
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const outdir = path.join(configDirname, config.outdir);
|
|
87
|
+
|
|
88
|
+
for (const file of result.files) {
|
|
89
|
+
const filename = path.join(outdir, file.filename);
|
|
90
|
+
const dirname = path.dirname(filename);
|
|
91
|
+
|
|
92
|
+
await fs.mkdir(dirname, { recursive: true });
|
|
93
|
+
await fs.writeFile(filename, file.code);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
const exitCode = await program.run(process.argv.slice(2));
|
|
100
|
+
process.exitCode = exitCode;
|