Skip to content

Commit

Permalink
🐛 Fix npm run bug
Browse files Browse the repository at this point in the history
  • Loading branch information
CryogenicPlanet committed Jan 14, 2022
1 parent 50d1c4d commit 7427510
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion installer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tsdev-installer",
"version": "0.0.17",
"version": "0.0.18",
"description": "The installer for tsdev, a better tsdx",
"scripts": {
"postinstall": "node dist/postinstall.js install",
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/dts.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func EmitDts(cwd string, name string) error {
}
}
fmt.Println("Package manager is ", packageJson.TSDEV.PackageManager)
err = utils.ExecWithOutput(cwd, utils.GetPackageManager(packageJson.TSDEV.PackageManager), "tsc", "--outDir", "dist/src/")
err = utils.ExecWithOutput(cwd, utils.GetPackageManager(packageJson.TSDEV.PackageManager, true), "tsc", "--outDir", "dist/src/")
if err != nil {
buildWg.Done()
return err
Expand Down
10 changes: 9 additions & 1 deletion internal/utils/packageManger.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package utils

import "internal/types"

func GetPackageManager(packageManger types.PackageManagerType) string {
func GetPackageManager(packageManger types.PackageManagerType, run bool) string {

switch packageManger {
case types.Pnpm:
Expand All @@ -15,10 +15,18 @@ func GetPackageManager(packageManger types.PackageManagerType) string {
}
case types.Npm:
{
// npm run cannot run node modules, the way yarn or pnpm can
if run {
return "yarn"
}
return "npm"
}
default:
{
// npm run cannot run node modules, the way yarn or pnpm can
if run {
return "yarn"
}
return "npm"
}
}
Expand Down

0 comments on commit 7427510

Please sign in to comment.