mirror of
https://github.com/qlik-oss/nebula.js.git
synced 2025-12-23 11:44:10 -05:00
* docs: linking nebula docs * docs: apply suggestions from code review * Update docs/installation.md Co-authored-by: Li Kang <kkllpaul7766@gmail.com> Co-authored-by: Christian Veinfors <christian.veinfors@gmail.com>
76 lines
2.6 KiB
Markdown
76 lines
2.6 KiB
Markdown
---
|
|
id: installation
|
|
title: Installation
|
|
---
|
|
|
|
All `nebula.js` modules are available on the public npm registry as npm packages and can be installed through either npm or as a script import.
|
|
|
|
`@nebula.js/stardust` is the primary module that you will be using and is required when integrating `nebula.js` on the web.
|
|
|
|
## Script import
|
|
|
|
The easiest way to load the module is from a CDN like `jsdelivr`:
|
|
|
|
```html
|
|
<script src="https://cdn.jsdelivr.net/npm/@nebula.js/stardust" crossorigin></script>
|
|
```
|
|
|
|
When imported using the script tag, it will add the variable `stardust` to the global namespace.
|
|
|
|
For production, it is recommended to use a specific version of the module to avoid surprises from newer or breaking versions of the APIs:
|
|
|
|
```html
|
|
<script src="https://cdn.jsdelivr.net/npm/@nebula.js/stardust@0.6.0" crossorigin></script>
|
|
```
|
|
|
|
## Npm or yarn
|
|
|
|
If you are building your own web project using Webpack, Rollup, Parcel or similar you can install the package with npm:
|
|
|
|
```bash
|
|
$ npm install @nebula.js/stardust
|
|
```
|
|
|
|
or yarn:
|
|
|
|
```bash
|
|
$ yarn add @nebula.js/stardust
|
|
```
|
|
|
|
and then import `{ embed }` wherever you intend to embed a visualization:
|
|
|
|
```js
|
|
import { embed } from '@nebula.js/stardust';
|
|
```
|
|
|
|
## CLI
|
|
|
|
`nebula.js` provides a CLI for quickly getting started with a project and provides a development server to help you during the
|
|
development phase.
|
|
|
|
```bash
|
|
$ npm install @nebula.js/cli
|
|
```
|
|
|
|
## Development builds
|
|
|
|
Some modules are available as a development build which provide more errors and warnings when detecting potentially bad usage of the APIs.
|
|
You should only use these during the development phase of your project, never in production.
|
|
|
|
```html
|
|
<script src="https://cdn.jsdelivr.net/npm/@nebula.js/stardust@0.6.0/dist/stardust.dev.js" crossorigin></script>
|
|
```
|
|
|
|
## Linking nebula packages to your own repository
|
|
|
|
When you use nebula.js as a dependency in your project, and you want to edit or debug the nebula.js source code, you can use either `npm link` or `yarn link` to accomplish this.
|
|
|
|
### Linking nebula when using `nebula serve`
|
|
|
|
With `npm`: Before using `nebula serve` to serve your project's files, you must run `npm link` in the folder: `nebula.js/commands/serve` and use it in your own repo by running `npm link @nebula.js/cli-serve` (run this in your own repo).
|
|
To include source maps, so you can easier debug the nebula.js code, you should also run `yarn build:dev` in the `nebula.js/commands/serve` folder.
|
|
|
|
With `yarn`: Same as for `npm` but replace `npm` with `yarn` in the commands above.
|
|
|
|
In your browser's debugging tool you should now be able to see the nebula.js source code and to add breakpoints inside of the nebula.js files.
|