Git Product home page Git Product logo

rocket.chat.apps-cli's Introduction

Rocket.Chat Apps CLI

The Rocket.Chat Apps CLI for interacting with Apps.

Getting Started

Extremely simple.

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.

rc-apps create

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.

App description

The app description file, named app.json, contains basic information about the app. You can check the app-schema.json file for all the detailed information and fields allowed in the app description file, the basic structure is similar to this:

{
    "id": "5cb9a329-0613-4d39-b20f-cc2cc9175df5",
    "name": "App Name",
    "nameSlug": "app-name",
    "version": "0.0.1",
    "requiredApiVersion": "^1.4.0",
    "description": "App which provides something very useful for Rocket.Chat users.",
    "author": {
        "name": "Author Name <[email protected]>",
        "support": "Support Url or Email"
    },
    "classFile": "main.ts",
    "iconFile": "beautiful-app-icon.jpg"
}

Extending the App class

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.

import {
    IAppAccessors,
    IConfigurationExtend,
    IEnvironmentRead,
    ILogger,
} from '@rocket.chat/apps-engine/definition/accessors';
import { App } from '@rocket.chat/apps-engine/definition/App';
import { IAppInfo } from '@rocket.chat/apps-engine/definition/metadata';

export class TodoListApp extends App {
    constructor(info: IAppInfo, logger: ILogger, accessors: IAppAccessors) {
        super(info, logger, accessors);
    }

    public async initialize(configurationExtend: IConfigurationExtend, environmentRead: IEnvironmentRead): Promise<void> {
        await this.extendConfiguration(configurationExtend, environmentRead);
        this.getLogger().log('Hello world from my app');
    }
}

Packaging the 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

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
{
    url: string;
    username: string;
    password: string;
}
  1. Upload using personal access token and userId
{
    url: string;
    userId: string;
    token: string;
}

Enabling autocomplete for commands

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.

rocket.chat.apps-cli's People

Contributors

alendavid avatar cuonghuunguyen avatar d-gubert avatar debdutdeb avatar dependabot[bot] avatar gdelavald avatar geekgonecrazy avatar graywolf336 avatar hammyhavoc avatar heilerich avatar jasonfah avatar kaiiiiiiiii avatar lgtm-com[bot] avatar lucassartor avatar marceloschmidt avatar mrsimpson avatar ritwizsinha avatar rodrigok avatar shailesh351 avatar thassiov avatar thomasvuillaume avatar wreiske avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rocket.chat.apps-cli's Issues

erro initialize slashcommands

error on log rocketchat ao initializae slachcommands.

[ "{\"stack\":\"TypeError: Cannot read property 'toLowerCase' of undefined at AppSlashCommandManager.addCommand (/home/maxicon/Rocket.Chat/node_modules/@rocket.chat/apps-engine/server/managers/AppSlashCommandManager.js:82:43) at SlashCommandsExtend.provideSlashCommand (/home/maxicon/Rocket.Chat/node_modules/@rocket.chat/apps-engine/server/accessors/SlashCommandsExtend.js:9:45) at ManualApp.extendConfiguration (evalmachine.<anonymous>:10:37) at ManualApp.<anonymous> (/home/maxicon/Rocket.Chat/node_modules/@rocket.chat/apps-engine/definition/App.js:112:24) at Generator.next (<anonymous>) at /home/maxicon/Rocket.Chat/node_modules/@rocket.chat/apps-engine/definition/App.js:7:71 at new Promise (<anonymous>) at __awaiter (/home/maxicon/Rocket.Chat/node_modules/@rocket.chat/apps-engine/definition/App.js:3:12) at ManualApp.initialize (/home/maxicon/Rocket.Chat/node_modules/@rocket.chat/apps-engine/definition/App.js:111:16) at evalmachine.<anonymous>:1:-46 at ContextifyScript.Script.runInContext (vm.js:59:29) at Object.runInContext (vm.js:120:6) at ProxiedApp.runInContext (/home/maxicon/Rocket.Chat/node_modules/@rocket.chat/apps-engine/server/ProxiedApp.js:54:19) at ProxiedApp.<anonymous> (/home/maxicon/Rocket.Chat/node_modules/@rocket.chat/apps-engine/server/ProxiedApp.js:72:38) at Generator.next (<anonymous>) at /home/maxicon/Rocket.Chat/node_modules/@rocket.chat/apps-engine/server/ProxiedApp.js:7:71 at new Promise (<anonymous>) at __awaiter (/home/maxicon/Rocket.Chat/node_modules/@rocket.chat/apps-engine/server/ProxiedApp.js:3:12) at ProxiedApp.call (/home/maxicon/Rocket.Chat/node_modules/@rocket.chat/apps-engine/server/ProxiedApp.js:57:16) at AppManager.<anonymous> (/home/maxicon/Rocket.Chat/node_modules/@rocket.chat/apps-engine/server/AppManager.js:504:27) at Generator.next (<anonymous>) at /home/maxicon/Rocket.Chat/node_modules/@rocket.chat/apps-engine/server/AppManager.js:7:71 at new Promise (<anonymous>) at __awaiter (/home/maxicon/Rocket.Chat/node_modules/@rocket.chat/apps-engine/server/AppManager.js:3:12) at AppManager.initializeApp (/home/maxicon/Rocket.Chat/node_modules/@rocket.chat/apps-engine/server/AppManager.js:499:16) at AppManager.<anonymous> (/home/maxicon/Rocket.Chat/node_modules/@rocket.chat/apps-engine/server/AppManager.js:337:28) at Generator.next (<anonymous>) at fulfilled (/home/maxicon/Rocket.Chat/node_modules/@rocket.chat/apps-engine/server/AppManager.js:4:58) at /home/maxicon/.meteor/packages/promise/.0.11.2.1rxqxdq.d4m4g++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/meteor-promise/fiber_pool.js:43:40\",\"message\":\"Cannot read property 'toLowerCase' of undefined\"}" ]

Error in deploying App.Rasa - createRequire is not a function

Trying to deploy the App.Rasa application with the rc-apps and the error I get is:

Starting App Deployment to Server

  Getting Server Info... ✓
  Packaging the app... ✖
›   Error:    ⟿  createRequire is not a function

Any idea on why this is happening?

How to update app without losing association storage

I am developing an app which makes use of the RocketChatAssociationRecord for rooms.
When I try to deploy a new version, it fails with " › Error: ⟿ Error: Deployment error: App already exists.".
But if I uninstall the app first, it removes all associated storage.

How can I update an app without losing stored data?

Is there an "update" command, or a check for a new version number? Can't find either

Error while Packaging simple App - The "path" argument must be of type string. Received undefined

Tried building my first App. Followed the Tutorial here

All went well until adding a Slash Command and then packaging the App. On using the rc-apps deploy Command the App breaks on packaging with following Error:

PS C:\Users\49179\VSCProjects\testapp> rc-apps deploy
   Starting App Deployment to Server

   Getting Server Info... ✓
   Packaging the app... -
 > ../../AppData/Roaming/npm/node_modules/@rocket.chat/apps-cli/node_modules/@rocket.chat/apps-compiler/bundler/esbuild.js:47:92: error: [plugin: apps-engine] The "path" argument must be of type string. Received undefined
    47 │                         if (!/@rocket\.chat\/apps-engine/.test(args.path) && path_1.default.isAbsolute(nodeModulePath)) {
       ╵                                                                                             ^
    at validateString (internal/validators.js:120:11)
    at Object.isAbsolute (path.js:353:5)
    at C:\Users\49179\AppData\Roaming\npm\node_modules\@rocket.chat\apps-cli\node_modules\@rocket.chat\apps-compiler\bundler\esbuild.js:47:93
    at callback (C:\Users\49179\AppData\Roaming\npm\node_modules\@rocket.chat\apps-cli\node_modules\esbuild\lib\main.js:814:34)
    at handleRequest (C:\Users\49179\AppData\Roaming\npm\node_modules\@rocket.chat\apps-cli\node_modules\esbuild\lib\main.js:646:36)
    at handleIncomingPacket (C:\Users\49179\AppData\Roaming\npm\node_modules\@rocket.chat\apps-cli\node_modules\esbuild\lib\main.js:701:7)
    at Socket.readFromStdout (C:\Users\49179\AppData\Roaming\npm\node_modules\@rocket.chat\apps-cli\node_modules\esbuild\lib\main.js:578:7)
    at Socket.emit (events.js:315:20)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:271:9)

   ../../AppData/Roaming/npm/node_modules/@rocket.chat/apps-cli/node_modules/@rocket.chat/apps-compiler/bundler/esbuild.js:35:26: note: This error came from the "onResolve" callback registered here   
    35 │                     build.onResolve({ filter: /.*/ }, async (args) => {
       ╵                           ~~~~~~~~~
    at setup (C:\Users\49179\AppData\Roaming\npm\node_modules\@rocket.chat\apps-cli\node_modules\@rocket.chat\apps-compiler\bundler\esbuild.js:35:27)
    at handlePlugins (C:\Users\49179\AppData\Roaming\npm\node_modules\@rocket.chat\apps-cli\node_modules\esbuild\lib\main.js:738:23)
    at Object.buildOrServe (C:\Users\49179\AppData\Roaming\npm\node_modules\@rocket.chat\apps-cli\node_modules\esbuild\lib\main.js:1026:7)
    at C:\Users\49179\AppData\Roaming\npm\node_modules\@rocket.chat\apps-cli\node_modules\esbuild\lib\main.js:1801:17
    at new Promise (<anonymous>)
    at Object.build (C:\Users\49179\AppData\Roaming\npm\node_modules\@rocket.chat\apps-cli\node_modules\esbuild\lib\main.js:1800:14)
    at Object.build (C:\Users\49179\AppData\Roaming\npm\node_modules\@rocket.chat\apps-cli\node_modules\esbuild\lib\main.js:1655:51)
    at AppsCompiler.bundleCompilation [as bundler] (C:\Users\49179\AppData\Roaming\npm\node_modules\@rocket.chat\apps-cli\node_modules\@rocket.chat\apps-compiler\bundler\esbuild.js:14:41)
    at AppsCompiler.bundle (C:\Users\49179\AppData\Roaming\npm\node_modules\@rocket.chat\apps-cli\node_modules\@rocket.chat\apps-compiler\AppsCompiler.js:41:45)

   LiftoffApp.js:5:26: note: The plugin "apps-engine" was triggered by this import
     5 │ const liftoff_1 = require("./commands/liftoff");
       ╵                           ~~~~~~~~~~~~~~~~~~~~
Error: Cannot find module './commands/liftoff'
Require stack:
- C:\Users\49179\VSCProjects\testapp/app.json
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.resolve (internal/modules/cjs/helpers.js:78:19)
)
    at C:\Users\49179\AppData\Roaming\npm\node_modules\@rocket.chat\apps-cli\node_modules\@rocket.chat\apps-compiler\bundler\esbuild.js:46:58
    at callback (C:\Users\49179\AppData\Roaming\npm\node_modules\@rocket.chat\apps-cli\node_modules\esbuild\lib\main.js:814:34)
    at handleRequest (C:\Users\49179\AppData\Roaming\npm\node_modules\@rocket.chat\apps-cli\node_modules\esbuild\lib\main.js:646:36)
    at handleIncomingPacket (C:\Users\49179\AppData\Roaming\npm\node_modules\@rocket.chat\apps-cli\node_modules\esbuild\lib\main.js:701:7)
    at Socket.readFromStdout (C:\Users\49179\AppData\Roaming\npm\node_modules\@rocket.chat\apps-cli\node_modules\esbuild\lib\main.js:578:7)
    at Socket.emit (events.js:315:20)
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'C:\\Users\\49179\\VSCProjects\\testapp/app.json' ]
}
   Packaging the app... ✖
 »   Error:    ⟿  Build failed with 1 error:
 »   ../../AppData/Roaming/npm/node_modules/@rocket.chat/apps-cli/node_modules/@rocket.chat/apps-compiler/bundler/esbuild.js:47:92: error: [plugin: apps-engine] The "path" argument must be of type    
 »   string. Received undefined

Whenever I remove the part where it's extending the Configuration for the Slash Command everything runs well and get's uploaded to my test-server.

    protected async extendConfiguration(configuration: IConfigurationExtend): Promise<void> {
        await configuration.slashCommands.provideSlashCommand(new LiftoffCommand(this));
    }

The LiftoffCommand is 1:1 Copy from the Tutorial.

I am running this on:
@rocket.chat/apps-cli/1.10.1 win32-x64 node-v12.18.1

You can find a reproduction Repo here

rc-apps deployment error

Error: Deployment error: User does not have the permissions required for this action
[error-unauthorized]

Create Command Additions

  • Do some pre-checks such as ensuring the folder won't have any conflicts
  • Ask them whether they want the folder they're in or a subfolder created to be used
  • Move the existing templates out of the current code, they are all hard coded and inlined

Deployment using a proxy server

In a corporate environment, deployment using a proxy is not possible:

 ›   Error:    ⟿  Problems conecting to Rocket.Chat at  <some url which can only be reached via proxy>

The reason is that node-fetch does not natively support a proxy.

diagnostic.data is not a file

I'm new to writing extension and I'm quite lost.
When running rc-apps deploy --url http://localhost:3000 --username admin --password hunter1, I'm getting the error:

packaging your app... done
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: not a file: /home/user1/todo/rocketdb/diagnostic.data
    at /usr/local/lib/node_modules/@rocket.chat/apps-cli/node_modules/yazl/index.js:31:52
    at FSReqWrap.oncomplete (fs.js:153:5)

diagnostic.data is indeed not a file, it's a directory.
I'm using the rocketchat/rocket.chat.preview docker image.
Any help would be appreciated.

Provide a Watch & Deploy

Providing "watching" when developing an app and whenever a change is made (debounced of course) and it can compile plus package successfully, then it will be deployed to the instance setup.

Exclude test files from compiled app package

We have spec files in our app project which were being compiled into the deployed version of the app which the server was rejecting.

AFAIK test files shouldn't ever need to go to the server?

Pull request #42 created that addresses this issue.

package command broken on windows

Trying to create an app or package it throws this error on windows.

Error: absolute path: C:/Projects/rocket-apps/rocketcat/app.json
    at validateMetadataPath (C:/Projects/rocket-apps/rocketcat/node_modules/yazl/index.js:367:74)
    at ZipFile.addFile (C:/Projects/rocket-apps/rocketcat/node_modules/yazl/index.js:24:18)
    at AppPackager.zipItUp (C:/Projects/rocket-apps/rocketcat/node_modules/@rocket.chat/apps-cli/lib/misc/appPackager.js:39:17)

In the appPackager file if I replace...

const zipPath = realPath.replace(this.fd.folder + path.sep, '');

with

const zipPath = path.resolve(realPath).replace(this.fd.folder + path.sep, '');

It seems to work. Not sure where else needs fixing though. Haven't got very far yet but this allowed me to run rc-apps create and rc-apps package.

The issues is the slashes. In realPath they are / but in this.fd.folder they are \ so the replace never actually works.

Unable to deploy app with custom nameslug

After creating a new app with the rc-apps create command. I get the following app.json.

{
    "id": "f044466e-8540-4168-aa91-4cc94a3c860c",
    "version": "0.0.1",
    "requiredApiVersion": "^1.4.0",
    "iconFile": "icon.png",
    "author": {
        "name": "Mathieu Charest",
        "homepage": "http://localhost",
        "support": "http://localhost"
    },
    "name": "Draw.io",
    "nameSlug": "drawio",
    "classFile": "DrawIoApp.ts",
    "description": "Draw.io"
}

Then, I simply try to deploy the default created app with the rc-apps deploy command and I get

packaging your app... packaged!
deploying your app... !
Error: Deployment error: undefined
    at Deploy.asyncSubmitData (C:/Users/Mathieu/AppData/Roaming/npm/node_modules/@rocket.chat/apps-cli/lib/commands/deploy.js:100:19)
    at async Deploy.run (C:/Users/Mathieu/AppData/Roaming/npm/node_modules/@rocket.chat/apps-cli/lib/commands/deploy.js:47:9)
    at async Deploy._run (C:/Users/Mathieu/AppData/Roaming/npm/node_modules/@rocket.chat/apps-cli/node_modules/@oclif/command/lib/command.js:44:20)
    at async Config.runCommand (C:/Users/Mathieu/AppData/Roaming/npm/node_modules/@rocket.chat/apps-cli/node_modules/@oclif/config/lib/config.js:160:9)
    at async Main.run (C:/Users/Mathieu/AppData/Roaming/npm/node_modules/@rocket.chat/apps-cli/node_modules/@oclif/command/lib/main.js:21:9)
    at async Main._run (C:/Users/Mathieu/AppData/Roaming/npm/node_modules/@rocket.chat/apps-cli/node_modules/@oclif/command/lib/command.js:44:20)

The only way for me to deploy the app is changing the nameslug to an app that exists in the market. Like Appear.In.

{
    "id": "f044466e-8540-4168-aa91-4cc94a3c860c",
    "version": "0.0.1",
    "requiredApiVersion": "^1.4.0",
    "iconFile": "icon.png",
    "author": {
        "name": "Mathieu Charest",
        "homepage": "http://localhost",
        "support": "http://localhost"
    },
    "name": "Draw.io",
    "nameSlug": "appearin",
    "classFile": "DrawIoApp.ts",
    "description": "Draw.io"
}
packaging your app... packaged!
deploying your app... deployed!

rc-apps deploy fails "Error: Deployment error: Invalid Version: ^0.9.13"

rc-apps deploy
packaging your app... packaged!
What is the server's url (include https)?: https://removed/
What is the username?: wreiske
And, what is the password?: ******************************
deploying your app... !
Error: Deployment error: Invalid Version: ^0.9.13
    at Deploy.asyncSubmitData (/usr/local/lib/node_modules/@rocket.chat/apps-cli/lib/commands/deploy.js:75:19)

Deployment error: Debug Failure. False expression when deploy extension

Here is the package json of my extension

{
    "devDependencies": {
        "@rocket.chat/apps-engine": "^1.12.0",
        "@types/node": "^10.12.14",
        "tslint": "^5.10.0",
        "typescript": "^3.7.3"
    }
}

When i deploy app, i got the following problem. Pls help!

Error: Deployment error: Debug Failure. False expression.
    at Deploy.asyncSubmitData (/usr/local/lib/node_modules/@rocket.chat/apps-cli/lib/commands/deploy.js:100:19)
    at async Deploy.run (/usr/local/lib/node_modules/@rocket.chat/apps-cli/lib/commands/deploy.js:47:9)
    at async Deploy._run (/usr/local/lib/node_modules/@rocket.chat/apps-cli/node_modules/@oclif/command/lib/command.js:44:20)
    at async Config.runCommand (/usr/local/lib/node_modules/@rocket.chat/apps-cli/node_modules/@oclif/config/lib/config.js:172:9)
    at async Main.run (/usr/local/lib/node_modules/@rocket.chat/apps-cli/node_modules/@oclif/command/lib/main.js:21:9)
    at async Main._run (/usr/local/lib/node_modules/@rocket.chat/apps-cli/node_modules/@oclif/command/lib/command.js:44:20)

oEmbed Url Previews Handler

Idea

A Rocketlet can register a url it would like to add additional information to the request of the oEmbed information request.

Example

Rocketlet which allows for a GitHub authentication information to be attached to oEmbed requests out to GitHub, this way links to private repositories can have their information shown instead of showing nothing.

Deployment error: No App found by the provided id

When I try to deploy my app, I get this:

# rc-apps deploy --url http://localhost:3000 -i <userid> -t <token>
packaging your app... packaged!
deploying your app... !
    Error: Deployment error: No App found by the provided id: <id>

I got this error after doing the following:

  1. I successfully deployed and updated my app several times
  2. I added a setting to the configuration with configuration.settings.provideSetting() but didn't see it show up in the UI after an update, so...
  3. I uninstalled the app via the UI
  4. I tried to re-install it with the command pasted above (no --upgrade flag)

This is where I've hit the error. I've tried using the --upgrade flag, authenticating with username and password instead of ID and token, using -f to force (though I know that's for the Typescript compiler), restarting my Rocket.Chat server (it's a snap), etc - nothing has worked. I've also tried searching through issues and even code for where this is coming from - I see the error is returned by the /apps REST endpoint, but I can't find much more than that.

Typescript incompatibility with default app template

rc-apps create creates an app that depends on typescript 2.9.x, but that errors for me because DefinitelyTyped no longer supports typscript 2.9: DefinitelyTyped/DefinitelyTyped#47248

temp % rc-apps --version
@rocket.chat/apps-cli/1.7.2 darwin-x64 node-v15.0.1
temp % rc-apps create
Let's get started creating your app.
We need some information first:

   App Name: Foo
   App Description: Foo app
   Author's Name: Fooman
   Author's Home Page: http://foo.com
   Author's Support Page: http://foo.com
Creating a Rocket.Chat App in /Users/rowan/Nyaruka/temp/foo... done!
temp % cd foo
foo % npm install

up to date, audited 50 packages in 1s

3 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
foo % rc-apps package
packaging your app... !
 ›   Error: Error /Users/rowan/Nyaruka/temp/foo/node_modules/@types/node/assert.d.ts (2,60): Cannot find name 'asserts'.

I can make it work if I bump the typescript version to 3 or 4.

EACCES: permission denied with sudo in Ubuntu

sudo npm install -g @rocket.chat/apps-cli

[email protected] postinstall /usr/local/lib/node_modules/@rocket.chat/apps-cli/node_modules/esbuild
node install.js

Trying to install "esbuild-linux-64" using npm
Failed to install "esbuild-linux-64" using npm: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@rocket.chat/apps-cli/node_modules/esbuild/esbuild-qssd7mdeech'
Trying to download "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.12.29.tgz"
/usr/local/lib/node_modules/@rocket.chat/apps-cli/node_modules/esbuild/install.js:198
throw e;
^

Error: EACCES: permission denied, open '/usr/local/lib/node_modules/@rocket.chat/apps-cli/node_modules/esbuild/bin/esbuild__'
at Object.openSync (fs.js:498:3)
at Object.writeFileSync (fs.js:1529:35)
at installBinaryFromPackage (/usr/local/lib/node_modules/@rocket.chat/apps-cli/node_modules/esbuild/install.js:61:6)
at processTicksAndRejections (internal/process/task_queues.js:95:5) {
errno: -13,
syscall: 'open',
code: 'EACCES',
path: '/usr/local/lib/node_modules/@rocket.chat/apps-cli/node_modules/esbuild/bin/esbuild__'
}

package command creates zip with Javascript files that can't be uploaded

I'm new to RC app development so hope I'm not doing something silly here, but with #95 I can get rc-apps package to work with the default app template, but it creates a dist/foo_0.0.1.zip file with my FooApp.ts compiled to FooApp.js. Which means when I try to upload it into Rocket.Chat I get

Captura de Pantalla 2020-11-04 a la(s) 15 11 50

Not sure what the expected behavior should be here. Rocket.Chat instance info is:

Captura de Pantalla 2020-11-04 a la(s) 15 21 13

Ignore node_modules when linting

When re-using a node module, one does not have control over the packages while implementing the Rocketlet.
The dev-environment refusing the build due to linting errors, particularly in dependencies is not satisfying.

[09:53:41] 'lint-no-exit-ts' errored after 3.77 s
[09:53:41] Error in plugin 'gulp-tslint'
Message:
  /.../temporary-rocketlets-dev-environment/rocketlets/smarti/node_modules/http-status-enum/src/index.ts [43, 35]: Missing trailing comma.

Deployment error: Debug Failure. When trying to use npm modules

I cannot use certain libraries, like fs or form-data.

import FormData = require('form-data');
import { createReadStream } from "fs";

When i import them, and attempt to deploy the app i get the following error:

packaging your app... packaged!
deploying your app... !
Error: Deployment error: Debug Failure. False expression.
    at Deploy.asyncSubmitData (C:/Users/NEngetsberger/AppData/Roaming/npm/node_modules/@rocket.chat/apps-cli/lib/commands/deploy.js:100:19)
    at async Deploy.run (C:/Users/NEngetsberger/AppData/Roaming/npm/node_modules/@rocket.chat/apps-cli/lib/commands/deploy.js:47:9)
    at async Deploy._run (C:/Users/NEngetsberger/AppData/Roaming/npm/node_modules/@rocket.chat/apps-cli/node_modules/@oclif/command/lib/command.js:43:20)
    at async Config.runCommand (C:/Users/NEngetsberger/AppData/Roaming/npm/node_modules/@rocket.chat/apps-cli/node_modules/@oclif/config/lib/config.js:172:9)
    at async Main.run (C:/Users/NEngetsberger/AppData/Roaming/npm/node_modules/@rocket.chat/apps-cli/node_modules/@oclif/command/lib/main.js:22:9)
    at async Main._run (C:/Users/NEngetsberger/AppData/Roaming/npm/node_modules/@rocket.chat/apps-cli/node_modules/@oclif/command/lib/command.js:43:20)

What I want to do is to develop a slashcommand which readd the chat of a room and provides the conversation as a pdf "uploaded" into the room. I couldnt find any examples using the rocket.chat/apps-engine/definition types like IRoom etc. so I tried to create a file in the command's executor method and upload it via the Rocket.Chat REST API. Is There also any kind of log, i have got this error multiple times and can't really tell whats the specific problem.

Here is my package.json:

{
    "devDependencies": {
        "@rocket.chat/apps-engine": "^1.14.0",
        "tslint": "^5.10.0",
        "typescript": "^2.9.1"
    },
    "dependencies": {
        "@types/form-data": "^2.5.0",
        "@types/jspdf": "^1.3.3",
        "@types/node": "^14.0.5",
        "form-data": "^3.0.0",
        "jspdf": "^1.5.3"
    }
}

I do not know if what I am doing is straight off not possible, but i could not find any documentation to it.

Provide TypeScript Lint Again

With the revamp, there is currently no way to lint the TypeScript project. We should provide that again.

It was removed for a few reasons. First, to speed up the development of the cli. Secondly, due to moving towards a cli we expect App projects to lint themselves and we will soon provide a recommended tslint configuration which matches our tslint config.

Class hierarchy causes unexpected Typescript error

In my app I've included a class hierarchy with a base and a derived class in the same directory (./src). If I attempt to instantiate an instance of the derived class I see the following error when packaging the app:

❯ rc-apps package
packaging your app... !
    TypeError: Class extends value undefined is not a constructor or null

The code is valid and compiles if I use npx tsc.

See https://github.com/GJKrupa/rocketchat-cli-125 for an example

If I remove the call to the derived class constructor or remove the class hierarchy then the error goes away

Bundling in watch

The watch command doesn't bundle the app, this is a bug since the package command has called
const bundlingResult = await compiler.bundle();

Issue Logging in to Rocketchat Server

Description:

When trying to deploy https://github.com/RocketChat/Apps.Google.Calendar to our RocketChat Server via rc-apps deploy, an error occurs saying, "Error: Invalid username and password".

Steps to reproduce:

  1. Clone https://github.com/RocketChat/Apps.Google.Calendar.
  2. Open Terminal and cd into the clone directory and execute rc-apps deploy.
  3. Provide the CORRECT credentials.

Expected behavior:

App should be deployed successfully.

Actual behavior:

An error occurs saying, "Error: Invalid username and password
at Deploy.asyncSubmitData (~/.nvm/versions/node/v10.16.0/lib/node_modules/@rocket.chat/apps-cli/lib/commands/deploy.js:57:19)"

rc-apps-deploy-issue

Server Setup Information:

  • Version of Rocket.Chat Server: 1.3.2
  • Operating System: Linux
  • Deployment Method: Official Docker Image
  • Number of Running Instances: 3
  • DB Replicaset Oplog: Enabled
  • NodeJS Version: 8.11.4
  • MongoDB Version: 4.0.12

Use cli without interaction

I'd like to use the cli on a CI environment, thus I'd need to use all commands without any kind of interaction.

The basic functionality I'd like to have on CI would be:

  • login
    • I don't think there is a way to set any credentials or how to get an access token from Cloud
  • package
    • Working fine
  • submit
    • Need a way to pass the changelog and skip the "ready to submit" confirmation

These are the issues I've found so far.

Error when scaffolding new app - Cannot find name 'Buffer'

Description

I just wanted to setup a new blank app using rc-apps create and received the following error after filling out the prompts:

❯  216_rocketchat-app-otrs  rc-apps create
Let's get started creating your app.
We need some information first:

   App Name: OTRS Integration
   App Description: Automatically transforms OTRS ticket IDs into clickable URLs
   Author's Name: Jonas Friedmann
   Author's Home Page: https://frd.mn
   Author's Support Page: https://github.com/frdmn/rocketchat-app-otrs

 ›   Error: /Users/jonas/Development/216_rocketchat-app-otrs/otrs-integration/node_modules/@rocket.chat/apps-engine/definition/accessors/IUploadRead.d.ts (4,40):
 ›     Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`.
 ›   Error: /Users/jonas/Development/216_rocketchat-app-otrs/otrs-integration/node_modules/@rocket.chat/apps-engine/definition/accessors/IUploadRead.d.ts (5,41):
 ›     Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i @types/node`.
Creating a Rocket.Chat App in /Users/jonas/Development/216_rocketchat-app-otrs/otrs-integration... !
Error: invalid.
    at Create.run (/usr/local/lib/node_modules/@rocket.chat/apps-cli/lib/commands/create.js:52:19)
    at async Create._run (/usr/local/lib/node_modules/@rocket.chat/apps-cli/node_modules/@oclif/command/lib/command.js:44:20)
    at async Config.runCommand (/usr/local/lib/node_modules/@rocket.chat/apps-cli/node_modules/@oclif/config/lib/config.js:160:9)
    at async Main.run (/usr/local/lib/node_modules/@rocket.chat/apps-cli/node_modules/@oclif/command/lib/main.js:21:9)
    at async Main._run (/usr/local/lib/node_modules/@rocket.chat/apps-cli/node_modules/@oclif/command/lib/command.js:44:20)

Workaround

Running npm install @types/node within the current working directoy where the command (rc-apps create) was issues, fixes the problem.

Environment

  • OS: macOS 10.15.3
  • Node: v13.8.0
  • NPM: 6.13.7
  • @rocket.chat/apps-cli: latest/1.6.0

Error during deployment: "Invalid filename"

Hey there.
I'm trying to run the rc-apps deploy --update command and I get this error

Starting App Deployment to Server

   Getting Server Info... ✓
   Packaging the app... ✓
   Uploading App... ✖
 ›   Error:    ⟿  Error: Deployment error: Invalid filename

I get I might have a wrong filename but I can't see any way of getting a verbose logging.
I don't have many files, I just created the app and added a command and that's basically it.

Any suggestion?

This is my rc-apps version @rocket.chat/apps-cli/1.7.1 darwin-x64 node-v12.16.0

npm start fails (after fresh clone)

Hi together. I just cloned this repo and followed the steps to start the dev env. But unfortunately the following happens:

npm start

> @rocket.chat/[email protected] start /Users/mbachl/Projekte/Eigene/Rocket.Chat/Apps/Rocket.Chat.Apps-dev-environment
> gulp

gulp[27301]: ../src/node_contextify.cc:629:static void node::contextify::ContextifyScript::New(const FunctionCallbackInfo<v8::Value> &): Assertion `args[1]->IsString()' failed.
 1: node::Abort() [/usr/local/bin/node]
 2: node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, char const*, int, v8::Local<v8::Value>*, node::async_context) [/usr/local/bin/node]
 3: node::contextify::ContextifyScript::New(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
 4: v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo*) [/usr/local/bin/node]
 5: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<true>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
 6: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/bin/node]
 7: 0x25087a48427d
[1]    27300 abort      npm start

Just deleted the node_modules directory and ran npm install again:

npm install

> [email protected] install /Users/mbachl/Projekte/Eigene/Rocket.Chat/Apps/Rocket.Chat.Apps-dev-environment/node_modules/uws
> node-gyp rebuild > build_log.txt 2>&1 || exit 0

added 721 packages from 482 contributors and audited 2346 packages in 14.785s
found 59 vulnerabilities (24 low, 18 moderate, 17 high)
  run `npm audit fix` to fix them, or `npm audit` for details

Npm version: 6.1.0
Node version: v10.3.0

rc-apps submit throwing error

Hi,

When I try to perform rc-apps submit I get the following error:

$ rc-apps submit
packaging your app... !
 ›   Error: TypeScript compiler error(s) occurred

But when I do rc-apps package:

$ rc-apps package                                                                                                                                                                        
packaging your app... finished!

App packaged up at: /Users/mjovanovic/<redacted>/dist/remind_0.0.1.zip

I compered how compiler is invoked in submit and package command and found that checker flag in submit is flipped to negate - if there is no errors - report as error:

if (result.diagnostics.length && !flags.force) {

if (!report.diagnostics.length) {

Is this intentional?

Thanks

Invalid required api version

#: rc-apps submit
packaging your app... 
packaged!
fetching the available categories... fetched!
? What is the publisher's email address? 
? Please select the categories which apply to this App? Communication, Voice & Video
? Are you ready to submit? Yes
submitting your app... !
Error: Failed to submit the App: invalid required api version, ensure it is only numbers and periods (code: 165)
    at Submit.asyncSubmitData (~/.nvm/versions/node/v8.11.1/lib/node_modules/@rocket.chat/apps-cli/lib/commands/submit.js:115:19)
    at <anonymous>

requiredApiVersion: ^0.9.13

Version is declared the same way as in the demo of this repo description.

May I'm doing something wrong, but submitting without the ^ worked fine.

Unable to create app

Receiving error when attempting to run command: rc-apps create

`~/Projects/Rocket.Chat Apps$ rc-apps create
Let's get started creating your app.
We need some information first:

App Name: example
App Description: example
Author's Name: example
Author's Home Page: example
Author's Support Page: example

Creating a Rocket.Chat App in /Projects/Rocket.Chat Apps/example... !
TypeError: Cannot read property 'message' of undefined
at Create.catch (/usr/local/lib/node_modules/@rocket.chat/apps-cli/node_modules/@oclif/command/lib/command.js:86:18)
at Create._run (/usr/local/lib/node_modules/@rocket.chat/apps-cli/node_modules/@oclif/command/lib/command.js:48:29)`

`rc-apps -v

@rocket.chat/apps-cli/1.5.1 linux-x64 node-v10.16.3`

Create dist-folder on start

It's ignored as a dist should be, but

Error: ENOENT: no such file or directory, scandir 'dist'
    at Object.fs.readdirSync (fs.js:896:18)

should be avoided

deployment: Passing userId with `-i` has no effect

While the userId property in the .rcappsconfig can be used to log in (in combination with token), the documented -i option on the CLI is ignored when deploying an app.

You can reproduce this by passing dummy value to token and i, the cli will complain about the userid not being set

Multiple Rocketlets: Include Folder in log

When packaging a dev environment with multiple rocketlets, the log does not read which rocketlet is affected by the error message:

[08:30:20] Starting 'package-for-develop'...
[08:30:20] ✖ rocketlet.json has 7 validation error(s)
[08:30:20]    › Error: Missing required property: name

How to reproduce: Create a new folder in rocketlets, add a rocketlet.json with an empty object {} and run npm start

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.