2023-08-27 01:04:35 -04:00
# ncc Documentation
2022-05-24 20:32:15 -04:00
2023-10-08 19:16:03 -04:00
This document serves the purpose of presenting the documentation for using/developing ncc, from basic installation,
basic usage, standards, and much more.
2022-05-24 20:32:15 -04:00
## Table of contents
2023-01-29 23:27:56 +00:00
<!-- TOC -->
2023-08-27 01:04:35 -04:00
* [ncc Documentation ](#ncc-documentation )
2023-01-29 23:27:56 +00:00
* [Table of contents ](#table-of-contents )
* [Introduction ](#introduction )
2023-10-08 19:16:03 -04:00
* [What is ncc? ](#what-is-ncc )
* [How does ncc work? ](#how-does-ncc-work )
* [What do I need to use ncc? ](#what-do-i-need-to-use-ncc )
* [How do I get started? ](#how-do-i-get-started )
* [Building & installing ncc ](#building--installing-ncc )
* [Building from source ](#building-from-source )
* [Requirements to build ](#requirements-to-build )
* [Installing phpab ](#installing-phpab )
* [Building ncc ](#building-ncc )
* [Redist ](#redist )
* [Tar ](#tar )
* [Debian ](#debian )
* [Building ncc for docker ](#building-ncc-for-docker )
* [Installing ncc ](#installing-ncc )
* [Command line arguments ](#command-line-arguments )
* [Uninstalling ncc ](#uninstalling-ncc )
* [Conventions ](#conventions )
* [Package Naming ](#package-naming )
* [Remote Package Syntax (RPS) ](#remote-package-syntax-rps )
* [ncc cli ](#ncc-cli )
* [Project Management (project) ](#project-management-project )
* [Creating a new project (create) ](#creating-a-new-project-create )
* [Applying Templates (template) ](#applying-templates-template )
* [Package Management (package or pkg) ](#package-management-package-or-pkg )
* [Listing Installed Packages (list) ](#listing-installed-packages-list )
* [Installing Packages (install) ](#installing-packages-install )
* [Uninstalling Packages (uninstall) ](#uninstalling-packages-uninstall )
* [Uninstalling All Packages (uninstall-all) ](#uninstalling-all-packages-uninstall-all )
* [Fix Broken Packages (fix-broken) ](#fix-broken-packages-fix-broken )
2023-01-29 23:27:56 +00:00
<!-- TOC -->
2022-05-24 20:32:15 -04:00
2023-10-08 19:16:03 -04:00
------------------------------------------------------------------------------------------------------------------------
2023-01-29 23:27:56 +00:00
## Introduction
2022-05-24 20:32:15 -04:00
2023-08-27 01:04:35 -04:00
This section serves the basic introduction of ncc, what it's used for and how you can use it in your own projects or use
it to run and build other projects that are designed to be used with ncc.
2022-05-24 20:32:15 -04:00
2023-10-08 19:16:03 -04:00
### What is ncc?
ncc (*Acronym for **N**osial **C**ode **C**ompiler*) is a multipurpose compiler, package manager and toolkit. Allowing
2023-01-29 23:27:56 +00:00
projects to be managed and built more easily without having to mess with all the traditional tools that comes with your
2023-08-27 01:04:35 -04:00
language of choice. Right now ncc only supports PHP as it's written in PHP but extensions for other languages/frameworks
2023-01-29 23:27:56 +00:00
can be built into the software in the future when the need comes for it.
2023-08-27 01:04:35 -04:00
ncc can make the process of building your code into a redistributable package much more efficient by treating each
2023-01-29 23:27:56 +00:00
building block of your project as a component that is interconnected in your environment instead of the more popular
2023-10-08 19:16:03 -04:00
route taken by package/dependency managers such as [composer ](https://getcomposer.org/ ) which attempts to copy what [npm ](https://www.npmjs.com/ ) does but for
PHP, which is not a bad thing, but it's not the best approach for PHP and its ecosystem.
### How does ncc work?
ncc's command-line interface serves as the central hub for managing your projects and packages. This CLI empowers you to
perform tasks like project creation, package installation, and project building.
When you compile your project, it generates a "ncc package" file with a ".ncc" extension. This unique file consolidates
all essential project files, including the utilized components. Optionally, you have the flexibility to create a static
version of your project that contains all dependencies and components, simplifying deployment and execution across
different machines through a single file.
ncc harnesses these packages to install its dependencies and components globally, akin to how Composer installs packages
into a project's vendor directory. However, in ncc's case, it installs them into a global directory accessible to other
projects. Moreover, ncc can retrieve packages from various remote sources, including GitHub, GitLab, Gitea, and even
Packagist. If ncc cannot locate a specific ncc package for a dependency or package, it will attempt to build it from
source using the package's source code. Additionally, ncc features a compatibility layer for Composer packages, enabling
you to install them without needing to install or use Composer itself.
You can imagine ncc as apt-get for PHP, but with a few extra features that make it more powerful and flexible.
### What do I need to use ncc?
ncc is a command-line tool, so you will need to be familiar with using the command-line interface. You will also need to
have PHP 8.0+ installed on your machine, along with the following PHP extensions:
- php-mbstring
- php-ctype
- php-common (covers tokenizer & posix among others)
- php-zip
These extensions are required for ncc to function properly, if you don't have these extensions installed, ncc may not
work correctly or may suffer from performance issues. For instance, `php-ctype` & `php-mbstring` are required for ncc
however, they will still work without them thanks to Symfony's polyfill library, but it's recommended to install the
extensions for better performance.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
### How do I get started?
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
[RTFM ](https://en.wikipedia.org/wiki/RTFM ), this documentation is a good place to start, it covers everything you need
to know about ncc and how to use it.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
------------------------------------------------------------------------------------------------------------------------
# Building & installing ncc
ncc must be built from source before it can be installed, this is because ncc is a PHP application and PHP applications
are not compiled into machine code, instead, they are compiled into a redistributable source that can be installed on
the machine. This includes the auto-loader files that ncc needs to locate its components and dependencies.
## Building from source
Building ncc from source is easy with very few requirements to start building. At the moment, ncc can only be debugged or
tested by building a redistributable source and installing it.
### Requirements to build
2023-01-29 23:27:56 +00:00
- php8.0+
- php-mbstring
- php-ctype
- php-common (covers tokenizer & posix among others)
- make
- phpab
- tar *(optional)*
2023-10-08 19:16:03 -04:00
For building different variants, such as building a debian package, you will need to install the required tools for that
specific variant. For more information, check the [Makefile ](Makefile ) for the required tools for a specific variant.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
### Installing phpab
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
phpab is also known as [PHP Autoload Builder ](https://github.com/theseer/Autoload ), phpab is an open-source tool used
for creating autoload files, ncc needs this tool in order to generate its autoload files whenever there are any changes
to its source code. This tool is only required for building and or creating a redistributable package of ncc.
This component is not required to be installed to use ncc.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
for some components that require static loading, ncc will automatically load it using its own [autoloader ](src/autoload/autoload.php )
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
The recommended way to install phpab is by using [phive ](https://phar.io/ ), if you don't have phive installed, you can
2023-01-29 23:27:56 +00:00
install it by running these commands in your terminal (from the official documentation)
```shell
wget -O phive.phar https://phar.io/releases/phive.phar
wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79
gpg --verify phive.phar.asc phive.phar
chmod +x phive.phar
sudo mv phive.phar /usr/local/bin/phive
```
Once phive is installed, you can run the final command to install phpab
```shell
sudo phive install phpab --global
```
or you can run this command to install it locally
```shell
phive install phpab
```
**Note:** Optionally, you may want to have `phab` available in your `$PATH` , this can be done with this command.
*(Replace `x.xx.x` with your version number)* this is if you installed it locally
```shell
ln -s /home/user/.phive/phars/phpab-x.xx.x.phar /usr/local/bin/phpab
```
2023-10-08 19:16:03 -04:00
### Building ncc
2023-01-29 23:27:56 +00:00
2023-08-27 01:04:35 -04:00
First, navigate to the main directory of ncc's source code where the [Makefile ](Makefile ) is present. If you
2023-01-29 23:27:56 +00:00
already attempted to or had built ncc before, it's recommended to use `make clean` before building.
2023-10-08 19:16:03 -04:00
#### Redist
2023-01-29 23:27:56 +00:00
Running `redist` from the Makefile will generate all the required autoloader for ncc and move all the required files
into one redistributable source folder under a directory called `build/src`
```shell
make redist
```
2023-10-08 19:16:03 -04:00
#### Tar
2023-01-29 23:27:56 +00:00
Running `tar` will run redist before packaging the redistributable source into a tar.gz file that can be distributed to
other machines, this process is not a requirement.
```shell
make tar
```
2023-10-08 19:16:03 -04:00
#### Debian
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
Running `deb` will run `redist` before packaging the redistributable source into a debian package that can be installed
on debian based machines, this process is not a requirement.
2023-01-29 23:27:56 +00:00
```shell
2023-10-08 19:16:03 -04:00
make deb
2023-01-29 23:27:56 +00:00
```
2023-10-08 19:16:03 -04:00
Once you have a populated `build/ncc_x.x.x` folder, you can simply run execute the `installer` file to install your build
of ncc onto the running machine.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
> Note: you may need to run `sudo` before executing the installer file.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
------------------------------------------------------------------------------------------------------------------------
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
## Building ncc for docker
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
ncc is also available for docker, you can build ncc for docker by running the `docker-debian` or `docker-alpine` make
tasks, this will build ncc for docker and create a docker image that you can use to run ncc.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
```shell
make docker-debian docker-alpine
```
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
The respective docker files are located in
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
- [Dockerfile Debian ](Dockerfile.debian )
- [Dockerfile Alpine ](Dockerfile )
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
You may also run and test these docker builds with the `docker-debian-run` and `docker-alpine-run` make tasks.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
```shell
make docker-debian-run docker-alpine-run
```
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
> Contributor Note: contributions are welcomed here to expand ncc's docker support to other distros and to improve the
> existing docker files.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
------------------------------------------------------------------------------------------------------------------------
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
## Installing ncc
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
Installing ncc is easy, you can either download the redistributable source from the [releases ](https://git.n64.cc/nosial/ncc/-/releases )
page or you can build it from source using the instructions above.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
Once you have the redistributable source, you can simply run execute the `INSTALL` file to install ncc onto the running
machine. usually this installation process will require root privileges, so it's recommended to run the installer with
`sudo` or as root.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
### Command line arguments
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
The installer accepts a few command line arguments that can be used to alter the installation process.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
`--help` Displays the help message
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
`--bypass-cli-check` Bypasses the check in the installer that checks if the installer is being run from the command
line, this is useful if you want to install ncc from a script.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
`--bypass-checksum` Bypasses the checksum check in the installer, this is useful if you made modifications to the
installation files and want to install a modified version of ncc. But this isn't recommended, and the proper way to
do this is to modify the source code and build ncc from source, the Makefile task will automatically rebuild the
checksum file for you.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
## Uninstalling ncc
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
Uninstalling ncc is easy, simply delete the directory where ncc was installed to, by default this is `/etc/ncc` .
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
It's recommended to run `ncc package --uninstall-all` before uninstalling ncc, this will uninstall all the packages
that were installed using ncc and remove any artifacts that is installed on the system such as symlink registrations
and so on.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
**Note:**
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
- To delete all the data that ncc has created, you can also delete the `/usr/share/ncc` directory.
- Finally, remove the symlink that was created in `/usr/bin` to the `ncc` entry point file.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
------------------------------------------------------------------------------------------------------------------------
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
# Conventions
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
This section covers the conventions that ncc uses for its source code, documentation, and other things.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
## Package Naming
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
ncc follows a package naming convention that is inspired by Java's package naming convention. This convention is
designed to ensure clarity, avoid naming conflicts, and make it easier to identify the origin of packages. Below
are the key rules for naming packages in ncc:
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
- The package name must be in all lowercases
- The package name must be in reverse domain notation
- The package name must be separated by a dot `.`
- The package name must not contain any special characters other than '-' or '_'
- The package name must not contain any spaces
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
In PHP, similar to Java, package naming conventions follow the reversed domain notation. This means that a package name,
such as "symfony/process" in Composer, is transformed into "com.symfony.process" in PHP. The components of the package
name are separated by dots (".") to create a hierarchical structure.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
It's essential to adhere to specific guidelines when naming packages in PHP:
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
- **Character Limitation**: Package names should consist of only hyphens ("-") or underscores ("_") as special
characters. This restriction ensures compatibility with both file systems and package management tools.
- **Avoiding Spaces**: Spaces should be avoided in package names. The inclusion of spaces can lead to confusion and
compatibility issues. Instead, use hyphens or underscores if spacing is necessary within a package name.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
## Remote Package Syntax (RPS)
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
Remote packages are packages that are hosted on a remote source, such as GitHub, GitLab, Gitea, and so on. ncc uses
a special syntax for specifying remote packages, this syntax is called Remote Package Syntax or RPS for short.
This syntax is simply a query to tell ncc what package to install and where to install it from. This syntax is used when
installing packages from the command-line or defining dependencies in a project's package.json file.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
The syntax for RPS is as follows:
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
```
< vendor > /< package-name > =< version > @< repository >
2023-01-29 23:27:56 +00:00
```
2023-10-08 19:16:03 -04:00
| Component | Description |
|----------------|---------------------------------------------------------------------------------------------------------------|
| `<vendor>` | The vendor name of the package, this is usually the username or organization name on the source eg; symfony |
| `<package>` | The package name, this is the name of the package eg; console |
| `<version>` | The version of the package to install, this can be a version number or simply "latest" for the latest version |
| `<repository>` | The repository to install the package from, this has to be a name of a repository that's configured in ncc |
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
**Note:** The version number can be omitted, in which case ncc will install the latest version of the package.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
Here are some examples of RPS:
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
```text
symfony/console=latest@packagist # installs the latest version of symfony/console from packagist
johndoe/hello_world=latest@github # installs the latest version of hello_world from github
2023-01-29 23:27:56 +00:00
```
2023-10-08 19:16:03 -04:00
For instances like Gitlab where organizations may have subgroups, you can specify the subgroup by using a dot (".")
to separate the group name from the subgroup name.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
```text
nosial/libs.config@n64 # installs the latest version of ConfigLib from n64
nosial/libs.config=1.0.0@n64 # installs version 1.0.0 of ConfigLib from n64
```
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
------------------------------------------------------------------------------------------------------------------------
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
# ncc cli
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
ncc's command-line interface serves as the central hub for managing your projects and packages. This CLI empowers you to
perform tasks like project creation, package installation, and project building.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
## Project Management (project)
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
The command `project` provides a set of commands for managing projects, such as creating a new project and applying
a builtin template to a project. This part of the documentation will guide you through the process of creating a new
project and applying a template to it both for CLI-based projects and library projects.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
### Creating a new project (create)
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
To create a new project, you can use the `project create` command, this command will create a new project in the current
working directory. You must specify details about the project you want to create, such as the project name, package name,
and the compiler extension to use.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
| Option | Required | Example | Description |
|----------------------|----------|---------------------|---------------------------------------------------------------------------------------------------------------|
| `--name` , `-n` | Yes | ExampleProject | The name of the project |
| `--package` , `--pkg` | Yes | com.example.project | The package name to use, see [Package Naming ](#package-naming ) for more information |
| `--path` , `-p` | No | example_project | The directory to create/use to initialize the project in, if not provided then `--name` would be used instead |
2023-01-29 23:27:56 +00:00
```shell
2023-10-08 19:16:03 -04:00
ncc project create --name ExampleProject --package com.example.project
2023-01-29 23:27:56 +00:00
```
2023-10-08 19:16:03 -04:00
Once the project is created, will see a new directory with the name of the project you specified, this directory will
contain the project's source code and other files that are required for the project to function properly, more importantly
it will contain the `package.json` file which is the project's configuration file that ncc uses to manage and build
the project.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
### Applying Templates (template)
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
Templates are used to apply a predefined structure to a project, this is not a requirement but makes it easier to get
started with a project. ncc comes with a few builtin templates that you can use to create a project
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
| Template Name | Description |
|---------------|---------------------------------------------|
| `phpcli` | A template for creating a CLI-based project |
| `phplib` | A template for creating a library project |
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
To apply a template, simply use the `project template` command, this command will apply a template to the project in
the current working directory or the directory specified by the `--path` option.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
| Option | Required | Example | Description |
|----------------|----------|-----------------|------------------------------------------------------------------------------------------------------------------------------------|
| `--name` , `-n` | Yes | phpcli | The name of the template to apply |
| `--path` , `-p` | No | example_project | The directory to create/use to apply the the template to, if not provided then the current working directory would be used instead |
2023-01-29 23:27:56 +00:00
```shell
2023-10-08 19:16:03 -04:00
ncc project template --name phpcli
2023-01-29 23:27:56 +00:00
```
2023-10-08 19:16:03 -04:00
Once the template is applied, you will see additional files and directories created by ncc; these files and directories
are part of the template and are required for the project to function properly, your project.json file will also be
updated to reflect the changes made by the template.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
## Package Management (package or pkg)
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
The command `package` provides a set of commands for managing packages, such as installing packages and uninstalling
packages, `pkg` is an alias for `package` and can be used interchangeably.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
> **Note:** that most of these operations requires root privileges, so it's recommended to run ncc with `sudo` or as root.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
### Listing Installed Packages (list)
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
To list all the installed packages, you can use the `package list` command, this command will list all the installed
packages and their versions.
2023-01-29 23:27:56 +00:00
```shell
2023-10-08 19:16:03 -04:00
$ ncc package list
com.symfony.console=2.0.7
com.symfony.polyfill_php72=v1.28.0
com.symfony.http_kernel=2.0.7
com.symfony.event_dispatcher=2.0.7
Total: 4 packages
2023-01-29 23:27:56 +00:00
```
2023-10-08 19:16:03 -04:00
### Installing Packages (install)
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
To install a package, you can use the `package install` command, this command will install the specified package and
all its dependencies. There are two ways to install a package, you can either install a package from a remote source
or install a package from a local source such as a local .ncc file.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
| Option | Required | Example | Description |
|-----------------------|----------|-----------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `--package` , `-p` | Yes | `symfony/process=latest@packagist` or `com.example.package.ncc` | The package to install it can be a remote package or a local package, see [Remote Package Syntax (RPS) ](#remote-package-syntax-rps ) for more information when installing a remote package |
| `--version` , `-v` | No | `1.0.0` or `latest` | The version of the package to install, defaults to `latest` |
| `--reinstall` | No | Not Applicable | Reinstall the package even if it's already installed |
| `--skip-dependencies` | No | Not Applicable | Skips installing the package's dependencies |
| `-y` | No | Not Applicable | Skips the confirmation prompt when installing a package |
2023-01-29 23:27:56 +00:00
```shell
2023-10-08 19:16:03 -04:00
ncc package install -p symfony/process=latest@packagist -y
2023-01-29 23:27:56 +00:00
```
2023-10-08 19:16:03 -04:00
> **Note** When installing a package from a local file such as a packge.ncc file, ncc will display information about
> the package and ask you to confirm the installation before installing the package, but for remote packages, ncc will
> cannot display this information without downloading the package first, so it will ask you to confirm the installation
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
### Uninstalling Packages (uninstall)
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
To uninstall a package, you can use the `package uninstall` command, this command will uninstall the specified package.
If you don't specify a version, ncc will uninstall all versions of the package.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
| Option | Required | Example | Description |
|-------------------|----------|------------------------------------------------|----------------------------------------------------------------------------------|
| `--package` , `-p` | Yes | `com.example.package` or `com.symfony.process` | The package to uninstall |
| `--version` , `-v` | No | `1.0.0` or `latest` | The version to uninstall, if not specified then all versions will be uninstalled |
| `-y` | No | Not Applicable | Skips the confirmation prompt when uninstalling a package |
2023-01-29 23:27:56 +00:00
```shell
2023-10-08 19:16:03 -04:00
ncc package uninstall -p symfony/process -v 1.0.0 -y
2023-01-29 23:27:56 +00:00
```
2023-10-08 19:16:03 -04:00
### Uninstalling All Packages (uninstall-all)
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
To uninstall all packages, you can use the `package uninstall-all` command, this command will uninstall all the packages
that were installed using ncc. This command does not accept any options other than `-y` to skip the confirmation prompt.
2023-01-29 23:27:56 +00:00
```shell
2023-10-08 19:16:03 -04:00
ncc package uninstall-all -y
2023-01-29 23:27:56 +00:00
```
2023-10-08 19:16:03 -04:00
### Fix Broken Packages (fix-broken)
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
To fix broken packages, you can use the `package fix-broken` command, this command will attempt to fix or uninstall
packages that are broken. This command does not accept any options other than `-y` to skip the confirmation prompt.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
The command does the following checks
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
- Check each package to see if they are broken eg; missing files, or any other unrecoverable error that would
prevent the package from being loaded correctly, these packages will be uninstalled.
- Check each package's dependencies to see if they are installed, if not, it will try to determine all the missing
dependencies.
2023-01-29 23:27:56 +00:00
2023-10-08 19:16:03 -04:00
```shell
ncc package fix-broken -y
```