Przeglądaj źródła

npm init -y

npm install frappe-charts

buildignore: node_modules, package*.json
gitignore: node_modules
master
Garrick Aden-Buie 6 lat temu
rodzic
commit
256f0ca112
5 zmienionych plików z 88 dodań i 0 usunięć
  1. +3
    -0
      .Rbuildignore
  2. +1
    -0
      .gitignore
  3. +57
    -0
      dev/dev.Rmd
  4. +13
    -0
      package-lock.json
  5. +14
    -0
      package.json

+ 3
- 0
.Rbuildignore Wyświetl plik

@@ -1,2 +1,5 @@
^.*\.Rproj$
^\.Rproj\.user$
^node_modules$
^package\.json$
^package-lock\.json$

+ 1
- 0
.gitignore Wyświetl plik

@@ -1 +1,2 @@
.Rproj.user
node_modules

+ 57
- 0
dev/dev.Rmd Wyświetl plik

@@ -1,3 +1,5 @@
## Setup R Package

Create a package for this HTML widget.
We're not going to publish this, so you can call it whatever you want

@@ -13,4 +15,59 @@ file.create("dev/dev.R")
rstudioapi::navigateToFile("dev/dev.R")
```

## Setup npm package

Same process again, but this time for npm.

```bash
npm init

# or

npm init -y
```

Open `package.json` and take a look

```json
{
"name": "frappecharts",
"version": "0.0.1",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT"
}
```

From Frappe Charts [docs#installation](https://frappe.io/charts/docs#installation):

```bash
npm install frappe-charts
```

We now have a dependency in `package.json` and there's a `package-lock.json` file.

```json
"dependencies": {
"frappe-charts": "^1.3.0"
}
```

## Ignore node_modules but add package-lock

There's also a `node_modules/` folder with `frappe-charts/` inside.
Add `node_modules` to `.Rbuildignore` and `.gitignore`.
(BTW, you can and are supposed to commit `package-lock.json`.)

```{r ignore-node-module}
usethis::use_build_ignore("node_modules")
usethis::use_build_ignore("package.json")
usethis::use_build_ignore("package-lock.json")
usethis::use_git_ignore("node_modules")
```



+ 13
- 0
package-lock.json Wyświetl plik

@@ -0,0 +1,13 @@
{
"name": "frappecharts",
"version": "0.0.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"frappe-charts": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/frappe-charts/-/frappe-charts-1.3.0.tgz",
"integrity": "sha512-hdLv4fOIVgIL5eV9KYlsQaEpxkcJvuEVVDJewJL8PG0ySPy5EEiG5KZGL2uj7YegVWbtsqJ4Oq/74mjgQoMdag=="
}
}
}

+ 14
- 0
package.json Wyświetl plik

@@ -0,0 +1,14 @@
{
"name": "frappecharts",
"version": "0.0.1",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT",
"dependencies": {
"frappe-charts": "^1.3.0"
}
}

Ładowanie…
Anuluj
Zapisz