Upload Command

The upload command in the PxPlus Package Manager is used to upload your package or a new package version to the server. It creates a ZIP archive from your current project directory (while excluding certain files and directories), uploads it for validation, and then stores it if everything is in order.

{warning} If you are not yet familiar with the required package structure, we highly recommend checking out the package management documentation. All the same rules apply here when uploading a package via the command line.

Synopsis

upload [upload_type]
  • upload_type: Specifies the type of upload. Valid values are:
    • package: For uploading a new package.
    • version: For uploading a new version of an existing package.

Description

When you run the upload command, the following steps occur:

  1. Package Presence Validation:
    It looks for a package.json file in the current directory to ensure that package details are available.

  2. Package Archive Creation:
    It creates a temporary ZIP archive of the current directory. During this process:

    • The temporary ZIP file itself is skipped.
    • Files in the vendor folder and the package-lock.json file are excluded.
  3. Package Upload and Validation:
    The archive is uploaded to the server. The server then:

    • Validates the uploaded package.
    • Checks the package details.
    • If validation passes, proceeds to store the package.

Parameters

  • upload_type: A required argument that tells the command what type of upload you are performing. It must be one of:
    • package
    • version

Examples

  • To upload a new package:
upload package
  • To upload a new version of an existing package:
upload version

Output

  • Success:
    If the upload is successful, you will see messages confirming that the package has been uploaded, validated, and stored. The output may also include the package name, version, and a URL to view the package.

  • Failure:
    If an error occurs (such as missing parameters, API inaccessibility, failed validation, etc.), an appropriate error message will be displayed.

Exceptions

  • CommandNoParametersException:
    Thrown if the upload_type parameter is missing or invalid.

  • NoApiAccessException:
    Thrown if the API is not accessible.

  • Other Exceptions:
    Exceptions may also occur during file operations (e.g., creating the ZIP archive) or API communication. These will be logged with appropriate error messages.