Skip to content

Commit

Permalink
Update README. Ready to release.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunoru authored Aug 17, 2022
1 parent cc7e30b commit 3e07bd6
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,19 @@ You need to have Julia v1.7+ installed to use this package.

## Installation

`NodeCall.jl` has not been registered yet, so you need to manually install it by its git source:

```julia
(v1.7) pkg> add https://github.com/sunoru/NodeCall.jl
] add NodeCall
```

You can then run the tests by:
It's recommended to test the package before using it:
```julia
(v1.7) pkg> test NodeCall
] test NodeCall
```

## Usage

With `using NodeCall`, a NodeJS instance will start in the current process. A new V8 Virtual Machine context
With `NodeCall.initialize()`, a NodeJS instance will start in the current process.
A new V8 Virtual Machine context
([`vm`](https://nodejs.org/docs/latest-v16.x/api/vm.html) in the standard library of NodeJS)
is automatically created.

Expand All @@ -39,10 +38,13 @@ And JavaScript code can be run with `node_eval` or `@node_str`
```julia
julia> using NodeCall

# This is not required if you are using NodeCall from REPL.
julia> NodeCall.initialize();

julia> node_eval("console.log('Hello, world!')")
Hello, world!

julia> x = 5
julia> x = 5;
julia> node"2 * $x"
10.0
```
Expand All @@ -55,7 +57,7 @@ julia> os.type()
"Linux"
```

To install a NPM package, use something like this:
To install a package from NPM, use something like this:
```julia
julia> NPM.install("boxen");

Expand All @@ -73,7 +75,7 @@ And then you can use the installed package as if you are writing JavaScript.
In this example, `node_import` or `@node_import` should be used since `boxen` is an ES Module.

```julia
# `node_import` is like the function-like dynamic import in js, so it is asynchronous and should be awaited.
# `node_import` is like the function-like dynamic import in JS, so it is asynchronous and should be awaited.
julia> boxen = (@await node_import("boxen")).default;

# or you can use module style import declaration with `@node_import` macro.
Expand Down

2 comments on commit 3e07bd6

@sunoru
Copy link
Owner Author

@sunoru sunoru commented on 3e07bd6 Aug 17, 2022

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/66439

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.0.0 -m "<description of version>" 3e07bd6e7494b2d84743052e5b6f8a51ae5f8cf0
git push origin v1.0.0

Please sign in to comment.