KPM Integration: Knight Package Manager CLI

KPM Integration: Knight Package Manager CLI
KPM (Knight Package Manager) is a command-line tool developed in TypeScript and distributed as an npm package (kpm.client). Its purpose is to streamline the process of managing Knight packages, such as Cmdr, in a structure similar to npm. With KPM, you can install, update, and uninstall Knight packages from your desktop CLI, allowing for easy management of game development dependencies.
This article will guide you through setting up KPM and provide example usage for managing packages within your Knight framework projects.
Installing KPM
To get started with KPM, you’ll need to install it globally via npm. Ensure you have Node.js and npm installed on your system.
npm install -g kpm.clientOnce installed, you can access KPM through your command line using the kpm command.
Example Usage of KPM
Let’s look at a basic example of using KPM in your desktop CLI.
C:\Users\administrator> kpm
_ ______ __ __ _ _ _
| |/ / _ \| \/ | ___| (_) ___ _ __ | |_
| ' /| |_) | |\/| | / __| | |/ _ \ '_ \| __|
| . \| __/| | | | | (__| | | __/ | | | |_
|_|\_\_| |_| |_| \___|_|_|\___|_| |_|\__|
Copyright (c) 2024 RAMPAGE Interactive.
Written by vq9o and Contributor(s).
Knight Package Manager CLIBasic Commands
Here are some of the most commonly used commands in KPM, along with example usage.
1. Installing a Package
To install a Knight package (such as Cmdr), use the install command. You can specify the package and an optional version:
kpm install cmdrThis will install the latest version of the Cmdr package. You can also specify a version:
kpm install cmdr 1.2.3This installs version 1.2.3 of the Cmdr package.
2. Uninstalling a Package
To uninstall a package, use the uninstall command:
kpm uninstall cmdrThis removes the Cmdr package from your Knight project.
3. Updating Packages
To update all installed packages to their latest versions, use the update command:
kpm updateYou can also update a specific package by specifying its name:
kpm update cmdrThis updates only the Cmdr package to the latest version.
4. Checking for Updates
To check if a specific package has a new version available without installing the update, use the check-update command:
kpm check-update cmdrThis will display information about whether a new version of the Cmdr package is available.
5. Outputting the Manifest of a Package
To view the manifest (for example a NPM package.json) of a specific package, use the output-manifest command:
kpm output-manifest cmdrThis will print the package’s manifest to the console, showing details such as the version, dependencies, and other metadata.
6. Publishing Packages
KPM also allows you to publish packages. To open the KPM publish form in your default browser, use the publish command:
kpm publishThis will redirect you to the form where you can submit your package to the KPM repository.
7. Package Count
To get a count of all installed packages, use the count command:
kpm countThis will display the total number of packages installed in your project.
Advanced Commands
KPM offers several advanced commands to help you further customize and manage your environment.
1. Setting the Installation Path
By default, KPM installs packages in the current running directory, but you can change this location using the set-path command:
kpm set-path C:/MyGame/KnightPackagesThis sets the new path where packages will be installed.
To verify the current path, use:
kpm get-path2. Unsafe Mode
KPM has a feature called "unsafe mode," which allows you to enable or disable certain operations that may pose risks to your game’s stability. You can toggle unsafe mode using the unsafemode command:
kpm unsafemode enableTo disable it:
kpm unsafemode disable3. Reinstalling KPM Client
If you need to reinstall or update the KPM client to the latest version, you can use the npm command:
kpm npmThis command will uninstall and reinstall KPM to ensure you have the latest version of the CLI.
4. Logging In
To access certain features, such as downloading private packages, you need to be logged in. Use the login command to log in and save your authentication key:
bkpm loginFollow the prompts to log in securely.
Example Workflow
Here’s an example of a typical workflow using KPM in a project:
Install Cmdr:
kpm install cmdrSet a Custom Installation Path:
kpm set-path C:/MyGame/KnightPackagesCheck for Updates for Cmdr:
kpm check-update cmdrUpdate All Packages:
kpm updateOutput Manifest for Cmdr:
kpm output-manifest cmdrLog in to KPM:
kpm login
This workflow allows you to efficiently manage the packages used in your Knight framework project without leaving your desktop CLI.
Last updated
Was this helpful?