0

I want to install an NPM package from Github so that it can be used in SAPUI5, WebIde Framework.

Package: https://github.com/commenthol/date-holidays/blob/master/README.md#usage

First Problem In order to import a Library there should be a File with the Library so it can be copy-pasted in WebIde in the backend.

Second Problem The Usage - Part: should this piece of Text be part of the Frontend?

Third Problem: Copyright https://github.com/commenthol/date-holidays/blob/master/LICENSE: Author states that it can be used, unless the copyright notice and permission notice appear in all copies. Now if you inspect a Page created by SAPUI5 /NodeJS, you will never ever see any commentaries that were done in the WEBIDE, is it necessary to state it in the Code as a commentary if nobody will see it?

Fourth Thing on the side: For Example: npm install express, will Install data into package.json, how do i make it install for example express Pack into example.json instead of package.json?

Marc
  • 6,051
  • 5
  • 26
  • 56
Roman_Mr1112
  • 53
  • 2
  • 12

1 Answers1

0

Here you go, the package is available on npm as date-holidays
you can do npm i date-holidays
If you want to install package from github you install it by
npm i git+https://github.com/commenthol/date-holidays
After that
var Holidays = require(date-holidays); var hd = new Holidays(); hd.getStates('US');
and so on, you can use the library as may like.

  • Thank you! Also a question on the side. If for example you add to package.json into to dependencies something like "date-holidays": "1.4.2", than will you with the operation npm install date-holidays, get the package? – Roman_Mr1112 Sep 12 '19 at 09:30
  • if you add the package to package.json, then you only need to run the command npm i or npm install and the package will be installed – Muhammad Zia Sep 12 '19 at 09:33
  • i added "date-holidays": "1.4.2" - to package.json dependencies. There are more dependencies but i would like to only install the date-holidays – Roman_Mr1112 Sep 12 '19 at 09:45
  • then, first remove `date-holidays` and do `npm i date-holidays -s`, after running this command `date-holidays` will be added to package.json – Muhammad Zia Sep 12 '19 at 10:11
  • what does the npm i do?, the i part i am most interested. Is that just a shortcut for i=install? – Roman_Mr1112 Sep 12 '19 at 10:11
  • yes `i` is short for `install` and similarly `-s` is `--save` – Muhammad Zia Sep 12 '19 at 10:12
  • will npm uninstall date-holidays undo all the packages regarding date-holidays? – Roman_Mr1112 Sep 12 '19 at 10:14
  • yes `npm uninstall date-holidays` will remove the package – Muhammad Zia Sep 12 '19 at 10:16
  • Ok npm i date-holidays gives out a fkton of Errors , seems to now work, or the package is questionable – Roman_Mr1112 Sep 12 '19 at 10:22
  • npm ERR! code ECONNREFUSED; npm ERR! FetchError: request: bunch of text/date-holidays failed, reason: connect ECONNREFUSED – Roman_Mr1112 Sep 12 '19 at 10:31
  • are you able to install other packages ? I've found this link https://stackoverflow.com/questions/24244684/npm-install-not-work – Muhammad Zia Sep 12 '19 at 10:39
  • I found another Way: just add "date-holidays": "1.4.2" to package.json and restart backend, refresh Workspace. It will automaticlly pull a folder with all the Data – Roman_Mr1112 Sep 12 '19 at 11:01