Skip to content

Commit 1c7af3c

Browse files
Add JS dependency update instructions to chat template README (#6376)
1 parent 92eed0f commit 1c7af3c

File tree

17 files changed

+58
-12
lines changed

17 files changed

+58
-12
lines changed

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ Make sure to replace `YOUR-AZURE-AI-SEARCH-KEY` and `YOUR-AZURE-AI-SEARCH-ENDPOI
230230
3. Once installed, Open the `Program.cs` file.
231231
4. Run the project by clicking the "Run" button in the Debug view.
232232
233+
# Updating JavaScript dependencies
234+
235+
This template leverages JavaScript libraries to provide essential functionality. These libraries are located in the wwwroot/lib folder. For instructions on updating each dependency, please refer to the README.md file in each respective folder.
236+
233237
# Learn More
234238
To learn more about development with .NET and AI, check out the following links:
235239

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/wwwroot/lib/dompurify/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ dompurify version 3.2.4
22
https://github.com/cure53/DOMPurify
33
License: Apache 2.0 and Mozilla Public License 2.0
44

5-
To update, replace the files with an updated build from https://www.npmjs.com/package/dompurify
5+
To update, replace the `dist/purify.es.mjs` file with an updated version from https://www.npmjs.com/package/dompurify.

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/wwwroot/lib/marked/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ marked version 15.0.6
22
https://github.com/markedjs/marked
33
License: MIT
44

5-
To update, replace the files with with an updated build from https://www.npmjs.com/package/marked
5+
To update, replace the `dist/marked.esm.js` file with with an updated version from https://www.npmjs.com/package/marked.

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/wwwroot/lib/pdfjs-dist/README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@ pdfjs-dist version 4.10.38
22
https://github.com/mozilla/pdf.js
33
License: Apache-2.0
44

5-
To update, replace the files with an updated build from https://www.npmjs.com/package/pdfjs-dist
5+
To update, replace the following files with updated versions from https://www.npmjs.com/package/pdfjs-dist:
6+
* `build/pdf.min.mjs`
7+
* `build/pdf.worker.min.mjs`
8+
* `web/pdf_viewer.css`
9+
* `web/pdf_viewer.mjs`
10+
* `web/images/loading-icon.gif`

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/README.Aspire.md

+4
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ Several .NET Aspire templates include ASP.NET Core projects that are configured
184184

185185
See [Troubleshoot untrusted localhost certificate in .NET Aspire](https://learn.microsoft.com/dotnet/aspire/troubleshooting/untrusted-localhost-certificate) for more information.
186186

187+
# Updating JavaScript dependencies
188+
189+
This template leverages JavaScript libraries to provide essential functionality. These libraries are located in the wwwroot/lib folder of the ChatWithCustomData-CSharp.Web project. For instructions on updating each dependency, please refer to the README.md file in each respective folder.
190+
187191
# Learn More
188192
To learn more about development with .NET and AI, check out the following links:
189193

src/ProjectTemplates/README.md

+10
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ To update project template JavaScript dependencies:
1111

1212
To add a new dependency, run `npm install <package-name>` and update the `scripts` section in `package.json` to specify how the new dependency should be copied into its template.
1313

14+
# Component governance
15+
16+
There are two types of template dependencies that need to get scanned for component governance (CG):
17+
* .NET dependencies (specified via `<PackageReference />` in each `.csproj` file)
18+
* JS dependencies (everything in the `wwwroot/lib` folder of the `.Web` project)
19+
20+
There are template execution tests in the `test/ProjectTemplates` folder of this repo that create, restore, and build each possible variation of the template. These tests execute before the CG step of the internal CI pipeline, which scans the build artifacts from each generated project (namely the `project.assets.json` file and the local NuGet package cache) to detect which .NET dependencies got pulled in.
21+
22+
However, CG can't detect JS dependencies by scanning execution test output, because the generated projects don't contain manifests describing JS dependencies. Instead, we have a `package.json` and `package-lock.json` in the same folder as this README that define which JS dependencies get included in the template and how they get copied into template content (see previous section in this document). CG then automatically tracks packages listed in this `package-lock.json`.
23+
1424
# Running AI templates
1525

1626
## Build the templates using just-built library package versions

test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/wwwroot/lib/dompurify/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
https://github.com/cure53/DOMPurify
33
License: Apache 2.0 and Mozilla Public License 2.0
44

5-
To update, replace the files with an updated build from https://www.npmjs.com/package/dompurify
5+
To update, replace the `dist/purify.es.mjs` file with an updated version from https://www.npmjs.com/package/dompurify.

test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/wwwroot/lib/marked/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
https://github.com/markedjs/marked
33
License: MIT
44

5-
To update, replace the files with with an updated build from https://www.npmjs.com/package/marked
5+
To update, replace the `dist/marked.esm.js` file with with an updated version from https://www.npmjs.com/package/marked.

test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/wwwroot/lib/pdfjs-dist/README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@
22
https://github.com/mozilla/pdf.js
33
License: Apache-2.0
44

5-
To update, replace the files with an updated build from https://www.npmjs.com/package/pdfjs-dist
5+
To update, replace the following files with updated versions from https://www.npmjs.com/package/pdfjs-dist:
6+
* `build/pdf.min.mjs`
7+
* `build/pdf.worker.min.mjs`
8+
* `web/pdf_viewer.css`
9+
* `web/pdf_viewer.mjs`
10+
* `web/images/loading-icon.gif`

test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ Several .NET Aspire templates include ASP.NET Core projects that are configured
3939

4040
See [Troubleshoot untrusted localhost certificate in .NET Aspire](https://learn.microsoft.com/dotnet/aspire/troubleshooting/untrusted-localhost-certificate) for more information.
4141

42+
# Updating JavaScript dependencies
43+
44+
This template leverages JavaScript libraries to provide essential functionality. These libraries are located in the wwwroot/lib folder of the aichatweb.Web project. For instructions on updating each dependency, please refer to the README.md file in each respective folder.
45+
4246
# Learn More
4347
To learn more about development with .NET and AI, check out the following links:
4448

test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/wwwroot/lib/dompurify/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
https://github.com/cure53/DOMPurify
33
License: Apache 2.0 and Mozilla Public License 2.0
44

5-
To update, replace the files with an updated build from https://www.npmjs.com/package/dompurify
5+
To update, replace the `dist/purify.es.mjs` file with an updated version from https://www.npmjs.com/package/dompurify.

test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/wwwroot/lib/marked/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
https://github.com/markedjs/marked
33
License: MIT
44

5-
To update, replace the files with with an updated build from https://www.npmjs.com/package/marked
5+
To update, replace the `dist/marked.esm.js` file with with an updated version from https://www.npmjs.com/package/marked.

test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/wwwroot/lib/pdfjs-dist/README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@
22
https://github.com/mozilla/pdf.js
33
License: Apache-2.0
44

5-
To update, replace the files with an updated build from https://www.npmjs.com/package/pdfjs-dist
5+
To update, replace the following files with updated versions from https://www.npmjs.com/package/pdfjs-dist:
6+
* `build/pdf.min.mjs`
7+
* `build/pdf.worker.min.mjs`
8+
* `web/pdf_viewer.css`
9+
* `web/pdf_viewer.mjs`
10+
* `web/images/loading-icon.gif`

test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ Make sure to replace `YOUR-AZURE-AI-SEARCH-ENDPOINT` with your actual Azure AI S
5757
3. Once installed, Open the `Program.cs` file.
5858
4. Run the project by clicking the "Run" button in the Debug view.
5959
60+
# Updating JavaScript dependencies
61+
62+
This template leverages JavaScript libraries to provide essential functionality. These libraries are located in the wwwroot/lib folder. For instructions on updating each dependency, please refer to the README.md file in each respective folder.
63+
6064
# Learn More
6165
To learn more about development with .NET and AI, check out the following links:
6266

test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/wwwroot/lib/dompurify/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
https://github.com/cure53/DOMPurify
33
License: Apache 2.0 and Mozilla Public License 2.0
44

5-
To update, replace the files with an updated build from https://www.npmjs.com/package/dompurify
5+
To update, replace the `dist/purify.es.mjs` file with an updated version from https://www.npmjs.com/package/dompurify.

test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/wwwroot/lib/marked/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
https://github.com/markedjs/marked
33
License: MIT
44

5-
To update, replace the files with with an updated build from https://www.npmjs.com/package/marked
5+
To update, replace the `dist/marked.esm.js` file with with an updated version from https://www.npmjs.com/package/marked.

test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/wwwroot/lib/pdfjs-dist/README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@
22
https://github.com/mozilla/pdf.js
33
License: Apache-2.0
44

5-
To update, replace the files with an updated build from https://www.npmjs.com/package/pdfjs-dist
5+
To update, replace the following files with updated versions from https://www.npmjs.com/package/pdfjs-dist:
6+
* `build/pdf.min.mjs`
7+
* `build/pdf.worker.min.mjs`
8+
* `web/pdf_viewer.css`
9+
* `web/pdf_viewer.mjs`
10+
* `web/images/loading-icon.gif`

0 commit comments

Comments
 (0)