Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

74 Zeilen
1.4KB

  1. ## Setup R Package
  2. Create a package for this HTML widget.
  3. We're not going to publish this, so you can call it whatever you want
  4. ```{r create-package}
  5. usethis::create_package("frappeCharts")
  6. ```
  7. Add a dev script for notes
  8. ```{r dev}
  9. dir.create("dev")
  10. file.create("dev/dev.R")
  11. rstudioapi::navigateToFile("dev/dev.R")
  12. ```
  13. ## Setup npm package
  14. Same process again, but this time for npm.
  15. ```bash
  16. npm init
  17. # or
  18. npm init -y
  19. ```
  20. Open `package.json` and take a look
  21. ```json
  22. {
  23. "name": "frappecharts",
  24. "version": "0.0.1",
  25. "description": "",
  26. "main": "index.js",
  27. "scripts": {
  28. "test": "echo \"Error: no test specified\" && exit 1"
  29. },
  30. "author": "",
  31. "license": "MIT"
  32. }
  33. ```
  34. From Frappe Charts [docs#installation](https://frappe.io/charts/docs#installation):
  35. ```bash
  36. npm install frappe-charts
  37. ```
  38. We now have a dependency in `package.json` and there's a `package-lock.json` file.
  39. ```json
  40. "dependencies": {
  41. "frappe-charts": "^1.3.0"
  42. }
  43. ```
  44. ## Ignore node_modules but add package-lock
  45. There's also a `node_modules/` folder with `frappe-charts/` inside.
  46. Add `node_modules` to `.Rbuildignore` and `.gitignore`.
  47. (BTW, you can and are supposed to commit `package-lock.json`.)
  48. ```{r ignore-node-module}
  49. usethis::use_build_ignore("node_modules")
  50. usethis::use_build_ignore("package.json")
  51. usethis::use_build_ignore("package-lock.json")
  52. usethis::use_git_ignore("node_modules")
  53. ```