To resume the changes required to move a CLJS library from leiningen to shadow-cljs:
- Create
shadow-cljs.edn
in the project root
- example: https://github.com/district0x/cljs-web3-next/blob/master/shadow-cljs.edn
- it will probably need at least 2 targets: browser (to run tests locally during development) and karma (to run tests on the CI). Docs: https://shadow-cljs.github.io/docs/UsersGuide.html#target-browser
- Create
deps.edn
in the project root and translate the Clojars dependencies from project.clj to there
- example: https://github.com/district0x/cljs-web3-next/blob/master/deps.edn
- after that
project.clj
can be removed (or after the next step in case you need to look up the NPM deps)
- If there are direct NPM dependencies for that library / project, define these in
src/deps.cljs
- NB! note the extension, it's
.cljs
not.edn
, this is important - after this you can remove package.json (and its respective lock-file)
- hint: if you want to force subsequent dependency updates to use Yarn, you can do
yarn add [email protected]
which will generatepackage.json
andyarn.lock
, after which shadow-cljs will automatically use yarn for future dependency pullsyarn
, otherwise it'll default tonpm
)
- To build and publish JAR (normally CI publishes it)
- having moved away from leiningen, the "modern" way to do it is using Clojure's built int tools.build
- for that you can use as an example https://github.com/district0x/cljs-web3-next/blob/master/build.clj
- need to update
lib
andversion
symbols according to the library you're working on - then to build on CI, update
.circle/config.yml
(example: https://github.com/district0x/cljs-web3-next/blob/master/.circleci/config.yml#L41-L48) - commands to do it are documented in https://github.com/district0x/cljs-web3-next/blob/master/README.md#build--release-with-depsedn-and-toolsbuild
More example build, test & release commands are documented in https://github.com/district0x/cljs-web3-next/blob/master/README.md#new-build-test-and-release-commands