@@ -184,14 +184,27 @@ type Command
184
184
= Repl ReplFlags
185
185
| Make MakeFlags
186
186
| Docs DocsFlags
187
- | PackageValidate
188
- | PackageBump
187
+ | PackageValidate ProjectSources
188
+ | PackageBump ProjectSources
189
189
| PackageDiff DiffArgs
190
190
191
191
192
+ {-|-}
193
+ type alias ProjectSources =
194
+ { projectPath : Path
195
+ , outline : Outline
196
+ , rootSources : Dict String String
197
+ , dependencies : Dict String { outline : Outline.PkgOutline, sources : Dict String String }
198
+ }
199
+
200
+
192
201
{-|-}
193
202
type alias ReplFlags =
194
203
{ interpreter : Maybe String
204
+ , projectPath : Path
205
+ , outline : Outline
206
+ , rootSources : Dict String String
207
+ , dependencies : Dict String { outline : Outline.PkgOutline, sources : Dict String String }
195
208
}
196
209
197
210
@@ -222,6 +235,10 @@ type MakeOutput
222
235
type alias DocsFlags =
223
236
{ output : Maybe DocsOutput
224
237
, report : Maybe {}
238
+ , projectPath : Path
239
+ , outline : Outline
240
+ , rootSources : Dict String String
241
+ , dependencies : Dict String { outline : Outline.PkgOutline, sources : Dict String String }
225
242
}
226
243
227
244
@@ -292,17 +309,13 @@ commandEncoder interactive pathToString command =
292
309
Json.object
293
310
[ { key = "command", value = Json.string "repl" }
294
311
, { key = "intepreter" , value = maybeEncoder Json.string flags.interpreter }
312
+ , { key = "project-path", value = Json.string <| pathToString flags.projectPath }
313
+ , { key = "project-outline", value = Outline.toJson flags.outline }
314
+ , { key = "sources", value = Json.dict identity Json.string flags.rootSources }
315
+ , { key = "dependencies", value = Json.dict identity depsToJson flags.dependencies }
295
316
]
296
317
297
318
Make flags ->
298
- let
299
- depsToJson : { outline : Outline.PkgOutline, sources : Dict String String } -> Json.Value
300
- depsToJson dep =
301
- Json.object
302
- [ { key = "outline", value = Outline.toJson (Outline.Pkg dep.outline) }
303
- , { key = "sources", value = Json.dict identity Json.string dep.sources }
304
- ]
305
- in
306
319
Json.object
307
320
[ { key = "command", value = Json.string "make" }
308
321
, { key = "optimize", value = Json.bool flags.optimize }
@@ -321,17 +334,29 @@ commandEncoder interactive pathToString command =
321
334
[ { key = "command", value = Json.string "docs" }
322
335
, { key = "output", value = maybeEncoder docsOutputEncoder flags.output }
323
336
, { key = "report-json", value = maybeToBool flags.report }
337
+ , { key = "project-path", value = Json.string <| pathToString flags.projectPath }
338
+ , { key = "project-outline", value = Outline.toJson flags.outline }
339
+ , { key = "sources", value = Json.dict identity Json.string flags.rootSources }
340
+ , { key = "dependencies", value = Json.dict identity depsToJson flags.dependencies }
324
341
]
325
342
326
- PackageValidate ->
343
+ PackageValidate flags ->
327
344
Json.object
328
345
[ { key = "command", value = Json.string "packageValidate" }
346
+ , { key = "project-path", value = Json.string <| pathToString flags.projectPath }
347
+ , { key = "project-outline", value = Outline.toJson flags.outline }
348
+ , { key = "sources", value = Json.dict identity Json.string flags.rootSources }
349
+ , { key = "dependencies", value = Json.dict identity depsToJson flags.dependencies }
329
350
]
330
351
331
- PackageBump ->
352
+ PackageBump flags ->
332
353
Json.object
333
354
[ { key = "command", value = Json.string "packageBump" }
334
355
, { key = "interactive", value = Json.bool interactive }
356
+ , { key = "project-path", value = Json.string <| pathToString flags.projectPath }
357
+ , { key = "project-outline", value = Outline.toJson flags.outline }
358
+ , { key = "sources", value = Json.dict identity Json.string flags.rootSources }
359
+ , { key = "dependencies", value = Json.dict identity depsToJson flags.dependencies }
335
360
]
336
361
337
362
PackageDiff args ->
@@ -363,6 +388,14 @@ commandEncoder interactive pathToString command =
363
388
]
364
389
365
390
391
+ depsToJson : { outline : Outline.PkgOutline, sources : Dict String String } -> Json.Value
392
+ depsToJson dep =
393
+ Json.object
394
+ [ { key = "outline", value = Outline.toJson (Outline.Pkg dep.outline) }
395
+ , { key = "sources", value = Json.dict identity Json.string dep.sources }
396
+ ]
397
+
398
+
366
399
maybeEncoder : (a -> Json.Value) -> Maybe a -> Json.Value
367
400
maybeEncoder enc maybeVal =
368
401
when maybeVal is
0 commit comments