Packages
dartea packages live on npm. There is no separate registry and no account besides your npm one.
Use a package
Section titled “Use a package”npx dartea install @someone/chartsThis finds the newest version of @someone/charts, checks that it fits with everything else your project depends on, and only then adds it to dartea.json:
{ "source-directories": ["src"], "dependencies": { "@someone/charts": "^1.2.0" }}The exact version of every package, direct or not, goes to dartea.lock. Commit both files. Running plain npx dartea install later gives everyone the same versions without going to the network for packages already there.
What you can import
Section titled “What you can import”Only the modules a package lists in exposed-modules. The rest are private to the package. Importing one is reported the same way as importing a module that does not exist.
What gets downloaded
Section titled “What gets downloaded”The tarball from npm, checked against its sha512. A tarball that tries to write outside its own folder is refused, and so is a package with no dartea.json. No install scripts run: a dartea package is Elm source and nothing else.
Packages are unpacked into .dartea/packages, and only the code your program uses ends up in the output.
Publish a package
Section titled “Publish a package”-
Lay the package out like this:
- dartea.json
- README.md optional
- LICENSE optional
Directorysrc/
- Greeting.elm
-
Describe it in
dartea.json:dartea.json {"type": "package","name": "@you/greeting","version": "1.0.0","summary": "Say hello","license": "BSD-3-Clause","exposed-modules": ["Greeting"],"dependencies": {}} -
Log in to npm once.
Terminal window npm login -
Rehearse, then publish.
Terminal window npx dartea publish --dry-runnpx dartea publish
publish compiles the package first and stops on any error. It checks that every module in exposed-modules exists in src. Then it builds a package.json from your dartea.json, packs dartea.json, src, README.md and LICENSE, and hands them to npm publish. Two-factor prompts and trusted publishing from CI are npm’s, so they work as usual.
Publish under your own npm scope, like @you/greeting. The @dartea scope is kept for the packages of this project. Every published package gets the dartea-package keyword, so a search on npm lists them all.
Versions
Section titled “Versions”You choose the version. Bump the major number when you change or remove something people use, the minor one when you add something, the patch one for fixes.