Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

fix installer #1780

Merged
merged 4 commits into from
Feb 25, 2021
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
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,24 @@ You have many options to install wrangler!

### Install with `npm`

We strongly recommend you install `npm` with a Node version manager like [`nvm`](https://github.com/nvm-sh/nvm#installing-and-updating), which will allow `wrangler` to install configuration data in a global `node_modules` directory in your user's home directory, without requiring that you run as `root`.
We strongly recommend you install `npm` with a Node version manager like [`nvm`](https://github.com/nvm-sh/nvm#installing-and-updating), which puts the global `node_modules` in your home directory to eliminate permissions issues with `npm install -g`. Distribution-packaged `npm` installs often use `/usr/lib/node_modules` (which is root) for globally installed `npm` packages, and running `npm install -g` as `root` prevents `wrangler` from installing properly.

Once you've installed `nvm`, run:

Once you've installed `nvm` and configured your system to use the `nvm` managed node install, run:

```bash
npm i @cloudflare/wrangler -g
```

If you are running an ARM based system (eg Raspberry Pi, Pinebook) you'll need to use the `cargo` installation method listed below to build wrangler from source.

#### Specify binary location

In case you need `wrangler`'s npm installer to place the binary in a non-default location (such as when using `wrangler` in CI), you can use the following configuration options to specify an install location:

- Environment variable: `WRANGLER_INSTALL_PATH`
- NPM configuration: `wrangler_install_path`

#### Specify binary site URL

In case you need to store/mirror binaries on premise you will need to specify where wrangler should search for them by providing any of the following:
Expand Down
4 changes: 2 additions & 2 deletions RELEASE_CHECKLIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This is a list of the things that need to happen during a release.
1. Go through the commit history since the last release. Ensure that all PRs
that have landed are marked with the milestone. You can use this to
show all the PRs that are merged on or after YYY-MM-DD:
`https://github.com/issues?utf8=%E2%9C%93&q=repo%3Acloudflare%2Fwrangler+merged%3A%3E%3DYYYY-MM-DD`
`https://github.com/issues?q=repo%3Acloudflare%2Fwrangler+base%3Amaster+merged%3A%3E%3DYYYY-MM-DD`
1. Go through the closed PRs in the milestone. Each should have a changelog
label indicating if the change is docs, fix, feature, or maintenance. If
there is a missing label, please add one.
Expand All @@ -31,7 +31,7 @@ This is a list of the things that need to happen during a release.

1. Copy `README.md` to `npm/README.md`
1. Bump the version number in `npm/package.json`
1. `cd npm && npm install` _Note: This step will appear to fail, however its utility is re-building npm-shrinkwrap.json_
1. `cd npm && npm install` _Note: This step will appear to fail due to the new version not existing yet, however its utility is re-building npm-shrinkwrap.json_

### Start a release PR

Expand Down
19 changes: 12 additions & 7 deletions npm/binary.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { Binary } = require("binary-install");
const { Binary } = require("@cloudflare/binary-install");
const os = require("os");
const { join } = require("path");

Expand All @@ -20,17 +20,22 @@ const getPlatform = () => {
};

const getBinaryURL = (version, platform) => {
const site = process.env.WRANGLER_BINARY_HOST ||
process.env.npm_config_wrangler_binary_host ||
'https://workers.cloudflare.com/get-npm-wrangler-binary';
const site =
process.env.WRANGLER_BINARY_HOST ||
process.env.npm_config_wrangler_binary_host ||
"https://workers.cloudflare.com/get-npm-wrangler-binary";
return `${site}/${version}/${platform}`;
};

const getBinary = () => {
const platform = getPlatform();
const version = require("./package.json").version;
const url = getBinaryURL(version, platform);
const installDirectory = join(os.homedir(), ".wrangler");

const customPath =
process.env.WRANGLER_INSTALL_PATH ||
process.env.npm_config_wrangler_install_path;
const installDirectory = join(customPath || __dirname, "wrangler");
return new Binary(url, { name: "wrangler", installDirectory });
};

Expand All @@ -47,10 +52,10 @@ const install = () => {
const uninstall = () => {
const binary = getBinary();
binary.uninstall();
}
};

module.exports = {
install,
run,
uninstall
uninstall,
};
20 changes: 10 additions & 10 deletions npm/npm-shrinkwrap.json

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

2 changes: 1 addition & 1 deletion npm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
"cli"
],
"dependencies": {
"binary-install": "0.1.1"
"@cloudflare/binary-install": "0.2.0"
}
}