Skip to content

Commit

Permalink
Fix npx and bin issues
Browse files Browse the repository at this point in the history
  • Loading branch information
armandsalle committed Mar 12, 2024
1 parent 6373cbc commit e5512f0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 25 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "celvercel",
"version": "0.1.6",
"version": "0.1.7",
"description": "A simple CLI tool to create Oreo meme with the Vercel logo.",
"author": "Armand Sallé",
"license": "MIT",
Expand Down Expand Up @@ -34,5 +34,8 @@
"files": [
"dist",
"postinstall.js"
]
],
"bin": {
"celvercel": "./bin/celvercel"
}
}
24 changes: 3 additions & 21 deletions postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var _typeof =
}

var path = require("path"),
mkdirp = require("mkdirp"),
{ mkdirp } = require("mkdirp"),
fs = require("fs")

// Mapping from Node's `process.arch` to Golang's `$GOARCH`
Expand All @@ -36,26 +36,8 @@ var PLATFORM_MAPPING = {
}

async function getInstallationPath() {
// `npm bin` will output the path where binary files should be installed

const value = await execShellCommand("npm bin -g")

var dir = null
if (!value || value.length === 0) {
// We couldn't infer path from `npm bin`. Let's try to get it from
// Environment variables set by NPM when it runs.
// npm_config_prefix points to NPM's installation directory where `bin` folder is available
// Ex: /Users/foo/.nvm/versions/node/v4.3.0
var env = process.env
if (env && env.npm_config_prefix) {
dir = path.join(env.npm_config_prefix, "bin")
}
} else {
dir = value.trim()
}

await mkdirp(dir)
return dir
await mkdirp("bin")
return "bin"
}

async function verifyAndPlaceBinary(binName, binPath, callback) {
Expand Down

0 comments on commit e5512f0

Please sign in to comment.