-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: legacy authentication using `NPM_USERNAME` and `NPM_PASSWORD` is no longer supported. Use `NPM_TOKEN` instead.
- Loading branch information
Showing
7 changed files
with
42 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ import path from "path"; | |
import delay from "delay"; | ||
import pRetry from "p-retry"; | ||
|
||
const IMAGE = "verdaccio/verdaccio:4"; | ||
const IMAGE = "verdaccio/verdaccio:5"; | ||
const REGISTRY_PORT = 4873; | ||
const REGISTRY_HOST = "localhost"; | ||
const NPM_USERNAME = "integration"; | ||
|
@@ -16,7 +16,7 @@ const NPM_EMAIL = "[email protected]"; | |
const docker = new Docker(); | ||
const __dirname = dirname(fileURLToPath(import.meta.url)); | ||
|
||
let container; | ||
let container, npmToken; | ||
|
||
/** | ||
* Download the `npm-registry-docker` Docker image, create a new container and start it. | ||
|
@@ -57,16 +57,23 @@ export async function start() { | |
email: NPM_EMAIL, | ||
}, | ||
}); | ||
|
||
// Create token for user | ||
({ token: npmToken } = await got(`http://${REGISTRY_HOST}:${REGISTRY_PORT}/-/npm/v1/tokens`, { | ||
username: NPM_USERNAME, | ||
password: NPM_PASSWORD, | ||
method: "POST", | ||
headers: { "content-type": "application/json" }, | ||
json: { password: NPM_PASSWORD, readonly: false, cidr_whitelist: [] }, | ||
}).json()); | ||
} | ||
|
||
export const url = `http://${REGISTRY_HOST}:${REGISTRY_PORT}/`; | ||
|
||
export const authEnv = { | ||
export const authEnv = () => ({ | ||
npm_config_registry: url, // eslint-disable-line camelcase | ||
NPM_USERNAME, | ||
NPM_PASSWORD, | ||
NPM_EMAIL, | ||
}; | ||
NPM_TOKEN: npmToken, | ||
}); | ||
|
||
/** | ||
* Stop and remove the `npm-registry-docker` Docker container. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.