`npm` dependency from Git repository not build properly when installed by `yarn`

Viewed 210

I have repository shared-code on my Git. This is structure of my package:

shared-code
|- package.json
|- tsconfig.json
|- src/
|-- index.ts
|-- foo.ts
|-- bar.ts
|- lib/ <-- automatically created when tsc build

This is package.json of this npm package:

{
  "name": "shared-code",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "build": "tsc",
    "watch": "tsc --watch",
    "prepare": "npm run build"
  },
  "main": "lib/index.js",
  "types": "lib/index.d.ts",
  "devDependencies":{
    "eslint": "^6.8.0",
    "typescript": "^3.7.4"
  }
}

when I want to include this package into another project I do so by adding it to package.json:

...
"dependencies": {
  "shared-code": "git+https://<username>@bitbucket.org/foo/shared-code.git"
}
...

Then I run npm install and shared-code package is successfully installed and TypeScript is built.

But, when I install it by yarn install package is installed and just one file is built (/lib/index.js). Other files are not transcribed as supposted.

Where is problem? Is this yarn bug? Or yarn works differently?

0 Answers
Related