Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(docs): write some docs on the new CLI
Most of it is not yet built, but should work as described once done.
- Loading branch information
Showing
8 changed files
with
220 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Actions and defaults | ||
|
||
Compas will do a few things automatically for you when it is running. These are | ||
called integrations. Some of them only run once configured. Others are enabled | ||
by default. | ||
|
||
By default, Compas will watch your package.json files and determine if it needs | ||
to reinstall your dependencies. This way your local environment always matches | ||
the required dependency versions. | ||
|
||
Other actions, like automatically spinning up development dependencies in Docker | ||
need to be configured explicitly. See the respective integrations for how this | ||
works. | ||
|
||
## Configuration | ||
|
||
Compas is configurable via a JSON file at `config/compas.json`. An empty config | ||
file is automatically created in your project when you run Compas. In this | ||
config file, you can configure custom actions. These actions will be available | ||
when Compas is running and can be executed via the configured shortcuts. | ||
|
||
```json | ||
{ | ||
"actions": [ | ||
{ | ||
"name": "Lint", | ||
"shortcut": "L", | ||
"command": ["npm", "run", "lint"] | ||
} | ||
] | ||
} | ||
``` | ||
|
||
Now when you press 'L' when Compas is running, it will run the defined command | ||
and return back to the menu. When a process is running, you can restart it with | ||
'R' or kill the running process by pressing 'K'. | ||
|
||
The configuration file is automatically reloaded on changes, assuming that the | ||
syntax is correct. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Getting started | ||
|
||
::: danger | ||
|
||
This is still in development. In some cases, docs exist but the features haven't | ||
been released yet. | ||
|
||
Provide feedback and suggestions in | ||
https://github.com/compasjs/compas/issues/2774. | ||
|
||
::: | ||
|
||
::: warning | ||
|
||
This documentation uses `compas` as the CLI tool. However, to not interfere with | ||
the stable [CLI](/features/cli.md), the alpha CLI is called `zakmes`. | ||
|
||
::: | ||
|
||
## Installation | ||
|
||
Compas can install itself with: | ||
|
||
```shell | ||
npx compas@latest install | ||
``` | ||
|
||
**In an empty directory**: | ||
|
||
Compas creates a package.json, installs the necessary dependencies via npm and | ||
initializes a Git repository. | ||
|
||
**Existing project**: | ||
|
||
Compas infers the used package manager (npm, yarn or pnpm), adds itself as a | ||
dependency and executes an installation. If Compas is already installed in your | ||
project, Compas will try to update itself to the latest available version. | ||
|
||
::: info | ||
|
||
In the alpha period, use `npx -p compas zakmes@latest install`. | ||
|
||
::: | ||
|
||
Off to a great start! | ||
|
||
## Development setup | ||
|
||
For development, we recommend setting up an 'alias' in your local login file | ||
(`.bashrc`, `.zshrc`, etc). This allows you to execute `compas` with a prefix | ||
like `npx compas` or `yarn compas`. | ||
|
||
Add the following line to your `~/.bashrc` or `~/.zhsrc` (or the corresponding | ||
file for your shell). | ||
|
||
::: code-group | ||
|
||
```shell [npm] | ||
alias compas='npx compas' | ||
``` | ||
|
||
```shell [yarn] | ||
alias compas='yarn compas' | ||
``` | ||
|
||
```shell [pnpm] | ||
alias compas='pnpm compas' | ||
``` | ||
|
||
::: | ||
|
||
Close and reopen your terminal for this to take effect. | ||
|
||
::: info | ||
|
||
As an early user, you probably want to add another variant for `zakmes`. | ||
|
||
::: | ||
|
||
## Usage | ||
|
||
```shell | ||
compas | ||
``` | ||
|
||
That is it. Let's take a look at some of the things that Compas will do by | ||
default. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Docker | ||
|
||
- `compas init docker` | ||
- Config file | ||
- Resetting the containers |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# What is Compas? | ||
|
||
- New CLI | ||
- Existing packages | ||
- Existing CLI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Workspaces | ||
|
||
Compas comes with out-of-the-box support for workspaces. All | ||
[actions and defaults](/docs/actions-and-defaults.html) from the previous | ||
chapter are executed for the known projects in a workspace. Allowing you to run | ||
Compas once and get the benefits for all projects that you are working on | ||
simultaneously. | ||
|
||
## Enabling workspaces | ||
|
||
The configuration file `config/compas.json` allows you to define related | ||
projects, for example: | ||
|
||
```json [config/compas.json] | ||
{ | ||
"projects": ["packages/shared"] | ||
} | ||
``` | ||
|
||
This registers a sub project in `$root/packages/shared`. All automatic actions | ||
that Compas executes are now also done relative to that directory. You can | ||
create another config in `$root/packages/shared/config/compas.json` to define | ||
custom actions for that specific project and to add even more nested projects. | ||
|
||
Compas also allows projects to be in a sibling directory: | ||
|
||
```json [config/compas.json] | ||
{ | ||
"projects": ["../project-frontend"] | ||
} | ||
``` | ||
|
||
In this case, the sibling directory is optional and not loaded if it can not be | ||
found. It is also allowed to create recursive project references, so you can set | ||
up Compas in all individual projects, and it automatically includes the other | ||
projects when they are found. Giving the same experience no matter which project | ||
you are currently working on. | ||
|
||
## Limitations | ||
|
||
- Compas only supports a single package manager (npm, yarn or pnpm) in a | ||
workspace. | ||
- Compas assumes that nested projects are also setup correctly in your package | ||
manager and only runs installation (e.g `npm install`) in the root project. | ||
For sibling projects, Compas runs the package manager in all individual | ||
projects, but it is still limited to a single package manager. | ||
- Compas stores its cache in the project that you started Compas in and removes | ||
the cache from referenced projects. This way Compas has a single source of | ||
truth. So the most efficient way of developing is to always start Compas from | ||
the same project and to navigate inside Compas to other projects when | ||
necessary. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters