Skip to content

Commit 8236084

Browse files
committed
1867274, fixing merge conflicts.
2 parents d67757a + b10d48c commit 8236084

File tree

156 files changed

+2363
-1801
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+2363
-1801
lines changed

docs/artifacts/concepts/upstream-sources.md

+3
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ When you add a remote feed as an upstream source, you must select its feed's vie
7777
7878
## Best practices: feed owners/package publishers
7979
80+
> [!NOTE]
81+
> Upstream sources are not supported in public feeds.
82+
8083
To make sure your feed is easily configured as an upstream source, consider applying the following best practices:
8184
8285
<a name="local"></a>

docs/artifacts/get-started-npm.md

+85-80
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
---
2-
title: Use npm to store JavaScript packages
3-
description: Use npm to store your JavaScript packages. Create a feed, set up .npmrc files, build your project, and publish your npm package to your feed.
2+
title: publish and download npm packages
3+
description: How to set up your .npmrc config file to publish and download npm packages
44
ms.technology: devops-artifacts
55
ms.topic: quickstart
66
ms.assetid: 5BFBA0C3-85ED-40C9-AC5F-F686923160D6
77
ms.custom: contperf-fy20q4, conterperfq3, contperf-fy21q3
8-
ms.date: 06/19/2020
8+
ms.date: 10/22/2021
99
monikerRange: '>= tfs-2017'
1010
"recommendations": "true"
1111
---
1212

1313
# Get started with npm packages in Azure Artifacts
1414

15-
Azure Artifacts supports publishing and consuming npm packages to and from Azure Artifacts feeds and public registries. Use this quickstart to create your feed, set up your .npmrc file, build your project, and publish your npm packages to your feed.
15+
With Azure Artifacts, you can publish and download npm packages from feeds and public registries such as npmjs.com. This quickstart will guide you through creating your own feed, setting up your project, and publishing and downloading npm packages to and from your Azure Artifacts feed.
1616

1717
::: moniker range=">=tfs-2017 <= tfs-2018"
1818

1919
## License the Azure Artifacts extension
2020

21-
To use Azure Artifacts, you must upgrade to Visual Studio Team Foundation Server 2017. If the Azure Artifacts extension has been removed, you can install it from [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=ms.feed).
21+
To use Azure Artifacts in TFS, you must upgrade to Visual Studio Team Foundation Server 2017. If the Azure Artifacts extension has been removed, you can install it from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=ms.feed).
2222

2323
### Assign licenses in Team Foundation Server
2424

25-
Each organization gets five free licenses. If you need more than five licenses, go to [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=ms.feed), and select **Get it free**.
25+
Each organization gets five free licenses. If you need more than five licenses, go to the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=ms.feed), and select **Get it free**.
2626

2727
If you aren't sure, you can select **Start 30-day free trial**. Every user in your organization is then granted access to Azure Artifacts for 30 days. After the 30-day trial period, your organization reverts back to five entitled users, and you must assign licenses to individual users. If you need additional licenses at this point, you can purchase them from Visual Studio Marketplace. If you have a license for Visual Studio Enterprise, you already have access to Azure Artifacts and don't need to be assigned a license. Just ensure that you've been assigned the "Visual Studio Enterprise" access level.
2828

@@ -31,8 +31,7 @@ If you aren't sure, you can select **Start 30-day free trial**. Every user in yo
3131
3232
1. From any collection in Team Foundation Server, hover over the settings menu and select **Users**. Then select **Package Management**.
3333

34-
> [!div class="mx-imgBorder"]
35-
> ![Screenshot of the Users page in Team Foundation Server.](media/users-hub-tfs.png)
34+
:::image type="content" source="media/users-hub-tfs.png" alt-text="Screenshot showing the user page in TFS":::
3635

3736
1. Select **Assign**, enter the users you want to assign licenses, and then select **OK**.
3837

@@ -44,124 +43,130 @@ If you aren't sure, you can select **Start 30-day free trial**. Every user in yo
4443

4544
## Create a feed
4645

47-
A feed is an organizational construct that allows users to store packages and control who can access them by modifying the feed permissions.
46+
A feed is an organizational construct that allows users to store their packages and control who can access them. Azure Artifacts support storing several package types in a single feed such as NuGet, npm, Maven, Python, and Universal packages.
4847

49-
Feeds aren't dependent on the type of package. Azure Artifacts currently supports storing NuGet, npm, Maven, Python, and Universal packages in a single feed.
48+
[!INCLUDE [](includes/create-feed.md)]
5049

51-
To create a new feed, select **Create feed** from within your feed, and fill out the form.
52-
53-
* **Name**: The feed name.
54-
* **Visibility**: Choose who can upload or download packages to or from your feed.
55-
* **Upstream sources**: If you want to add upstream sources to your feed such as *npmjs.org* or *NuGet.org*, select **Include packages from common public sources**. When upstream sources are enabled, your client can fetch packages from the public registry through your private feed, and your private feed will cache those packages for you. If you want to create your feed without connectivity to public registries, clear the **Upstream sources** check box. You can add them later if you choose to.
56-
57-
When you're done, select **Create**.
58-
59-
::: moniker range=">= azure-devops-2019"
60-
61-
> [!div class="mx-imgBorder"]
62-
> ![Screenshot of the new feed dialog box in Azure DevOps 2019.](media/new-feed-dialog.png)
63-
64-
::: moniker-end
65-
66-
::: moniker range="<= tfs-2018"
67-
68-
> [!div class="mx-imgBorder"]
69-
> ![Screenshot of the new feed dialog box in Team Foundation Server.](media/new-feed-dialog-azure-tfs.png)
70-
71-
::: moniker-end
72-
73-
You can change these settings later by editing the feed.
50+
You can change these settings later by editing your feed's settings.
7451

7552
[!INCLUDE [edit-feed](includes/edit-feed.md)]
7653

7754
::: moniker range=">= azure-devops-2019"
7855

7956
## Set up your .npmrc files
8057

81-
All Azure Artifacts feeds require authentication. You store credentials for the feed before you can install or publish packages. npm uses [.npmrc configuration files](https://docs.npmjs.com/files/npmrc) to store feed URLs and credentials.
82-
8358
> [!NOTE]
84-
> `vsts-npm-auth` isn't supported on on-premises Team Foundation Server and Azure DevOps Server.
59+
> `vsts-npm-auth` is not supported in TFS and Azure DevOps Server.
8560
86-
### Find your .npmrc files
61+
We recommend having two .npmrc files. The first one should be placed in the same directory as your package.json file. The second one should be placed in the **$home** directory (Linux/MacOS) or **$env.HOME** (Windows) to store your credentials. The npm client then will be able to look up this file and fetch your credentials for authentication. This enables you to share your config file while keeping your credentials secure.
8762

88-
We recommend that you use two .npmrc files:
63+
1. Select **Artifacts**, and then select **Connect to feed**.
8964

90-
1. One .npmrc should live at the root of your Git repo where your project's package.json file is located.
65+
:::image type="content" source="media/connect-to-feed-azure-devops-newnav.png" alt-text="Screenshot showing how to connect to a feed":::
9166

92-
1. From **Artifacts**, select **Connect to feed**.
67+
1. Select **npm**. If this is your first time using Azure Artifacts, select **Get the tools** and then follow the steps to download Node.js and set up the credential provider.
9368

94-
> [!div class="mx-imgBorder"]
95-
> ![Screenshot that shows how to connect to your feed.](media/connect-to-feed-azure-devops-newnav.png)
69+
1. Follow the instructions in the **Project setup** to set up your project.
9670

97-
1. Select **npm** > **Get the tools**.
98-
99-
1. Follow steps 1 and 2 to download the Node.js file, npm, and the artifacts credential provider.
100-
101-
1. Select **Windows** if you're on a Windows Machine, or **Other** if you're on macOS or Linux.
102-
103-
1. Follow the instructions in the **Project setup**, **Restore packages**, and **Publish packages** sections.
104-
105-
> [!div class="mx-imgBorder"]
106-
> ![Screenshot that shows the setup, restore, and publish sections to connect your feed.](media/npm-azure-devops-newnav.png)
71+
:::image type="content" source="media/npm-azure-devops-newnav.png" alt-text="Screenshot showing how to set up your project":::
10772

108-
2. On your development machine, you also have a .npmrc file in the **$home** folder for Linux or Mac systems, or in **$env.HOME** for Windows. This .npmrc file should contain credentials for all of the registries that you need to connect to. The NPM client looks at your project's .npmrc file, discovers the registry, and fetches matching credentials from **$home/.npmrc** or **$env.HOME/.npmrc**.
109-
110-
This enables you to share the project's .npmrc file with the whole team, while keeping your credentials secure.
111-
11273
### Set up authentication on your development machine
11374

114-
At this point, you should have a project-specific .npmrc file. This file contains only your feed's registry information that you discovered from the **Connect to feed** dialog box. There should be no credentials in this file. The file is usually stored in the same location as your project's package.json file.
115-
11675
> [!IMPORTANT]
117-
> There can be only a single `registry=` line in your .npmrc file. Multiple registries are possible with [scopes](npm/scopes.md) and [upstream sources](npm/upstream-sources.md).
76+
> npm supports a single `registry` in your .npmrc file. Multiple registries are possible with [scopes](npm/scopes.md) and [upstream sources](npm/upstream-sources.md).
11877
119-
#### Windows
78+
#### [Windows](#tab/Windows/)
12079

121-
If you're developing on Windows, we recommend that you use `vsts-npm-auth` to fetch credentials and inject them into your ~/.npmrc file on a periodic basis. The easiest way to set this up is to install `vsts-npm-auth` globally (that is, `npm install -g vsts-npm-auth`), and then add a run script in your project's package.json file.
80+
If you're developing on Windows, we recommend using `vsts-npm-auth` to authenticate with Azure Artifacts. Run `npm install -g vsts-npm-auth` to install the package globally and then add a run script to your package.json.
12281

123-
```json
82+
```JSON
12483
"scripts": {
12584
"refreshVSToken": "vsts-npm-auth -config .npmrc"
12685
}
12786
```
12887

129-
#### Linux/Mac
88+
#### [Linux/MacOS](#tab/Linux/)
89+
90+
`vsts-npm-auth` is not supported in Linux/MacOS. In order to authenticate with Azure Artifacts, we have to create a personal access token and add it to our .npmrc file.
91+
92+
1. Copy the following code snippet to your .npmrc file.
93+
94+
- **Organization-scoped feed**:
13095

131-
If you're developing on Linux or Mac, `vsts-npm-auth` isn't supported. Instead, generate a token in the following manner for your $HOME/.npmrc file.
96+
```Command
97+
; begin auth token
98+
//pkgs.dev.azure.com/<ORGANIZATION_NAME>/_packaging/<FEED_NAME>/npm/registry/:username=[ENTER_ANY_VALUE_BUT_NOT_AN_EMPTY_STRING]
99+
//pkgs.dev.azure.com/<ORGANIZATION_NAME>/_packaging/<FEED_NAME>/npm/registry/:_password=[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]
100+
//pkgs.dev.azure.com/<ORGANIZATION_NAME>/_packaging/<FEED_NAME>/npm/registry/:email=npm requires email to be set but doesn't use the value
101+
//pkgs.dev.azure.com/<ORGANIZATION_NAME>/_packaging/<FEED_NAME>/npm/:username=[ANY_VALUE_BUT_NOT_AN_EMPTY_STRING]
102+
//pkgs.dev.azure.com/<ORGANIZATION_NAME>/_packaging/<FEED_NAME>/npm/:_password=[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]
103+
//pkgs.dev.azure.com/<ORGANIZATION_NAME>/_packaging/<FEED_NAME>/npm/:email=npm requires email to be set but doesn't use the value
104+
; end auth token
105+
```
106+
107+
- **Project-scoped feed**:
132108

133-
[!INCLUDE [](./includes/npm/npmrc.md)]
109+
```Command
110+
; begin auth token
111+
//pkgs.dev.azure.com/<ORGANIZATION_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/npm/registry/:username=[ENTER_ANY_VALUE_BUT_NOT_AN_EMPTY_STRING]
112+
//pkgs.dev.azure.com/<ORGANIZATION_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/npm/registry/:_password=[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]
113+
//pkgs.dev.azure.com/<ORGANIZATION_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/npm/registry/:email=npm requires email to be set but doesn't use the value
114+
//pkgs.dev.azure.com/<ORGANIZATION_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/npm/:username=[ENTER_ANY_VALUE_BUT_NOT_AN_EMPTY_STRING]
115+
//pkgs.dev.azure.com/<ORGANIZATION_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/npm/:_password=[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]
116+
//pkgs.dev.azure.com/<ORGANIZATION_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/npm/:email=npm requires email to be set but doesn't use the value
117+
; end auth token
118+
```
119+
120+
1. Generate a [personal access token](../organizations/accounts/use-personal-access-tokens-to-authenticate.md) with **packaging read and write** scopes.
121+
122+
1. Encode your newly generated personal access token as follows:
123+
124+
1. Run the following command in an elevated command prompt window.
125+
126+
```Command
127+
node -e "require('readline') .createInterface({input:process.stdin,output:process.stdout,historySize:0}) .question('PAT> ',p => { b64=Buffer.from(p.trim()).toString('base64');console.log(b64);process.exit(); })"
128+
```
129+
130+
1. Paste your personal access token, and then press **Enter**.
131+
132+
1. Copy the Base64 encoded value.
133+
134+
1. Replace the `[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]` placeholder in your .npmrc file with your Base64 personal access token.
134135

135136
::: moniker-end
136137

137-
## Build your project
138+
::: moniker range=">=tfs-2017 <= tfs-2018"
138139

139-
At this point, your project should have a package.json file and a .npmrc file in the same folder. Run `npm install` from the directory that contains both of these files. npm discovers your feed in the .npmrc file in the current working directory. It then fetches the credentials from your home directory's .npmrc file that you configured in the "Create a feed" section.
140+
1. Select **Packages**, and then select **Connect to feed**.
140141

141-
> [!NOTE]
142-
> If you are using Yarn, run the following command to set the yarn registry:
143-
>
144-
> `yarn config set registry "https://pkgs.dev.azure.com/<yourOrganization>/_packaging/<yourFeed>/npm/registry/"`
142+
2. Select **npm**.
145143

144+
3. Select **Generate npm credentials**. Copy the credentials and add them to your .npmrc file.
146145

147-
## Publish npm packages
146+
:::image type="content" source="./media/tfs2018-connect-to-npm-feed.png" alt-text="Screenshot showing how generate credentials":::
148147

149-
You can now publish the npm package:
148+
::: moniker-end
150149

151-
1. Browse to the directory that contains your package's package.json file.
150+
* * *
152151

153-
1. Run `npm publish`.
152+
## Publish packages
154153

155-
This command authenticates to the feed by using the .npmrc configuration files that you had to set up earlier. For more information, see the [npm CLI docs](https://docs.npmjs.com/cli/publish).
154+
To publish your npm package, run the following command in your project directory
156155

157-
Your npm package should now be available in your feed.
156+
```Command
157+
npm publish
158+
```
158159

159160
> [!IMPORTANT]
160-
> Ensure that your working folder has an `.npmrc` file with a `registry=` line, as described in the **Connect to feed** screen in your feed. The build doesn't support using the `publishConfig` property to specify the registry to which you're publishing. If you include the `publishConfig` property in your package.json file, the build might fail with an unrelated authentication error.
161+
> Using the `publishConfig` property to override the registry config param at publish-time is not supported.
161162

162-
## Download npm packages
163+
## Restore packages
163164

164-
[!INCLUDE [](includes/npm/install.md)]
165+
To restore an npm package, run the following command in your project directory
166+
167+
```Command
168+
npm install --save <package>
169+
```
165170

166171
## Next steps
167172

docs/artifacts/get-started-nuget.md

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ This quickstart assumes you've already set up Azure Artifacts. You can check out
3737

3838
## Create a feed
3939

40+
With Azure Artifacts, you can create two types of feeds: project-scoped and organization-scoped feeds. All public feeds are project-scoped and they inherit the hosting project's visibility settings. By default, any feed that's created by using the web UI is a project-scoped feed.
41+
4042
[!INCLUDE [](includes/create-feed.md)]
4143

4244
<a name="publish-a-package"></a>

docs/artifacts/how-to/set-up-upstream-sources.md

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ Selecting this option will allow your feed to use packages from public packages
2424
2525
## Add public upstream sources to an existing feed
2626

27+
> [!NOTE]
28+
> Upstream sources are not supported in public feeds.
29+
2730
1. With your feed selected, select the gear icon ![gear icon](../../media/icons/gear-icon.png) to access your **Feed settings**.
2831
2. Select **Upstream sources**. If you don't have any upstream sources, you'll see a dialog where you can _Add upstream source_. If you already have it, you can select _Add upstream source_ in the top menu.
2932
3. In the **Add a new upstream source** dialog, Select **Public source**. Note that public sources may be greyed out if you chose to include public upstream sources when creating the feed and they already exist in your upstream sources.

docs/artifacts/includes/create-feed.md

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ author: ramiMSFT
77
ms.date: 03/10/2021
88
---
99

10-
With Azure Artifacts, you can create two types of feeds: project-scoped and organization-scoped feeds. All public feeds are project-scoped and they inherit the hosting project's visibility settings. By default, any feed that's created by using the web UI is a project-scoped feed, as follows.
11-
1210
::: moniker range=">= azure-devops-2019"
1311

1412
1. From within your project, navigate to **Azure Artifacts**.

docs/artifacts/includes/edit-feed.md

+4-8
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,17 @@ ms.technology: devops-cicd
44
ms.manager: mijacobs
55
ms.author: rabououn
66
author: ramiMSFT
7-
ms.date: 06/19/2020
7+
ms.date: 10/22/2021
88
---
99

1010
::: moniker range=">= azure-devops-2019"
1111

12-
1. With your feed selected, select the gear icon :::image type="icon" source="../../media/icons/gear-icon.png"::: on the right side of the page.
13-
14-
:::image type="content" source="../media/editfeed-azure-devops-newnav.png" alt-text="Screenshot of the Edit feed button.":::
12+
:::image type="content" source="../media/editfeed-azure-devops-newnav.png" alt-text="Screenshot of the Edit feed button.":::
1513

1614
::: moniker-end
1715

18-
::: moniker range="<= tfs-2018"
19-
20-
1. With your feed selected, select the gear icon :::image type="icon" source="../../media/icons/gear-icon.png"::: on the right side of the page.
16+
::: moniker range=">=tfs-2017 <= tfs-2018"
2117

22-
:::image type="content" source="../media/editfeed.png" alt-text="Screenshot of the Edit feed button TFS.":::
18+
:::image type="content" source="../media/editfeed.png" alt-text="Screenshot of the Edit feed button TFS.":::
2319

2420
::: moniker-end

docs/artifacts/includes/npm/npmrc.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ms.topic: include
33
ms.technology: devops-cicd
44
ms.author: rabououn
55
author: ramiMSFT
6-
ms.date: 09/01/2020
6+
ms.date: 10/22/2021
77
---
88

99
#### Project setup

docs/artifacts/includes/nuget/nuget-recommended-version.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ ms.topic: include
33
ms.technology: devops-cicd
44
ms.author: rabououn
55
author: ramiMSFT
6-
ms.date: 02/19/2020
6+
ms.date: 10/18/2021
77
---
88

99
> [!NOTE]
10-
> Azure Artifacts recommends NuGet 4.8.2 or later. However, legacy NuGet 2.x are also supported. For a complete list of distribution versions, see the [NuGet distribution page](https://dist.nuget.org/index.html).
10+
> We recommend NuGet version 4.8.2 or later. Legacy NuGet versions 2.x are also supported.
-22 KB
Loading
Loading
Loading
10.3 KB
Loading

0 commit comments

Comments
 (0)