Skip to content

fix: pacote does not respect CLI's proxy configuration #3831

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

Merged
merged 1 commit into from
Aug 23, 2018

Conversation

rosen-vladimirov
Copy link
Contributor

Pacote does not respect the proxy settings set with tns proxy set .... Pass the required options and add unit tests for the pacote service (use sinon instead of mocking with injector for the pacote and tar packages as the service is our wrapper for pacote).

PR Checklist

What is the current behavior?

Unable to create project when working behind proxy.

What is the new behavior?

Project can be created when working behind proxy

Fixes #3824

NOTE: Merge after telerik/mobile-cli-lib#1131

@rosen-vladimirov
Copy link
Contributor Author

run ci

return pacote.manifest(packageName, manifestOptions);
}

private async getPacoteBaseOptions(): Promise<IPacoteBaseOptions> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this method should be below the public methods

public async extractPackage(packageName: string, destinationDirectory: string, options?: IPacoteExtractOptions): Promise<void> {
// strip: Remove the specified number of leading path elements. Pathnames with fewer elements will be silently skipped. More info: https://github.com/npm/node-tar/blob/e89c4d37519b1c20133a9f49d5f6b85fa34c203b/README.md
// C: Create an archive
this.$logger.trace(`Calling pacoteService.extractPackage for packageName: '${packageName}', destinationDir: '${destinationDirectory}' and options: ${options}`);
const extractOptions = { strip: 1, C: destinationDirectory };
if (options) {
_.extend(extractOptions, options);
}

if (this.$fs.exists(packageName)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this logic is duplicated in both methods, extract it to a separate method

tarballSourceStream.emit("error", new Error("my error"));
});

await assert.isRejected(pacoteExtractPackagePromise, "my error");
Copy link
Contributor

Choose a reason for hiding this comment

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

const expectedErrorMessage = "my error";

tarExtractDestinationStream.emit("error", new Error("my error"));
});

await assert.isRejected(pacoteExtractPackagePromise, "my error");
Copy link
Contributor

Choose a reason for hiding this comment

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

const expectedErrorMessage = "my error";

Pacote does not respect the proxy settings set with `tns proxy set ...`. Pass the required options and add unit tests for the pacote service (use sinon instead of mocking with injector for the `pacote` and `tar` packages as the service is our wrapper for pacote).
@rosen-vladimirov rosen-vladimirov force-pushed the vladimirov/fix-pacote-proxy branch from 63fd629 to 86c1557 Compare August 22, 2018 16:20
@rosen-vladimirov rosen-vladimirov merged commit 9b5b6ca into release Aug 23, 2018
@rosen-vladimirov rosen-vladimirov deleted the vladimirov/fix-pacote-proxy branch August 23, 2018 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants