Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for all packages manager and shrink package size #1

Merged
merged 1 commit into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,16 @@ This will install go-npm under to your package.json file. It will also create a

`$ rm -r node_modules`

**Add postinstall and preuninstall scripts**
**Add preinstall script**
Here is the magic: You ask to run `go-npm install` after it completes installing your package. This will pull down binaries from Github or Amazon S3 and install in NPM's `bin` directory. Binaries under bin directory are immediately available for use in your Terminal.

Edit `package.json` file and add the following:
```
{
"postinstall": "go-npm install",
"preuninstall": "go-npm uninstall",
"preinstall": "go-npm install"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The binaries are linked by npm / yarn etc. on install, so the binary has to be present before the installation. preinstall achieves it, whereas postinstall is too late

}
```

`go-npm uninstall` simply deletes the binary from `bin` directory before NPM uninstalls your package.

**Configure your binary path**

You need to tell `go-npm` where to download the binaries from, and where to install them. Edit `package.json` file and add the following configuration.
Expand All @@ -74,6 +71,7 @@ You need to tell `go-npm` where to download the binaries from, and where to inst
"name": "command-name",
"path": "./bin",
"url": "https://github.com/user/my-go-package/releases/download/v{{version}}/myGoPackage_{{version}}_{{platform}}_{{arch}}.tar.gz"
}
```

* *name*: Name of the command users will use to run your binary.
Expand Down
Loading