Commit 03d9c36b authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera Committed by Enrique Alcántara

Fix npm command getter

- source
- tests
parent eacdaa70
...@@ -84,10 +84,10 @@ export const npmSetupCommand = ({ packageEntity, npmPath }) => (type = NpmManage ...@@ -84,10 +84,10 @@ export const npmSetupCommand = ({ packageEntity, npmPath }) => (type = NpmManage
const scope = packageEntity.name.substring(0, packageEntity.name.indexOf('/')); const scope = packageEntity.name.substring(0, packageEntity.name.indexOf('/'));
if (type === NpmManager.NPM) { if (type === NpmManager.NPM) {
return `echo ${scope}:registry=${npmPath} >> .npmrc`; return `echo ${scope}:registry=${npmPath}/ >> .npmrc`;
} }
return `echo \\"${scope}:registry\\" \\"${npmPath}\\" >> .yarnrc`; return `echo \\"${scope}:registry\\" \\"${npmPath}/\\" >> .yarnrc`;
}; };
export const nugetInstallationCommand = ({ packageEntity }) => export const nugetInstallationCommand = ({ packageEntity }) =>
......
---
title: Add Missing slash in 'Registry setup' section of npm packages
merge_request: 42360
author:
type: changed
...@@ -32,7 +32,7 @@ exports[`NpmInstallation renders all the messages 1`] = ` ...@@ -32,7 +32,7 @@ exports[`NpmInstallation renders all the messages 1`] = `
<code-instruction-stub <code-instruction-stub
copytext="Copy npm setup command" copytext="Copy npm setup command"
instruction="echo @Test:registry=undefined >> .npmrc" instruction="echo @Test:registry=undefined/ >> .npmrc"
label="npm command" label="npm command"
trackingaction="copy_npm_setup_command" trackingaction="copy_npm_setup_command"
trackinglabel="code_instruction" trackinglabel="code_instruction"
...@@ -40,7 +40,7 @@ exports[`NpmInstallation renders all the messages 1`] = ` ...@@ -40,7 +40,7 @@ exports[`NpmInstallation renders all the messages 1`] = `
<code-instruction-stub <code-instruction-stub
copytext="Copy yarn setup command" copytext="Copy yarn setup command"
instruction="echo \\\\\\"@Test:registry\\\\\\" \\\\\\"undefined\\\\\\" >> .yarnrc" instruction="echo \\\\\\"@Test:registry\\\\\\" \\\\\\"undefined/\\\\\\" >> .yarnrc"
label="yarn command" label="yarn command"
trackingaction="copy_yarn_setup_command" trackingaction="copy_yarn_setup_command"
trackinglabel="code_instruction" trackinglabel="code_instruction"
......
...@@ -78,7 +78,7 @@ describe('NpmInstallation', () => { ...@@ -78,7 +78,7 @@ describe('NpmInstallation', () => {
.at(2) .at(2)
.props(), .props(),
).toMatchObject({ ).toMatchObject({
instruction: 'echo @Test:registry=undefined >> .npmrc', instruction: 'echo @Test:registry=undefined/ >> .npmrc',
multiline: false, multiline: false,
trackingAction: TrackingActions.COPY_NPM_SETUP_COMMAND, trackingAction: TrackingActions.COPY_NPM_SETUP_COMMAND,
}); });
...@@ -90,7 +90,7 @@ describe('NpmInstallation', () => { ...@@ -90,7 +90,7 @@ describe('NpmInstallation', () => {
.at(3) .at(3)
.props(), .props(),
).toMatchObject({ ).toMatchObject({
instruction: 'echo \\"@Test:registry\\" \\"undefined\\" >> .yarnrc', instruction: 'echo \\"@Test:registry\\" \\"undefined/\\" >> .yarnrc',
multiline: false, multiline: false,
trackingAction: TrackingActions.COPY_YARN_SETUP_COMMAND, trackingAction: TrackingActions.COPY_YARN_SETUP_COMMAND,
}); });
......
...@@ -62,9 +62,9 @@ describe('Getters PackageDetails Store', () => { ...@@ -62,9 +62,9 @@ describe('Getters PackageDetails Store', () => {
const mavenSetupXmlBlock = generateMavenSetupXml(); const mavenSetupXmlBlock = generateMavenSetupXml();
const npmInstallStr = `npm i ${npmPackage.name}`; const npmInstallStr = `npm i ${npmPackage.name}`;
const npmSetupStr = `echo @Test:registry=${registryUrl} >> .npmrc`; const npmSetupStr = `echo @Test:registry=${registryUrl}/ >> .npmrc`;
const yarnInstallStr = `yarn add ${npmPackage.name}`; const yarnInstallStr = `yarn add ${npmPackage.name}`;
const yarnSetupStr = `echo \\"@Test:registry\\" \\"${registryUrl}\\" >> .yarnrc`; const yarnSetupStr = `echo \\"@Test:registry\\" \\"${registryUrl}/\\" >> .yarnrc`;
const nugetInstallationCommandStr = `nuget install ${nugetPackage.name} -Source "GitLab"`; const nugetInstallationCommandStr = `nuget install ${nugetPackage.name} -Source "GitLab"`;
const nugetSetupCommandStr = `nuget source Add -Name "GitLab" -Source "${registryUrl}" -UserName <your_username> -Password <your_token>`; const nugetSetupCommandStr = `nuget source Add -Name "GitLab" -Source "${registryUrl}" -UserName <your_username> -Password <your_token>`;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment