😎
Knight Framework
ContributeDownload
  • Download
  • Documentation
    • Welcome
    • Installation
    • What are folders
    • What are services?
    • Getting a service
    • Creating a library
    • AGF/Knit Transition to Knight
    • Exposed-Server Functions
    • Configuring Knight
    • KPM Integration: Knight Package Manager CLI
    • Framework Profiling
  • Services vs Controllers
  • Execution Model
  • Intellisense
  • Luau API
    • Knight External API
    • Knight Remotes API
  • Community
    • Documentation
    • Framework
    • Templates (RBXL)
    • Games who use Knight
  • Legacy Documentation
    • README.md
    • Services
    • Startup Priority
Powered by GitBook
On this page
  • KPM Integration: Knight Package Manager CLI
  • Installing KPM
  • Example Usage of KPM
  • Basic Commands
  • Advanced Commands
  • Example Workflow

Was this helpful?

Edit on GitHub
  1. Documentation

KPM Integration: Knight Package Manager CLI

PreviousConfiguring KnightNextFramework Profiling

Last updated 9 months ago

Was this helpful?

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.client

Once 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 CLI

Basic 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 cmdr

This will install the latest version of the Cmdr package. You can also specify a version:

kpm install cmdr 1.2.3

This installs version 1.2.3 of the Cmdr package.

2. Uninstalling a Package

To uninstall a package, use the uninstall command:

kpm uninstall cmdr

This 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 update

You can also update a specific package by specifying its name:

kpm update cmdr

This 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 cmdr

This 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 cmdr

This 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 publish

This 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 count

This 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/KnightPackages

This sets the new path where packages will be installed.

To verify the current path, use:

kpm get-path

2. 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 enable

To disable it:

kpm unsafemode disable

3. Reinstalling KPM Client

If you need to reinstall or update the KPM client to the latest version, you can use the npm command:

kpm npm

This 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 login

Follow the prompts to log in securely.

Example Workflow

Here’s an example of a typical workflow using KPM in a project:

  1. Install Cmdr:

    kpm install cmdr
  2. Set a Custom Installation Path:

    kpm set-path C:/MyGame/KnightPackages
  3. Check for Updates for Cmdr:

    kpm check-update cmdr
  4. Update All Packages:

    kpm update
  5. Output Manifest for Cmdr:

    kpm output-manifest cmdr
  6. Log 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.