Skip to content
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
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
lib/
dist/
node_modules/
coverage/
package-lock.json
*.lock
3 changes: 3 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
...require('@oclif/prettier-config'),
}
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Rocket.Chat Apps CLI

The Rocket.Chat Apps CLI for interacting with Apps.

## Getting Started

Extremely simple.

```
Expand All @@ -11,6 +13,7 @@ npm install -g @rocket.chat/apps-cli
## Rocket.Chat App Development

### Logging Inside an App

Due to limitations of NodeJS's `vm` package we have had to implement a custom logger class.
To make usage of this you can use `this.getLogger()` and then do the normal `console` style logging.

Expand Down Expand Up @@ -69,7 +72,8 @@ export class TodoListApp extends App {

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.

### Uploading the app
### Uploading the app

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:-

1. Upload using username, password
Expand All @@ -81,7 +85,8 @@ For uploading the app you need add to the required parameters in the .rcappsconf
password: string;
}
```
2. Upload using personal access token and userId

2. Upload using personal access token and userId

```
{
Expand Down
37 changes: 34 additions & 3 deletions bin/run
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
#!/usr/bin/env node

require('@oclif/command').run()
.then(require('@oclif/command/flush'))
.catch(require('@oclif/errors/handle'))
const oclif = require('@oclif/core')
const { flush } = require('@oclif/core/flush')
const { handle: defaultHandle } = require('@oclif/core/handle')
const { settings } = require('@oclif/core/settings')

const DEBUG_FLAGS = new Set(['--debug-errors', '--stacktrace', '--verbose-errors'])

const argv = process.argv
const prunedArgv = argv.slice(0, 2)
let showDetailedErrors = Boolean(process.env.RC_APPS_DEBUG && /^(1|true|yes)$/i.test(process.env.RC_APPS_DEBUG))

for (let i = 2; i < argv.length; i += 1) {
const arg = argv[i]
if (DEBUG_FLAGS.has(arg)) {
showDetailedErrors = true
continue
}

prunedArgv.push(arg)
}

if (prunedArgv.length !== argv.length) {
process.argv = prunedArgv
}

settings.debug = showDetailedErrors

oclif
.run()
.then(() => flush())
.catch(async (error) => {
await flush()
return defaultHandle(error)
})
26 changes: 26 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const js = require('@eslint/js')
const typescript = require('typescript-eslint')
const prettier = require('eslint-config-prettier')

module.exports = [
js.configs.recommended,
...typescript.configs.recommended,
prettier,
{
files: ['**/*.ts'],
rules: {
'@typescript-eslint/no-unused-vars': ['error', {argsIgnorePattern: '^_'}],
'no-console': 'warn',
'prefer-const': 'error',
},
},
{
files: ['test/**/*.ts'],
rules: {
'no-console': 'off',
},
},
{
ignores: ['lib/', 'dist/', 'node_modules/', 'coverage/', '**/*.js', '*.d.ts'],
},
]
Loading