Skip to content

Commit 719f47c

Browse files
committed
Init - Reduce package dependency, remove commands, and ...
1 parent 0beb510 commit 719f47c

69 files changed

Lines changed: 2473 additions & 14007 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,5 @@ out/
6969
Network Trash Folder
7070
Temporary Items
7171
.apdisk
72+
73+
legacy/*

README.md

Lines changed: 69 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,97 @@
1-
# Rocket.Chat Apps CLI
2-
The Rocket.Chat Apps CLI for interacting with Apps.
1+
# Rocket.Chat Apps CLI (v2)
32

4-
## Getting Started
5-
Extremely simple.
3+
Modernized `rc-apps` CLI focused on local app development, packaging, deployment, and scaffolding.
64

7-
```
8-
npm install -g @rocket.chat/apps-cli
9-
```
5+
## What Changed In v2
106

11-
## Rocket.Chat App Development
7+
- Legacy implementation is preserved under `legacy/` for reference.
8+
- Deprecated cloud/marketplace commands were removed from active CLI:
9+
- `login`
10+
- `logout`
11+
- `submit`
12+
- Modern Node.js baseline (`>=22.0.0`).
13+
- Lower runtime dependency surface using native Node APIs (`fetch`, `FormData`, `fs/promises`, `util.parseArgs`).
14+
- Cross-platform path handling improvements (Windows-safe path normalization).
1215

13-
### Logging Inside an App
14-
Due to limitations of NodeJS's `vm` package we have had to implement a custom logger class.
15-
To make usage of this you can use `this.getLogger()` and then do the normal `console` style logging.
16+
## Install
1617

17-
### `rc-apps create`
18+
```bash
19+
npm install -g @rocket.chat/apps-cli
20+
```
1821

19-
The development tools provide a command to quickly scaffold a new Rocket.Chat App, simply run `rc-apps create` and a new folder will be created inside the current working directory with a basic App which does nothing but will compile and be packaged in the `dist` folder.
22+
## Commands
2023

21-
### App description
24+
```bash
25+
rc-apps help
26+
```
2227

23-
The app description file, named `app.json`, contains basic information about the app. You can check the [app-schema.json](https://github.com/RocketChat/Rocket.Chat.Apps-engine/blob/master/src/definition/app-schema.json) file for all the detailed information and fields allowed in the app description file, the basic structure is similar to this:
28+
### Create App
2429

30+
```bash
31+
rc-apps create [name] [--description <text>] [--author <name>] [--support <urlOrEmail>] [--homepage <url>] [--skip-install]
2532
```
26-
{
27-
"id": "5cb9a329-0613-4d39-b20f-cc2cc9175df5",
28-
"name": "App Name",
29-
"nameSlug": "app-name",
30-
"version": "0.0.1",
31-
"requiredApiVersion": "^1.4.0",
32-
"description": "App which provides something very useful for Rocket.Chat users.",
33-
"author": {
34-
"name": "Author Name <author@email.com>",
35-
"support": "Support Url or Email"
36-
},
37-
"classFile": "main.ts",
38-
"iconFile": "beautiful-app-icon.jpg"
39-
}
33+
34+
### Package App
35+
36+
```bash
37+
rc-apps package [--project <path>] [--force] [--verbose] [--no-compile] [--experimental-native-compiler]
4038
```
4139

42-
### Extending the App class
40+
- `--no-compile`: package source files directly (no TypeScript compile/bundle). This is intended for manual marketplace review workflows.
41+
- `--experimental-native-compiler`: keep compile flow but use compiler native mode.
4342

44-
The basic creation of an App is based on extending the `App` class from the Rocket.Chat Apps _definition_ library. Your class also has to implement the constructor and optionally the `initialize` function, for more details on those check the [App definition documentation](https://rocketchat.github.io/Rocket.Chat.Apps-engine/classes/app.html).
43+
### Deploy App
4544

45+
```bash
46+
rc-apps deploy [--project <path>] --url <server> [--username <u> --password <p> | --userId <id> --token <t>]
4647
```
47-
import {
48-
IAppAccessors,
49-
IConfigurationExtend,
50-
IEnvironmentRead,
51-
ILogger,
52-
} from '@rocket.chat/apps-engine/definition/accessors';
53-
import { App } from '@rocket.chat/apps-engine/definition/App';
54-
import { IAppInfo } from '@rocket.chat/apps-engine/definition/metadata';
55-
56-
export class TodoListApp extends App {
57-
constructor(info: IAppInfo, logger: ILogger, accessors: IAppAccessors) {
58-
super(info, logger, accessors);
59-
}
60-
61-
public async initialize(configurationExtend: IConfigurationExtend, environmentRead: IEnvironmentRead): Promise<void> {
62-
await this.extendConfiguration(configurationExtend, environmentRead);
63-
this.getLogger().log('Hello world from my app');
64-
}
65-
}
48+
49+
### Watch + Auto Deploy
50+
51+
```bash
52+
rc-apps watch [--project <path>] --url <server> [auth flags] [--debounce 800]
6653
```
6754

68-
### Packaging the app
55+
### Generate Boilerplate
6956

70-
Currently the Rocket.Chat servers and Marketplace allow submission of zip files, these files can be created by running `rc-apps package` which packages your app and creates the zip file under `dist` folder.
57+
```bash
58+
rc-apps generate endpoint <ClassName> [--path /route]
59+
rc-apps generate slash-command <ClassName>
60+
rc-apps generate setting <setting_id>
61+
```
7162

72-
### Uploading the app
73-
For uploading the app you need add to the required parameters in the .rcappsconfig already created in the apps directory. It accepts two types of objects:-
63+
## Config File
7464

75-
1. Upload using username, password
65+
You can store deployment defaults in `.rcappsconfig` inside the app folder:
7666

77-
```
67+
```json
7868
{
79-
url: string;
80-
username: string;
81-
password: string;
69+
"url": "http://localhost:3000",
70+
"username": "admin",
71+
"password": "pass",
72+
"ignoredFiles": [
73+
"**/dist/**",
74+
"**/node_modules/**"
75+
]
8276
}
8377
```
84-
2. Upload using personal access token and userId
8578

86-
```
87-
{
88-
url: string;
89-
userId: string;
90-
token: string;
91-
}
79+
CLI flags override values from this file.
80+
81+
## Development
82+
83+
```bash
84+
npm install
85+
npm run build
86+
npm test
9287
```
9388

94-
### Enabling autocomplete for commands
89+
## Testing Checklist
9590

96-
To enable autocomplete for the apps cli use the command `rc-apps autocomplete <your-shell-type>` with the shell type as zsh or bash as the supported types. This would provide a step by step instruction to enable shell completion in your preferred shell.
91+
1. `npm run build` succeeds.
92+
2. `npm test` succeeds.
93+
3. On Windows, run `rc-apps package` inside a valid app and confirm zip generation in `dist/`.
94+
4. Verify `deploy` with both auth modes:
95+
- username/password
96+
- userId/token
97+
5. Verify `watch` redeploys after editing a `.ts` source file.

bin/rc-apps.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env node
2+
3+
require('../lib/index.js');

bin/run

Lines changed: 0 additions & 5 deletions
This file was deleted.

bin/run.cmd

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)