Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a short explaining about plugins usages #7031

Closed
wants to merge 1 commit into from

Conversation

jiraguha
Copy link

Solving #7030

[dependencies]
...

deno_core = { path = "../core" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not how you'd usually add deno_core.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, outside the deno project we rely on the Rust community’s crate registry! Change done

Copy link
Member

@littledivy littledivy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR title says explaining plugin usage but this looks more like a tutorial to how to build the test_plugin 😅


```js
// in test.js
const rid = Deno.openPlugin(<path to *.dylib>);
Copy link
Member

@littledivy littledivy Aug 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lib is not always a.dylib.

Windows: .dll
Linux: .so
MacOS: .dylib

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree

└── test.js
```

It is a rust repo.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be specified?


```rust
// in lib.rs
fn op_test_sync(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also cover op_test_async

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

async ops are managed the same way!

#[no_mangle]
pub fn deno_plugin_init(interface: &mut dyn Interface) {
interface.register_op("testSync", op_test_sync);
...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testAsync

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

#### 4- build your lib with cargo : `cargo build -p <name of the crate>`

```shell
$ cargo build -p test_plugin --release
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just cargo build --release should be enough

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and why not?

@jiraguha
Copy link
Author

jiraguha commented Aug 22, 2020

The PR title says explaining plugin usage but this looks more like a tutorial to how to build the test_plugin 😅

I do not agree! test_plugin is a good start to check... If you have other ideas, please suggest something!

@ebebbington
Copy link
Contributor

I think it's a really good idea to actually explain how to create a simple test plugin, what it uses, how it works, what these methods do etc. Then a user can use this information to be confident enough to build whatever they want

@bartlomieju
Copy link
Member

@jiraguha thank you for the PR, but I'm gonna close it without a merge. In light of #8490 it's not yet clear if we want to add documentation for plugins or remove them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants