1

I have to write a library for my app, that can be imported in the other application that I will make. In there will be a lot of functionality related to the get or post with my rest api. The first think that I have see in google is to publish my code on npm, but I cannot publish there. So I have looked at this example:

How to install an npm package from GitHub directly?

So I have writed my package.json this way:

 "dependencies": {
    "@angular/animations": "^5.1.0",
    ...
    "myRepo": "git+https://MyUser@git.myRepo.git",

  }

And it works,but when I make npm install it download only package.json and readme.md file and nothing else (At the moment in the repo there are a few o file and one directory with one file inside).

Can you help me with this?

Thanks a lot!

My package.json inside the repo that I want to install looks like:

{
  name: "myPackage",
  version: "1.0.0"
}

And the file in this repo:

directory/
    jsfile.js
package.json
readme.md
  • Do you have a package in that repo? Try this: https://github.com/dherges/ng-packagr – Roland Rácz Feb 22 '18 at 15:39
  • i have edited the post adding package.json inside the repo and the files structure – Silvio Zoidberg Sdord Feb 22 '18 at 15:52
  • I don't think that this should work, because it is not in Angular Package Format. Please read the link above. – Roland Rácz Feb 22 '18 at 15:56
  • Why don't you just put it in your .angular-cli file in the scripts area ? Importing dependencies with github is a bit too much for 1 js file, but in case you need the github way : "dependencies": { "GitRepo": "git+https://:x-oauth-basic@github.com//.git" } – andrea06590 Feb 22 '18 at 15:57
  • Well @RolandRácz thanks I will check the links and try to build an angular package. Andrea it is not github, but a private repo, and there will be a lot of files, that one up there in an example :) I will check your way too.Thanks – Silvio Zoidberg Sdord Feb 22 '18 at 16:12

0 Answers0