Janet 1.41.2-0fea20c Documentation
(Other Versions:
1.41.1
1.40.1
1.40.0
1.39.1
1.38.0
1.37.1
1.36.0
1.35.0
1.34.0
1.31.0
1.29.1
1.28.0
1.27.0
1.26.0
1.25.1
1.24.0
1.23.0
1.22.0
1.21.0
1.20.0
1.19.0
1.18.1
1.17.1
1.16.1
1.15.0
1.13.1
1.12.2
1.11.1
1.10.1
1.9.1
1.8.1
1.7.0
1.6.0
1.5.1
1.5.0
1.4.0
1.3.1
)
pm
The PM module (short for package manager) contains a number of utilities for downloading
bundles from the internet, managing dependencies, and building projects. It works in tandem
with Janet's built-in bundle/ module, as well as supporting legacy JPM projects on a
best-effort basis.
Reference
pm/*curlpath* pm/*gitpath* pm/*pkglist* pm/*tarpath* pm/curl pm/deftemplate pm/download-bundle pm/download-git-bundle pm/download-tar-bundle pm/git pm/jpm-dep-to-bundle-dep pm/load-lockfile pm/load-project-meta pm/local-hook pm/opt-ask pm/pm-install pm/resolve-bundle pm/save-lockfile pm/scaffold-pm-shell pm/scaffold-project pm/tar pm/update-git-bundle pm/vendor-binaries-pm-shell
pm/*pkglist* keyword source
Override the default package listing if a `pkgs` bundle is not currently installed.
pm/deftemplate macro source
(deftemplate template-name & body) Define a inline template as defined by Python PEP292 (shell-like $ substitution), and also allows dashes in indentifiers. It defines new function `template-name` that takes a dictionary `opts` containing substitutions as an argument. Keys should be keywords with the same name (sans :) as the substitution keys. Template is parsed from the last element of `body` which should be string and can contain substitutions.
pm/download-bundle function source
(download-bundle url bundle-type &opt tag) Download the package source (using git, curl+tar, or a file copy) to the local cache. Return the path to the downloaded or cached soure code.
pm/download-git-bundle function source
(download-git-bundle bundle-dir url tag) Download a git bundle from a remote respository.
pm/download-tar-bundle function source
(download-tar-bundle bundle-dir url) Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.
pm/jpm-dep-to-bundle-dep function source
(jpm-dep-to-bundle-dep dep-name) Convert a remote dependency identifier to a bundle dependency name. `dep-name` is any value that can be passed to `pm-install`. Will return a string than can be passed to `bundle/reinstall`, `bundle/uninstall`, etc.
pm/load-lockfile function source
(load-lockfile lock-src) Install all saved dependencies in a lockfile.
pm/load-project-meta function source
(load-project-meta dir) Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.
pm/opt-ask function source
(opt-ask key input-options) Ask user for the value of the `key`. `input-options` should be a table with default values. If the default value for the `key` is not `nil`, it will return that.
pm/pm-install function source
(pm-install bundle-code &named no-deps force-update no-install auto-remove) Install a bundle given a url, short name, or full 'bundle code'. The bundle source code will be fetched from git or a url, then installed with `bundle/install`.
pm/resolve-bundle function source
(resolve-bundle bundle)
Convert any bundle string/table to the normalized table form. `bundle` can be any of the following forms:
* A short name that indicates a package from the package listing.
* A URL or path to a git repository
* A URL or path to a .tar.gz archive
* A string of 2 parts separated by "::" - {type}::{path-or-url}
* A string of 3 parts separated by "::" - {type}::{path-or-url}::{tag}
* A table or struct with the following keys:
* `:url` or `:repo` - the URL or path of the git repository or of the .tar.gz file. Required.
* `:tag`, `:sha`, `:commit`, or `:ref` - The revision to checkout from version control. Optional.
* `:type` - The dependency type, either `:git`, `:tar`, or `:file`. The default is `:git`. Optional.pm/save-lockfile function source
(save-lockfile lock-dest) Create a lockfile that can be used to reinstall all currently installed bundles at a later date.
pm/scaffold-pm-shell function source
(scaffold-pm-shell path) Generate a pm shell with configuration already setup. If `copy-janet` is truthy, the Janet executable file will be bundled in the new environment
pm/scaffold-project function source
(scaffold-project name &opt options) Generate a standardized project scaffold.
pm/update-git-bundle function source
(update-git-bundle bundle-dir tag) Fetch latest tag version from remote repository
pm/vendor-binaries-pm-shell function source
(vendor-binaries-pm-shell path) Copy the Janet interpreter, shared libraries, and other installation files directly into the new shell environment. This allows updates and changes to the system configuration without breaking the shell.