Skip to content

(WIP) Nest CLI doc #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 47 additions & 5 deletions docs/cli/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,55 @@
---
title: Nest CLI
sidebar_label: Introduction
title: Getting started
sidebar_label: Getting started
slug: /cli
---

:::caution Not a 404 but almost
:::caution Work in progress

This page is a work in progress.
Until the release of nest 1.0.0, the current CLI for nest is [eggs](../eggs/README.md).

In the future, [eggs](../eggs/README.md) will be a reference module manager that has first-class support for Nest including private modules. Other module managers can use this reference to integrate Nest into their software.

:::

[More info](https://github.com/nestdotland/cli)
The nest command line interface allows developers to easily create and publish modules on [nest.land](https://nest.land).

It's written in TypesScript, utilizing the power of Deno. It's lightweight yet efficient, and it provides an easy and safe way for developers to manage their modules.

### Install

```shell script
deno install -Afq https://nest.land/-/nest/nest.ts
```

### Publish

Log into your Nest account

```shell script
nest login <username> <auth_token>
```

:::note New to Nest.land?
[Create an account](https://nest.land/#).
:::

Initialize a nest module

```shell script
cd <module directory>
nest init <name> # follow the prompts
```

Publish to Nest

```shell script
nest publish <version>
```

You should now see your module on the [gallery](https://nest.land/gallery) !

## Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated. [Learn more](https://github.com/nestdotland/nest/blob/main/.github/CONTRIBUTING.md)

4 changes: 4 additions & 0 deletions docs/cli/cicd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: Continuous Integration / Continuous Development
sidebar_label: CI/CD
---
69 changes: 69 additions & 0 deletions docs/cli/commands/config/diff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
title: nest config diff
sidebar_label: diff
---

Show changes in local config.

```shell script
nest config diff
```

## Options

| options | description |
| ----------- | ---------------------------- |
| `-r, --remote` | Compare with remote config |

:::info
Compares the changes with the data.json file by default.
:::

## Examples

```shell script
nest config diff
nest config diff --remote
```

```diff
{
fullName: "Nest CLI",
description: "Nest's official CLI to manage your modules",
main: "nest.ts",
bin: [
"cli.ts",
+ "nest.js",
],
- logo: "assets/logo.png",
+ logo: "assets/nest.png",
homepage: "https://nest.land/x/author/module",
repository: "https://github.com/nestdotland/nest",
issues: "https://github.com/nestdotland/nest/issues",
license: "MIT",
- unlisted: false,
private: false,
keywords: [
"cli",
"registry",
"nest",
],
hooks: {
prepublish: "deno fmt --check",
- postpublish: "echo Success!",
presync: "sleep 3",
postsync: "cat .nest/module.json",
},
},
```
```diff
# List here the files and directories to be ignored, one by line as a glob expression.

- # Dotfiles are ignored by default.
+ # Dotfiles are ignored by default
.*

+ *_test.ts
+ .nest
+
```
27 changes: 27 additions & 0 deletions docs/cli/commands/config/pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: nest config pull
sidebar_label: pull
---

Fetch from and integrate with remote config. Your local changes will be merged with a diff algorithm. You will be warned if conflicts are found during the merge process.

```shell script
nest config pull
```

## Options

| options | description |
| ------------- | ---------------------- |
| `-f, --force` | Overwrite local config |

:::caution
Use the `--force` option only if you need to reset your local config. Resolving merge conflicts is preferable in most cases.
:::

## Examples

```shell script
nest config
nest config ---force
```
27 changes: 27 additions & 0 deletions docs/cli/commands/config/push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: nest config push
sidebar_label: push
---

Update remote config. By default you can only push your configuration if it is newer than the remote configuration or if you have previously pulled the changes.

```shell script
nest config push
```

## Options

| options | description |
| ------------- | ----------------------- |
| `-f, --force` | Overwrite remote config |

:::caution
Use the `--force` option only if you need to reset remote config. Resolving merge conflicts is preferable in most cases.
:::

## Examples

```shell script
nest config push
nest config push --force
```
27 changes: 27 additions & 0 deletions docs/cli/commands/config/status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: nest config status
sidebar_label: status
---

Show the current config status.

```shell script
nest config status
```

## Examples

```shell script
nest config status
```
```
i Local diff status:
- module.json modified
- ignore unchanged

i Remote diff status:
- module.json modified
- ignore modified

i Current config is newer than remote config
```
28 changes: 28 additions & 0 deletions docs/cli/commands/help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: nest help
sidebar_label: help
---

Show the global help or the help of a sub-command.

```shell script
nest help [...command]
```

## Arguments

| argument | description |
| ---------- | -------------------------- |
| ...command | A command or a sub-command |

:::info
Show the global help if no command is provided
:::

## Examples

```shell script
nest help
nest help login
nest help publish 1.2.5 --pre
```
43 changes: 43 additions & 0 deletions docs/cli/commands/init.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
title: nest init
sidebar_label: init
---

Initiate a new module for the nest.land registry. Will create the necessary configuration files.

```shell script
nest init
```

:::tip
Use [`nest setup`](./setup.md) if your module already exists !
:::

## Prompts

```script shell
Initialize directory ? >
```
Exits if `false`

```script shell
Link to an existing module? >
```

:::info
If you answer `yes`, behaves in the same way as the [`nest setup`](./setup.md) command.
:::

```script shell
Module name >
Module full name >
Description >
Homepage >
Homepage >
```

## Examples

```shell script
nest init
```
33 changes: 33 additions & 0 deletions docs/cli/commands/login.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: nest login
sidebar_label: login
---

Add an existing user account.

```shell script
nest login [username] [token]
```

:::note New to Nest.land?
[Create an account](https://nest.land/#).
:::

## Arguments

| argument | description |
| -------- | ------------- |
| username | A username |
| token | A login token |

:::info
If `[username]` or `[token]` is missing, you will be prompted to enter it.
:::

## Examples

```shell script
nest login
nest login me
nest login me OltCnjbXVnkNYIr60/4IvA==
```
27 changes: 27 additions & 0 deletions docs/cli/commands/logout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: nest logout
sidebar_label: logout
---

Remove an existing user account.

```shell script
nest logout [username]
```

## Arguments

| argument | description |
| -------- | ----------- |
| username | A username |

:::info
If `[username]` is missing, you will be prompted to enter it.
:::

## Examples

```shell script
nest logout
nest logout me
```
Loading