Skip to content

Commit

Permalink
Updating doc
Browse files Browse the repository at this point in the history
  • Loading branch information
nshiab committed Oct 9, 2024
1 parent 808b902 commit f523952
Showing 1 changed file with 12 additions and 48 deletions.
60 changes: 12 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To use the library in your browser, check out [simple-data-analysis-flow](https:
Create a folder and run [setup-sda](https://github.com/nshiab/setup-sda):

```bash
# Deno
# Deno >= 2.x.x
deno run -A jsr:@nshiab/setup-sda

# Node.js
Expand All @@ -30,7 +30,7 @@ There is one option:
You can now run the code below to run `main.js` or `main.ts` and watch for changes.

```bash
# Deno
# Deno >= 2.x.x
deno task sda

# Node.js
Expand All @@ -40,56 +40,24 @@ npm run sda
bun run sda
```

## With Node.js
## Manual installation

To install from NPM:
If you want to add the library to an existing project, here's how.

```
npm i simple-data-analysis
```

To run a `.js` file:

```
node main.js
```

To run a `.ts` file with Node.js v22.6.0 or higher:

```
node --experimental-strip-types main.ts
```
```bash
# Deno >= 2.x.x
deno install --node-modules-dir=auto --allow-scripts=npm:duckdb jsr:@nshiab/simple-data-analysis

## With Bun
# To run with Deno
deno run --node-modules-dir=auto -A main.ts

To install from NPM:
# Node.js
npm i simple-data-analysis

```
# Bun
bun add simple-data-analysis
```

To run a `.js` or `.ts` file:

```
bun run index.js
```

## With Deno

You need Deno v2.0.0 or higher. It's strongly recommended to install and enable the [Deno extension](https://docs.deno.com/runtime/getting_started/setup_your_environment/).

To install from JSR:

```
deno install --node-modules-dir=auto --allow-scripts=npm:duckdb jsr:@nshiab/simple-data-analysis
```

To run:

```
deno run --node-modules-dir=auto -A main.ts
```

## Core principles

SDA is born out of the frustration of switching between Python, R, and JavaScript to produce data journalism projects. Usually, data crunching and analysis are done with Python or R, and interactive data visualizations are coded in JavaScript. However, being proficient in multiple programming languages is hard. Why can't we do everything in JS?
Expand Down Expand Up @@ -462,7 +430,3 @@ import { SimpleWebDB } from "./node_modules/simple-data-analysis/dist/bundle.js"
You can also import the minified bundle with a npm-based CDN like [esm.sh](https://esm.sh/).

You'll find an example [here](https://github.com/nshiab/simple-data-analysis/blob/main/examples/index.html). You can copy and paste the code into an HTML file. You can also adapt it to any bundler or framework of your choice.

### Others

If you want to generate and save charts with Deno, Bun or Node.js, check the [journalism library](https://github.com/nshiab/journalism), more specifically the [savePlotChart function](https://nshiab.github.io/journalism/functions/savePlotChart.html).

0 comments on commit f523952

Please sign in to comment.