New WIP DUB documentation

Bastiaan Veelo Bastiaan at Veelo.net
Thu Aug 18 20:00:10 UTC 2022


On Thursday, 18 August 2022 at 14:00:38 UTC, Martin Tschierschke 
wrote:
> What about the following idea about **comments for dub.json**: 
> Allow the key "comment" inside the json file and alter DUB to 
> remove all "comment" key value pairs at the beginning of 
> parsing.
> So the file is still valid json but comments are possible like 
> in dub.sdl.
> ```
> {
>     "comment" : "dub.json can contain comments,too!",
>     "name": "myproject",
>     "description": "A little web service of mine.",
>     "authors": ["Peter Parker", "John Doe"],
>     "homepage": "http://myproject.example.com",
>     "license": "GPL-2.0",
>     "dependencies": {
>         "vibe-d": "~>0.9.5"
>     }
> }
> ```

That's already possible, as unrecognised items are ignored. This 
is however not flexible enough, as comments are not so much 
wanted for adding explanations but much more for commenting out 
specific parts. It does work sometimes: you can for example 
disable `preBuildCommands` by editing it to 
`preBuildCommandsDISABLED`. I don't think you can comment out a 
dependency this way, and you cannot comment out an item from an 
array like
```json
{
     "preBuildCommands": [
         "step one",
         #"step two",
         "step three"
     ]
}
```

-- Bastiaan.


More information about the Digitalmars-d-announce mailing list