appium-boneyard / appium-plugins

Officially-maintained plugins for the Appium server
Apache License 2.0
32 stars 7 forks source link

Can we create typescript plugin? #19

Closed phamnhuvu-dev closed 3 years ago

phamnhuvu-dev commented 3 years ago

Sorry, I am not a master JS side.

I have a private typescript package. I want to use it in the plugin What I knew that it can't import typescript class into javascript class directly and hard. So can we create a typescript plugin?

Dharin-shah commented 3 years ago

Hey @phamnhuvu-dev, not sure completely what you mean Do you want to write your own plugin in typescript to be used with appium ?

phamnhuvu-dev commented 3 years ago

Do you want to write your own plugin in typescript to be used with appium ?

Yes

Dharin-shah commented 3 years ago

Do you want to write your own plugin in typescript to be used with appium ?

Yes

Yes you can write your own plugin in typescript and let the compiler take care of generating the build files. Just need to ensure that you export your plugin class. See https://github.com/appium/appium-plugins/blob/c48838b3ad14b2f7fc683e2dc748c4159927f374/packages/base/package.json#L21 as an example of exporting the main class

Basically you have to compile your plugin before installing or using it

phamnhuvu-dev commented 3 years ago

@Dharin-shah Tks, I got it.

jlipps commented 3 years ago

@phamnhuvu-dev it's definitely possible to write a typescript plugin. I am writing one myself. I also have a PR that will export typescript types for BasePlugin: https://github.com/appium/appium-plugins/pull/20/files