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

Migrate NpmAuthenticateV0 to Node 10 #16650

Merged
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5d24d9c
First iteration
Feb 8, 2022
f6ea4ab
Merge branch 'master' into users/tatyana-kostromskaya/npmauth-to-node10
Feb 9, 2022
8cf7bda
Merge branch 'master' into users/tatyana-kostromskaya/npmauth-to-node10
Feb 10, 2022
0b82e40
Merge branch 'master' into users/tatyana-kostromskaya/npmauth-to-node10
Feb 14, 2022
7400492
Merge branch 'master' into users/tatyana-kostromskaya/npmauth-to-node10
Feb 15, 2022
7dcb9fb
Merge branch 'master' into users/tatyana-kostromskaya/npmauth-to-node10
Feb 15, 2022
b3f0de3
Merge branch 'master' into users/tatyana-kostromskaya/npmauth-to-node10
Feb 21, 2022
59eebbe
Merge branch 'master' into users/tatyana-kostromskaya/npmauth-to-node10
Feb 22, 2022
0665178
Merge branch 'master' into users/tatyana-kostromskaya/npmauth-to-node10
Feb 28, 2022
d4059b6
Merge branch 'master' into users/tatyana-kostromskaya/npmauth-to-node10
Mar 3, 2022
67acc9a
Merge branch 'master' into users/tatyana-kostromskaya/npmauth-to-node10
mpodriezov Jun 8, 2022
e269873
Merge branch 'master' into users/tatyana-kostromskaya/npmauth-to-node10
mpodriezov Jun 9, 2022
46a9507
Merge branch 'master' of github.com:microsoft/azure-pipelines-tasks i…
mpodriezov Jun 27, 2022
07bb833
Bumped version to 207
mpodriezov Jun 27, 2022
cb13521
Merge branch 'master' into users/tatyana-kostromskaya/npmauth-to-node10
mpodriezov Jun 29, 2022
4e5288a
Merge branch 'master' into users/tatyana-kostromskaya/npmauth-to-node10
mpodriezov Jul 13, 2022
e56ec5f
Merge branch 'master' into users/tatyana-kostromskaya/npmauth-to-node10
mpodriezov Jul 21, 2022
87f64c0
Merge branch 'master' into users/tatyana-kostromskaya/npmauth-to-node10
mpodriezov Jul 25, 2022
86270ed
Merge branch 'master' into users/tatyana-kostromskaya/npmauth-to-node10
tintse-thxsky-MSFT Jul 25, 2022
3e6703d
Merge branch 'master' into users/tatyana-kostromskaya/npmauth-to-node10
mpodriezov Jul 26, 2022
427f898
Merge branch 'master' into users/tatyana-kostromskaya/npmauth-to-node10
tintse-thxsky-MSFT Jul 26, 2022
cd0930a
Merge branch 'master' into users/tatyana-kostromskaya/npmauth-to-node10
tintse-thxsky-MSFT Jul 27, 2022
9ff65af
Update package.json
tintse-thxsky-MSFT Jul 27, 2022
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
17 changes: 0 additions & 17 deletions Tasks/NpmAuthenticateV0/make.json

This file was deleted.

22 changes: 11 additions & 11 deletions Tasks/NpmAuthenticateV0/npmauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import * as tl from 'azure-pipelines-task-lib/task';
import * as URL from 'url';
import * as fs from 'fs';
import * as constants from './constants';
import * as npmregistry from 'packaging-common/npm/npmregistry';
import * as util from 'packaging-common/util';
import * as npmutil from 'packaging-common/npm/npmutil';
import * as npmregistry from 'azure-pipelines-tasks-packaging-common-v3/npm/npmregistry';
import * as util from 'azure-pipelines-tasks-packaging-common-v3/util';
import * as npmutil from 'azure-pipelines-tasks-packaging-common-v3/npm/npmutil';
import * as os from 'os';
import * as npmrcparser from 'packaging-common/npm/npmrcparser';
import * as pkgLocationUtils from 'packaging-common/locationUtilities';
import * as npmrcparser from 'azure-pipelines-tasks-packaging-common-v3/npm/npmrcparser';
import * as pkgLocationUtils from 'azure-pipelines-tasks-packaging-common-v3/locationUtilities';

async function main(): Promise<void> {
tl.setResourcePath(path.join(__dirname, 'task.json'));
Expand All @@ -26,13 +26,13 @@ async function main(): Promise<void> {
}

if (tl.getVariable("SAVE_NPMRC_PATH")) {
saveNpmrcPath = tl.getVariable("SAVE_NPMRC_PATH");
saveNpmrcPath = tl.getVariable("SAVE_NPMRC_PATH");
}
else {
let tempPath = tl.getVariable('Agent.BuildDirectory') || tl.getVariable('Agent.TempDirectory');
tempPath = path.join(tempPath, 'npmAuthenticate');
tl.mkdirP(tempPath);
saveNpmrcPath = fs.mkdtempSync(tempPath + path.sep);
saveNpmrcPath = fs.mkdtempSync(tempPath + path.sep);
tl.setVariable("SAVE_NPMRC_PATH", saveNpmrcPath, false);
tl.setVariable("NPM_AUTHENTICATE_TEMP_DIRECTORY", tempPath, false);
}
Expand All @@ -45,7 +45,7 @@ async function main(): Promise<void> {

if (fs.existsSync(indexFile)) { //If the file exists, add to it.
npmrcTable = JSON.parse(fs.readFileSync(indexFile, 'utf8'));

}
else { //If the file doesn't exist, create it.
npmrcTable = new Object();
Expand Down Expand Up @@ -85,7 +85,7 @@ async function main(): Promise<void> {
for (let serviceEndpoint of endpointRegistries) {

if (util.toNerfDart(serviceEndpoint.url) == util.toNerfDart(RegistryURLString)) {
let serviceURL = URL.parse(serviceEndpoint.url);
let serviceURL = URL.parse(serviceEndpoint.url);
console.log(tl.loc("AddingEndpointCredentials", registryURL.host));
registry = serviceEndpoint;
npmrcFile = clearFileOfReferences(npmrc, npmrcFile, serviceURL);
Expand All @@ -110,13 +110,13 @@ async function main(): Promise<void> {
npmrcFile.push(os.EOL + registry.auth + os.EOL);
}
else {
console.log(tl.loc("IgnoringRegistry", registryURL.host ));
console.log(tl.loc("IgnoringRegistry", registryURL.host));
}
}
}

main().catch(error => {
if(tl.getVariable("NPM_AUTHENTICATE_TEMP_DIRECTORY")) {
if (tl.getVariable("NPM_AUTHENTICATE_TEMP_DIRECTORY")) {
tl.rmRF(tl.getVariable("NPM_AUTHENTICATE_TEMP_DIRECTORY"));
// Clear the variables after we rm-rf the main root directory
tl.setVariable("SAVE_NPMRC_PATH", "", false);
Expand Down
2 changes: 1 addition & 1 deletion Tasks/NpmAuthenticateV0/npmauthcleanup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as util from 'packaging-common/util';
import * as util from 'azure-pipelines-tasks-packaging-common-v3/util';
import * as constants from './constants';
import * as tl from 'azure-pipelines-task-lib/task';
import * as fs from 'fs';
Expand Down
Loading