I'm trying to install the package I made from my github repository.
I wrote it with typescript and added
"scripts": {
"build": "tsc"
}
to its package.json.
If you run npm install me/myrepo"
, npm run build
(means tsc
) will run automatically before an installation right?
Then, what about when you run yarn add https://github.com/me/myrepo/
?
I expected the same move but it doesn't seem like that.
Do you have any way to build it when you run "yarn add"?
CodePudding user response:
I figured it out by myself.
My problem wasn't about between npm and yarn, but the way to specify tsc
to scripts
.
It must be like below:
"scripts": {
"tsc": "tsc",
"build": "npm run tsc"
}
as if you just simply specify tsc
to scripts
, it means a global dependency of tsc.
CodePudding user response:
Running yarn add will install the dependency and add it to package.json (1). You will have to run npm run build or similarly "yarn run build" after adding the package.