-
Notifications
You must be signed in to change notification settings - Fork 816
packaging notes
A CLJSJS package has a directory of the following format. When creating one, you can copy one of the packages in this repo for reference.
your-library/
├── README.md
├── build.boot
└── resources
└── cljsjs
└── common
└── your-library.ext.js
*.ext.js
is the externs file for your library. You can read this article to learn how to create one.
build.boot
contains instructions for downloading the library files from a URL, and then
packaging it. Let's skip ahead to what build.boot
produces so we can better understand what we need to tune in build.boot and why:
# Try to build the package
$ boot package
After running this command to build the package, you should have a new target
package directory:
your-library/
├── ...
└── target
├── cljsjs
│ ├── common
│ │ └── your-library.ext.js
│ ├── development
│ │ └── your-library.inc.js
│ └── production
│ └── your-library.min.inc.js
└── deps.cljs
File details:
-
*.inc.js
and*.min.inc.js
were copied from a downloaded file -
*.ext.js
was copied from your resources directory -
deps.cljs
was generated by boot, and required by cljs compiler
Thus, build.boot contains instructions to do the following.
- download your library from a URL, verify checksum, and unzip if needed
- move downloaded files to the target directory
- minify files from the target directory to another location in target directory
- generate the deps.cljs
build.boot also contains the version of the package. We use the library's version for the first semver digits major.minor.patch
and we append a hyphen and a cljsjs revision count (starting at zero):
(def +version+ "1.1.2-0")
You can locally install your library to test it out by running:
## build and install locally
boot package build-jar
Finally, you can follow the instructions in your package's README to try it out in a local project.
Use md5sum
for linux/windows or brew install md5
to get a checksum for a downloaded file.