RocketChat / Rocket.Chat.Apps-engine

The Rocket.Chat Apps engine and definitions.
https://rocketchat.github.io/Rocket.Chat.Apps-engine/
MIT License
117 stars 118 forks source link

Compiling to broken code #163

Open dbrekelmans opened 5 years ago

dbrekelmans commented 5 years ago

I'm running rc-apps deploy on the latest release.

It seems to compile my valid typescript to some broken code. It looks like it cannot resolve the import properly.

I reverted rc-apps to 1.4.0 (on which I had this code successfully working 4 months ago) and the same thing happened. Maybe it has something to do with the typescript version I'm using (3.6.3)?

import {IConfigurationExtend, IEnvironmentRead} from '@rocket.chat/apps-engine/definition/accessors';
import {App} from '@rocket.chat/apps-engine/definition/App';
import {RemindCommand} from './command/RemindCommand';

export class Reminder extends App {
    protected async extendConfiguration(
        configuration: IConfigurationExtend,
        environmentRead: IEnvironmentRead,
    ): Promise<void> {
        await configuration.slashCommands.provideSlashCommand(new RemindCommand());
    }
}
Screenshot 2019-10-09 at 10 51 05

I'm running this in a docker container:

FROM node:latest

RUN npm install -g typescript @rocket.chat/apps-cli

This is my directory structure, just to confirm to you that the RemindCommand.ts exists.

Screenshot 2019-10-09 at 11 01 36

And my app.json

{
    "id": "c839f5a6-65fa-4d17-b819-17d5c06f550f",
    "version": "0.0.1",
    "requiredApiVersion": "^1.4.0",
    "iconFile": "res/icon.png",
    "name": "reminder",
    "nameSlug": "reminder",
    "classFile": "src/Reminder.ts",
    "description": "Set reminders for a user or channel with the /remind command."
}
graywolf336 commented 5 years ago

All the CLI does it zips up the files, it doesn't actually compile anything to javascript and keeps it as TypeScript. @d-gubert any idea for what's going on?

d-gubert commented 5 years ago

I've never seen this happen 🤔

Can you check the zip file generated by the deploy command and validate that it has only typescript code?

The docker image you're using is solely for executing the CLI?

dbrekelmans commented 5 years ago

@d-gubert I can confirm that the files in the zip are identical to the source files.

Yes, I have this docker image so I don't have to install node and other dependencies on my machine. In a different container I run the rocketchat server, though that should not matter.

I made my repo public so you can have a look and see if you can reproduce this issue. https://github.com/dbrekelmans/reminder-rc-app

dbrekelmans commented 5 years ago

This seems like a bug in the apps-engine to me since it the cli only zips the files. Would you like me to repost this issue there?

shiqimei commented 5 years ago

Hi @dbrekelmans , which apps-engine version do you use?

dbrekelmans commented 5 years ago

Hi @lolimay, in my package.json I put ^1.6.0, so the latest version.

You can use my repo to reproduce this issue: https://github.com/dbrekelmans/reminder-rc-app