APM (ao package manager)
Publish Packages

Publishing Packages

To publish packages on APM you will need to use the APM CLI TOOL (opens in a new tab)

Publish through the CLI

Install APM CLI

npm install -g apm-tool@latest
apm
 
# or use it throught npx
 
npx apm-tool@latest
-- without any args it will show the menu
 ______   ______  __    __       ______   __       __    
/\  __ \ /\  == \/\ "-./  \     /\  ___\ /\ \     /\ \   
\ \  __ \\ \  _-/\ \ \-./\ \    \ \ \____\ \ \____\ \ \  
 \ \_\ \_\\ \_\   \ \_\ \ \_\    \ \_____\\ \_____\\ \_\ 
  \/_/\/_/ \/_/    \/_/  \/_/     \/_____/ \/_____/ \/_/ 
                                                          
 Made with ♥ by BetterIDEa team                   [v1.3.4]

? What would you like to do? (Use arrow keys)
❯ Create new package boilerplate
  Register a new vendor
  Publish a package
  Download an existing package
  Open APM web interface
  Exit

Initialise a package

Similar to npm init, you can use apm init to initialise a boilerplate for a new package. It will ask for basic details like vendor name, package name, version, description, etc.

This will create an apm.json file in the package directory containing the package details.

apm init

Registering a vendor

By default, all packages are published under the @apm vendor name and appear as @apm/package-name. If you want to publish packages under your own vendor name, you can register a vendor name using the following command.

apm register-vendor <vendor-name>

Publishing a package

Once the source code has been written and necessasary details are added to the apm.json file, you can publish the package using the following command.

apm publish

This will ask for a wallet jwk json file path to publish the package from (unless a wallet path has been defined in apm.json)

Once published the package will be available on the APM registry and can be installed using apm install "<package-name>".

Publish through the web

If you want to use your web wallet to publish packages instead of the cli, you can create a bundle of the package and upload it to the APM web interface.

Just open apm.betteridea.dev (opens in a new tab), publish package tab and upload the bundle folder containing bundled.lua, apm.json and README.md files.

To create an uploadable bundle of your package, simply run:

apm bundle

This will create a dist folder containing the lau bundle and the necessary files.


apm.json structure

KeyDescriptionDefaultRequired
nameName of the packageyes
vendorVendor name under which the package will be published@apmYes
versionVersion of the package in format major.minor.patch1.0.0Yes
descriptionShort description of the packageYes
mainEntry point of the package (required for bundling)main.luaNo
keywordsKeywords related to the package (max 5)[]Yes
repositoryURL of the package repositoryYes
authorsList of authors of the package
{ address, name, email, url }
[]No
licenseLicense of the packageMITYes
dependenciesDependencies object for the package
{ name: { version } }
{}Yes
warningsOften packages need to modify global state to function, the publisher can then set the warnings flag to let the user know if their package can break the functioning of their process.
The installMessage (if given) is displayed after the package is installed, the publisher should write a brief warning here if needed
{ modifiesGlobalState: false, installMessage:"" }Yes
walletWallet jwk json file path to publish the package fromNo

The schema for apm.json is available at https://github.com/ankushKun/apm-cli/blob/main/apm.schema.json (opens in a new tab)