Let's keep that around
One of the neat "under the hood" features of CommandBox is artifacts. Artifacts are a copy of each package that gets downloaded with CommandBox. This is good for you and for the internet because once you have a package in your artifacts, you don't need to download it again. Artifacts are key to CommandBox efficiency.
We might need that again
The next time you download a package from ForgeBox, CommandBox reads the box.json file for that package's dependencies. Then, it checks to see if we already have a copy of those dependencies in the artifacts. If the dependency is in the artifacts, CommandBox just uses it. If not, then CommandBox calls to ForgeBox to get that dependency. That's efficiency.
Where are these Artifacts you speak of?
By default, CommandBox stores the artifacts in the <user home>/.CommandBox/artifacts/ folder. You can find them there.
Excess baggage
As time goes on, and you do more and more development with CommandBox, the artifacts may develop a bit of baggage. This would happen when packages and package dependencies get newer versions. Say ColdBox 4.3 has TestBox 2.5 as it's dependency, but our Artifacts have TestBox 1.7, 1.9, and 2.1 in them (just a hypothetical). Those old, outdated artifacts are just taking up space. You might wanna get rid of that excess baggage. The CLI command for that is:
artifacts clean
Or if you are running CommandBox from your OS's native shell:
box artifacts clean
There. Now you have a clean slate. Baggage gone. Unfortunately, now you'll have to rebuild your artifacts with your next CommandBox package downloads, which will take a little more time on your next few setups.
Being choosy
Cleaning out your whole artifacts collection may be a little excessive for some folk. We have other means.
Start by entering the following command:
artifacts list
Or if you are running CommandBox from your OS's native shell:
box artifacts list
This will list out the artifacts that you have stored in your local artifacts collection. Then, you can delete selected artifacts with the following command:
artifacts remove <package-name>
Or if you are running CommandBox from your OS's native shell:
box artifacts remove <package-name>
This command is rather flexible. <package-name> can be a single package (ex: testbox), or a comma-delimited-list of packages (ex: testbox, awesome-security-interceptor, something-else, etc.). You can even include specific versions of a package that you want removed (ex: testbox 1.2.0.0).
So, if removing ALL your artifacts is not your style, you can be choosy with what you want to keep in your artifacts.
It makes a difference
Back in CBDW2014 (ColdBox Developer's Week 2014), I bet that Brad Wood could setup a fresh ColdBox 4.0 site in under a minute. He beat my expectations. But to make it a fair contest, he chose to clear his artifacts before doing so (nice guy). Later, he ran the same test with those artifacts in place (expected Brad Wood curiosity). For a standard, vanilla ColdBox 4.0 setup it made around 20 seconds difference in setup time, not to mention the data advantage of not having to re-download those package dependencies. It makes a difference. It enhance performance and cuts down setup times.
You may never notice it, but the artifacts are one more way that CommandBox streamlines your CFML workflow.
Add Your Comment