Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stencila/node
Stencila for Node.js
https://github.com/stencila/node
Last synced: 5 days ago
JSON representation
Stencila for Node.js
- Host: GitHub
- URL: https://github.com/stencila/node
- Owner: stencila
- License: apache-2.0
- Created: 2016-09-13T06:09:53.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-05T03:12:26.000Z (over 6 years ago)
- Last Synced: 2024-08-01T12:33:29.665Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 3.43 MB
- Stars: 10
- Watchers: 4
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starred - stencila/node - Stencila for Node.js (others)
README
## Stencila for Node.js
[![NPM](http://img.shields.io/npm/v/stencila-node.svg?style=flat)](https://www.npmjs.com/package/stencila-node)
[![Build status](https://travis-ci.org/stencila/node.svg?branch=master)](https://travis-ci.org/stencila/node)
[![Build status](https://ci.appveyor.com/api/projects/status/ipj7s8hm82809lj9/branch/master?svg=true)](https://ci.appveyor.com/project/nokome/node/)
[![Code coverage](https://codecov.io/gh/stencila/node/branch/master/graph/badge.svg)](https://codecov.io/gh/stencila/node)
[![Dependency status](https://david-dm.org/stencila/node.svg)](https://david-dm.org/stencila/node)
[![Chat](https://badges.gitter.im/stencila/stencila.svg)](https://gitter.im/stencila/stencila)### Install
```bash
npm install stencila-node --global --python=python2.7
```This package relies on dependencies with native add-ons (e.g. `better-sqlite3`, `xeromq`). So you will need to have `node-gyp` installed (https://github.com/nodejs/node-gyp#readme). The `--python` flag is necessary because, on OSX and Windows, `node-gyp` is only compatible with Python 2.7.
Register this Stencila package,
```
stencila-node register
```This creates a host manifest file in the Stencila hosts directory (e.g. `~/.stencila/hosts/node.js` on Linux). This file is used by Stencila Desktop and other packages to determine which Stencila hosts you have installed on your machine.
### Use
This package lets you run JavaScript and other code from inside Stencila documents. First, you need to start serving the Stencila Host within this package. You can do that at a terminal,
```bash
stencila-node
```or inside Node.js:
```js
const stencila = require('stencila-node')
stencila.run()
```This will serve a Stencila `Host` on localhost. You can then open your Stencila document from within the [Stencila Desktop](https://github.com/stencila/desktop). The host will be automatically detected by the desktop app and you'll be able to execute Javascript code cells from within your documents.
You can also use this package to compile libraries of Javascript functions for use within Stencila:
```bash
stencila-node compile "~/stencila/source/libcore/"
```This creates a minified Javascript bundle, in this example at `"~/stencila/source/libcore/libcore.min.js`
API documentation is available at https://stencila.github.io/node.
### Discuss
We love feedback. Create a [new issue](https://github.com/stencila/node/issues/new), add to [existing issues](https://github.com/stencila/node/issues) or [chat](https://gitter.im/stencila/stencila) with members of the community.
### Contribute
See [CONTRIBUTING.md](CONTRIBUTING.md).