I know we are trying to push conventions but this isn’t a coldbox module and I’d like the package to install into the folder from which I typed install. Is that possible?
Here is some of the box.json:
Then don’t use the type modules. That is reserved to go into a modules direvtory
Ortus Solutions, Corp
That’s what I figured and tried that but couldn’t use the CommandBox “publish” command. I got this error:
Sorry, the package could not be published.
Package type does not exist in box.json. Please set a type for your package with “package set type=modules”, etc.
Technically I don’t need to use the command but I figured I’d ask. Thanks,
Ah, Never Mind. I didn’t realize all the options for type. Thanks, Luis!
Yes, you can use any type you want. For random libraries tha aren’t a ColdBox module, you can just use the package type of “projects”.
Now that said-- To answer your original question, yes you can override the installation directory to be whatever you want. When you change the package type to be something other than “modules”, you’ll see the packages just get dumped into the root of your project in a folder named after the slug. If you want it installed into a folder called “foobar” instead, you can do it from two different directions:
Change the box,.json of the package itself to have a “directory” property that contains a relative path to where you want the package to go. “foobar”. You can see that here:
Or you can change the box.json of the package you’re installing INTO to have an installpaths struct that contains a key matching the slug of the package and lists a relative path to where you want it to install to. Note, this path includes the package folder. The same link above shows an example of this.
The difference here is that an overridden directory in the package itself affects all who install that package whereas seeding an installpath only affects your installation.
And, of course, you can use the ‘directory’ parameter of the “install” command as well to performt the same override with a box.json even being present in the target package.
Read through these docs here which cover all of this in detail:
Thanks Brad. I appreciate it. I thought ForgeBox was forcing me to use “modules” as the type until I dove deeper.
End result was a private package published which is my presentation for the Boston CFUG tomorrow night on React
You’re the man!