Migrating packages
This guide shows you how to turn a package of lip v0.x, which has a tooth.json, into a package with a lip.toml, and what to check before you publish it.
Packages for lip v0.37.0 and earlier have a tooth.json of format version 1, 2 or 3. Packages now have a lip.toml instead (see lip.toml). lip still installs packages with such a tooth.json, but new versions of your package should use lip.toml. The lip pkg migrate command helps you convert it.
Using lip pkg migrate
Run lip pkg migrate without arguments in the root directory of your package repository, the one that contains tooth.json:
cd MyTool
lip pkg migrate
git add lip.toml tooth.json
git commit -m "Migrate tooth.json to lip.toml"It writes lip.toml converted from tooth.json, then deletes tooth.json. In the interface, Migrate tooth.json on the Tools page does the same for the selected workspace, and asks its questions in the interface. When lip.toml already exists, or tooth.json is missing or is not a tooth.json of format 1, 2 or 3 that lip can read, the command fails and changes nothing.
Questions
lip.toml has no RID patterns: every entry names one platform, a RID. When the result needs a value that the old file does not provide, lip asks for it on the terminal and asks again until the answer is valid:
- the platforms (RIDs) a
platformpattern oftooth.jsonsuch aswin-*stands for, as a comma-separated list (each must match the pattern); - the platforms (RIDs) a
platformoftooth.jsonthat is not a RID, such aswindows/amd64, stands for, as a comma-separated list; - the platforms (RIDs) that variants without a
platformapply to, when there are such variants.
When standard input or standard error is not a terminal (in CI, for example), lip pkg migrate fails instead, naming the value it would ask for, and changes nothing.
Warnings
Everything that is dropped, or converted with another meaning, is printed as a warning that names the field it comes from, such as variants (label '', win-x64).assets[1]. Fields of tooth.json format 1 and 2 files are named as in format 3, which lip converts them to first. Warnings do not make the command fail; review them, fix lip.toml where needed, and commit.
What Changes
format is 4, tooth becomes id, and version and info are copied, except that info.avatar_url becomes info.logo when it starts with https:// and is dropped otherwise, with a warning. The variants are rewritten as follows:
- Each label becomes a variant of the same name; the empty label becomes the variant
"". - For each platform a label applies to (the
platformof its variants, with patterns and values that are not RIDs expanded to the RIDs you gave), the variants of the label that apply to that platform are merged as lip v0.37.0 merged them, and the result becomes one entry with thatplatform. Itssideisclientwhen the merged variants depend ongithub.com/LiteLDev/LeviLamina#client, andserverwhen they depend on another variant ofgithub.com/LiteLDev/LeviLamina; without a dependency on LeviLamina, the result becomes two entries, one for each side. dependenciesbecomedeps, with their ranges. A range that is not a valid range now is asked for on the terminal until the answer is one; without a terminal the command fails and changes nothing.- Each asset keeps its
typeandurls, and itsplacementsbecomeplace, converted exactly as lip reads atooth.jsonof an earlier format: after\is replaced by/and empty and.segments are removed, adirplacement takes the directory form (srcanddestending with/, or""), afileplacement whosesrccontains*,?or[the glob form (destending with/, or""), and any otherfileplacement the file form. A placement that is not valid inlip.tomlis left out, with a warning. lip.tomlhas notar,tgzanduncompressedasset types. A platform whose merged variants have such an asset gets no entry, with a warning, just as lip installs no entry of it for that platform.preserve_filesbecomespreserveandremove_filesbecomespurge, with\replaced by/; apreserve_filespattern without/gets a**/prefix, and aremove_filespattern without a trailing/is also written with one (see Limitations).- The scripts become
hooks:pre_install,post_install(installfirst, thenpost_install),pre_uninstall(pre_uninstall, thenuninstall) andpost_uninstall. - Other empty values, outside
info, are omitted.
Limitations
lip pkg migrate is a helper, not a guarantee. Always review its output.
lip.tomlmust have the tag version as itsversionat a tag, and the path of the repository as itsid. lip v0.37.0 installed atooth.jsonthat broke these rules; check yours before you publish.- Placements are converted by the rules above, without looking at the files they place, and are then carried out as for
lip.toml: afileplacement whosesrcis a pattern keeps the subdirectories of the files it matches, wheretooth.jsonplaced them by file name only, and a placement of a missing file fails the installation, wheretooth.jsonskipped it. Check such placements. - A
preserve_filespattern without/matched the file name in any directory; it becomes**/<pattern>. Aremove_filespattern also removed matching directories; it is also written with a trailing/. Patterns that are not valid globs, such as ones starting with/, are dropped. - Dependencies of format 1 and 2 whose range cannot be read in format 3 (e.g.
2.16.x) were already ignored when installing thetooth.json; they are reported so that you can add them by hand. - Scripts other than the install and uninstall hooks (such as
pre_packor custom scripts), and theprerequisitesof format 2, have no equivalent and are dropped. - A migrated package is a file package that places files where the old
tooth.jsondid. If your package is a LeviLamina mod, consider publishing it as anmcmodasset instead (see A mod package), which is installed tomods/<name>/. - Dependencies on other packages that still have a
tooth.jsonkeep working, because lip still installs them.
Tags are versions only when they are named exactly v<SemVer> (e.g. v1.2.3). Tags such as v1.2 are not versions.
After migrating
-
Read the warnings and fix
lip.tomlwhere needed. -
Check that lip reads the result:
shlip pkg view . -
Install it into a test server, as Testing locally describes.
-
Commit, and publish a new version with a tag, as Publishing a version describes.
Versions that you published before keep their tooth.json, and lip keeps installing them.
See also
lip pkg migrate- lip.toml: how lip reads a
tooth.json. - Creating packages
- Tools: the same action in the interface.