www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to make a new dub subpackage? [Answered]

reply BoQsc <vaidas.boqsc gmail.com> writes:
 Note: It is not possible to make subpackage inside subpackage.
To make a subpackage with dub; follow these general guidelines. **General guidelines** 1. Create a new folder. 2. Open the folder. 3. Initialise a new package. (`dub init`) 4. Open `dub.json` file * Append this: ``` "subPackages": [ "./component1/" ] ``` 6. Create a new inner folder named `component1` 7. Initialise a new package inside the inner folder (`dub init`) 8. Open the previous package folder. 9. Run the subpackage as a test. (`dub run :component1`) ___ **This is how it is made in Windows 10:** (I use Windows 10, please excuse for not giving Linux directions.)
 mkdir "NewPackage"
 cd "./NewPackage"
 dub init
 notepad dub.json
"subPackages": [ "./component1/" ]
 mkdir "component1"
 cd "./component1"
 dub init
 cd "../"
 dub run :component1
___ More information can be found: https://dub.pm/package-format-json#sub-packages For SDL Package File Format: https://dub.pm/package-format-sdl#sub-packages
Nov 20 2021
next sibling parent Kyle Ingraham <kyle kyleingraham.com> writes:
Thanks for the writeup. How are you using this functionality?
Dec 01 2021
prev sibling parent Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Saturday, 20 November 2021 at 13:45:43 UTC, BoQsc wrote:
 [...]
To make a subpackage with dub; follow these general guidelines. **General guidelines** [...]
Just a side note, you can also supply a name to init directly and it creates the directory etc: dub init myproject
Dec 02 2021