Skip to content
marchbold edited this page Feb 24, 2023 · 9 revisions

APM

The following details how to use apm.

Make sure you have installed the tool correctly first - Installation

The tool is designed to be run from the command line, so pay particular attention to adding the tool to your path.

You should be able to run apm -v from a command line and it will output the current version of the tool:

$ apm -v
1.0.0

You use the tool by passing arguments to the command. The commands often have parameters, eg:

apm search foo

This performs the search command looking for the keyword "foo"

Groups

There are several major functionality groups of the commands:

  • general: informational commands such as help and version;
  • project: set configuration for your AIR project and help with generation of the application descriptor (manifest additions etc);
  • package: search and install packages;
  • package creation: build and publish packages;
  • air sdk: Providing the ability to query and download the AIR SDK;

General

Version

The version command outputs the version information for APM.

There are two slight variants.

The basic version outputs the version of the apm command eg

$ apm -v
1.0.0

The more complete command will output some additional version information

$ apm version
apm: v1.0.0

Help

The help command can be used to get information about any of the available commands.

Without any parameters the command will print a list of the availble commands:

apm help

You can get help about any of the commands by specifying them as a parameter to the help command:

$ apm help version
apm version

print apm version information

apm -v          print the basic apm version number
apm version     print the version information about apm

You can specify subcommands, for example:

$ apm help airsdk list
apm airsdk list

lists available AIR SDK versions

apm airsdk list          lists available AIR SDK versions

Config

The config command controls global configuration parameters that are used across all usages of apm. These values are stored in a user configuration file in a .apm_config file in the user's home directory.

There are limited options you can set using this command, for example setting your user authentication details for publishing and your github token for accessing private packages.

apm config set github_token ghp_XXXXXXXXXXXXXXXXXXXXXXXXXXXX

You can print the current value using get:

apm config get github_token

Updating APM

Updating APM is a special instance of the package update command. It will check for a more recent release and install it if available.

It is initiated by calling apm update and passing apm in place of the normal package identifier:

apm update apm

apm: v0.0.4-beta
✓ Already at latest version

It will output the current version and then check for any updates.

Authentication

We can use your github personal access token in order to access private repositories in github. This allows you to access any packages that require authentication via github, such as the packages provided by distriqt. Personal access tokens are used in place of a password with the command line and allows APM to download private packages.

In order to set your access token, firstly create an access token. Follow this guide from github. Once complete copy the token which will be of the format ghp_XXXXXXXXXXXXXXXXXXXXXXXXXXXX and set it in your client config:

apm config set github_token ghp_XXXXXXXXXXXXXXXXXXXXXXXXXXXX

Once set apm will be able to access all the private packages your github user has access to.