You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/artifacts/get-started-npm.md
+85-80
Original file line number
Diff line number
Diff line change
@@ -1,28 +1,28 @@
1
1
---
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
# Get started with npm packages in Azure Artifacts
14
14
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.
16
16
17
17
::: moniker range=">=tfs-2017 <= tfs-2018"
18
18
19
19
## License the Azure Artifacts extension
20
20
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).
22
22
23
23
### Assign licenses in Team Foundation Server
24
24
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**.
26
26
27
27
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.
28
28
@@ -31,8 +31,7 @@ If you aren't sure, you can select **Start 30-day free trial**. Every user in yo
31
31
32
32
1. From any collection in Team Foundation Server, hover over the settings menu and select **Users**. Then select **Package Management**.
33
33
34
-
> [!div class="mx-imgBorder"]
35
-
> 
34
+
:::image type="content" source="media/users-hub-tfs.png" alt-text="Screenshot showing the user page in TFS":::
36
35
37
36
1. Select **Assign**, enter the users you want to assign licenses, and then select **OK**.
38
37
@@ -44,124 +43,130 @@ If you aren't sure, you can select **Start 30-day free trial**. Every user in yo
44
43
45
44
## Create a feed
46
45
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.
48
47
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)]
50
49
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
-
> 
63
-
64
-
::: moniker-end
65
-
66
-
::: moniker range="<= tfs-2018"
67
-
68
-
> [!div class="mx-imgBorder"]
69
-
> 
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.
74
51
75
52
[!INCLUDE [edit-feed](includes/edit-feed.md)]
76
53
77
54
::: moniker range=">= azure-devops-2019"
78
55
79
56
## Set up your .npmrc files
80
57
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
-
83
58
> [!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.
85
60
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.
87
62
88
-
We recommend that you use two .npmrc files:
63
+
1. Select **Artifacts**, and then select **Connect to feed**.
89
64
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":::
91
66
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.
93
68
94
-
> [!div class="mx-imgBorder"]
95
-
> 
69
+
1. Follow the instructions in the **Project setup** to set up your project.
96
70
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
-
> 
71
+
:::image type="content" source="media/npm-azure-devops-newnav.png" alt-text="Screenshot showing how to set up your project":::
107
72
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
-
112
73
### Set up authentication on your development machine
113
74
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
-
116
75
> [!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).
118
77
119
-
#### Windows
78
+
#### [Windows](#tab/Windows/)
120
79
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 `npminstall -g vsts-npm-auth` to install the package globally and then add a run script to your package.json.
122
81
123
-
```json
82
+
```JSON
124
83
"scripts": {
125
84
"refreshVSToken": "vsts-npm-auth -config .npmrc"
126
85
}
127
86
```
128
87
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**:
130
95
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.
//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
//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 commandin an elevated command prompt window.
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.
134
135
135
136
::: moniker-end
136
137
137
-
## Build your project
138
+
::: moniker range=">=tfs-2017 <= tfs-2018"
138
139
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 thenselect**Connect to feed**.
140
141
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**.
145
143
144
+
3. Select **Generate npm credentials**. Copy the credentials and add them to your .npmrc file.
146
145
147
-
## Publish npm packages
146
+
:::image type="content" source="./media/tfs2018-connect-to-npm-feed.png" alt-text="Screenshot showing how generate credentials":::
148
147
149
-
You can now publish the npm package:
148
+
::: moniker-end
150
149
151
-
1. Browse to the directory that contains your package's package.json file.
150
+
***
152
151
153
-
1. Run `npm publish`.
152
+
## Publish packages
154
153
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 commandin your project directory
156
155
157
-
Your npm package should now be available in your feed.
156
+
```Command
157
+
npm publish
158
+
```
158
159
159
160
> [!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.
161
162
162
-
## Download npm packages
163
+
## Restore packages
163
164
164
-
[!INCLUDE [](includes/npm/install.md)]
165
+
To restore an npm package, run the following commandin your project directory
Copy file name to clipboardexpand all lines: docs/artifacts/get-started-nuget.md
+2
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,8 @@ This quickstart assumes you've already set up Azure Artifacts. You can check out
37
37
38
38
## Create a feed
39
39
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.
Copy file name to clipboardexpand all lines: docs/artifacts/how-to/set-up-upstream-sources.md
+3
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,9 @@ Selecting this option will allow your feed to use packages from public packages
24
24
25
25
## Add public upstream sources to an existing feed
26
26
27
+
> [!NOTE]
28
+
> Upstream sources are not supported in public feeds.
29
+
27
30
1. With your feed selected, select the gear icon  to access your **Feed settings**.
28
31
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.
29
32
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.
Copy file name to clipboardexpand all lines: docs/artifacts/includes/create-feed.md
-2
Original file line number
Diff line number
Diff line change
@@ -7,8 +7,6 @@ author: ramiMSFT
7
7
ms.date: 03/10/2021
8
8
---
9
9
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
-
12
10
::: moniker range=">= azure-devops-2019"
13
11
14
12
1. From within your project, navigate to **Azure Artifacts**.
Copy file name to clipboardexpand all lines: docs/artifacts/includes/nuget/nuget-recommended-version.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -3,8 +3,8 @@ ms.topic: include
3
3
ms.technology: devops-cicd
4
4
ms.author: rabououn
5
5
author: ramiMSFT
6
-
ms.date: 02/19/2020
6
+
ms.date: 10/18/2021
7
7
---
8
8
9
9
> [!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.
0 commit comments