From 3f88b8ae0e44f8132508c5ee164a17c256199612 Mon Sep 17 00:00:00 2001 From: Mackinnon Buck Date: Mon, 5 May 2025 11:13:35 -0700 Subject: [PATCH 1/2] Add JS dependency update instructions to template README --- .../ChatWithCustomData-CSharp.Web/README.md | 4 ++++ .../wwwroot/lib/dompurify/README.md | 2 +- .../wwwroot/lib/marked/README.md | 2 +- .../wwwroot/lib/pdfjs-dist/README.md | 7 ++++++- .../src/ChatWithCustomData/README.Aspire.md | 4 ++++ .../aichatweb/wwwroot/lib/dompurify/README.md | 2 +- .../aichatweb/wwwroot/lib/marked/README.md | 2 +- .../aichatweb/wwwroot/lib/pdfjs-dist/README.md | 7 ++++++- .../aichatweb.BasicAspire.verified/aichatweb/README.md | 4 ++++ .../aichatweb.Web/wwwroot/lib/dompurify/README.md | 2 +- .../aichatweb/aichatweb.Web/wwwroot/lib/marked/README.md | 2 +- .../aichatweb.Web/wwwroot/lib/pdfjs-dist/README.md | 7 ++++++- .../aichatweb/README.md | 4 ++++ .../aichatweb/wwwroot/lib/dompurify/README.md | 2 +- .../aichatweb/wwwroot/lib/marked/README.md | 2 +- .../aichatweb/wwwroot/lib/pdfjs-dist/README.md | 7 ++++++- 16 files changed, 48 insertions(+), 12 deletions(-) diff --git a/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/README.md b/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/README.md index 21f709e8086..44decea800c 100644 --- a/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/README.md +++ b/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/README.md @@ -230,6 +230,10 @@ Make sure to replace `YOUR-AZURE-AI-SEARCH-KEY` and `YOUR-AZURE-AI-SEARCH-ENDPOI 3. Once installed, Open the `Program.cs` file. 4. Run the project by clicking the "Run" button in the Debug view. +# Updating JavaScript dependencies + +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. + # Learn More To learn more about development with .NET and AI, check out the following links: diff --git a/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/wwwroot/lib/dompurify/README.md b/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/wwwroot/lib/dompurify/README.md index 8ccedde96cb..5d34e078c3a 100644 --- a/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/wwwroot/lib/dompurify/README.md +++ b/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/wwwroot/lib/dompurify/README.md @@ -2,4 +2,4 @@ dompurify version 3.2.4 https://github.com/cure53/DOMPurify License: Apache 2.0 and Mozilla Public License 2.0 -To update, replace the files with an updated build from https://www.npmjs.com/package/dompurify +To update, replace the `dist/purify.es.mjs` file with an updated version from https://www.npmjs.com/package/dompurify. diff --git a/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/wwwroot/lib/marked/README.md b/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/wwwroot/lib/marked/README.md index 31aeeb10a82..9f34411f17a 100644 --- a/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/wwwroot/lib/marked/README.md +++ b/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/wwwroot/lib/marked/README.md @@ -2,4 +2,4 @@ marked version 15.0.6 https://github.com/markedjs/marked License: MIT -To update, replace the files with with an updated build from https://www.npmjs.com/package/marked +To update, replace the `dist/marked.esm.js` file with with an updated version from https://www.npmjs.com/package/marked. diff --git a/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/wwwroot/lib/pdfjs-dist/README.md b/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/wwwroot/lib/pdfjs-dist/README.md index 1ec731136cb..9c5ca581563 100644 --- a/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/wwwroot/lib/pdfjs-dist/README.md +++ b/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData-CSharp.Web/wwwroot/lib/pdfjs-dist/README.md @@ -2,4 +2,9 @@ pdfjs-dist version 4.10.38 https://github.com/mozilla/pdf.js License: Apache-2.0 -To update, replace the files with an updated build from https://www.npmjs.com/package/pdfjs-dist +To update, replace the following files with updated versions from https://www.npmjs.com/package/pdfjs-dist: +* `build/pdf.min.mjs` +* `build/pdf.worker.min.mjs` +* `web/pdf_viewer.css` +* `web/pdf_viewer.mjs` +* `web/images/loading-icon.gif` diff --git a/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/README.Aspire.md b/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/README.Aspire.md index 1fcd45b1b54..d1677b7ba78 100644 --- a/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/README.Aspire.md +++ b/src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/README.Aspire.md @@ -184,6 +184,10 @@ Several .NET Aspire templates include ASP.NET Core projects that are configured See [Troubleshoot untrusted localhost certificate in .NET Aspire](https://learn.microsoft.com/dotnet/aspire/troubleshooting/untrusted-localhost-certificate) for more information. +# Updating JavaScript dependencies + +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. + # Learn More To learn more about development with .NET and AI, check out the following links: diff --git a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/wwwroot/lib/dompurify/README.md b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/wwwroot/lib/dompurify/README.md index 3a791cd9324..cc6e6b4153f 100644 --- a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/wwwroot/lib/dompurify/README.md +++ b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/wwwroot/lib/dompurify/README.md @@ -2,4 +2,4 @@ https://github.com/cure53/DOMPurify License: Apache 2.0 and Mozilla Public License 2.0 -To update, replace the files with an updated build from https://www.npmjs.com/package/dompurify +To update, replace the `dist/purify.es.mjs` file with an updated version from https://www.npmjs.com/package/dompurify. diff --git a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/wwwroot/lib/marked/README.md b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/wwwroot/lib/marked/README.md index 889562dd0ca..352b52d5503 100644 --- a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/wwwroot/lib/marked/README.md +++ b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/wwwroot/lib/marked/README.md @@ -2,4 +2,4 @@ https://github.com/markedjs/marked License: MIT -To update, replace the files with with an updated build from https://www.npmjs.com/package/marked +To update, replace the `dist/marked.esm.js` file with with an updated version from https://www.npmjs.com/package/marked. diff --git a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/wwwroot/lib/pdfjs-dist/README.md b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/wwwroot/lib/pdfjs-dist/README.md index 4f4e041bcdf..8e77fba7d43 100644 --- a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/wwwroot/lib/pdfjs-dist/README.md +++ b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.Basic.verified/aichatweb/wwwroot/lib/pdfjs-dist/README.md @@ -2,4 +2,9 @@ https://github.com/mozilla/pdf.js License: Apache-2.0 -To update, replace the files with an updated build from https://www.npmjs.com/package/pdfjs-dist +To update, replace the following files with updated versions from https://www.npmjs.com/package/pdfjs-dist: +* `build/pdf.min.mjs` +* `build/pdf.worker.min.mjs` +* `web/pdf_viewer.css` +* `web/pdf_viewer.mjs` +* `web/images/loading-icon.gif` diff --git a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/README.md b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/README.md index e03802f0ffe..0a467b898bd 100644 --- a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/README.md +++ b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/README.md @@ -39,6 +39,10 @@ Several .NET Aspire templates include ASP.NET Core projects that are configured See [Troubleshoot untrusted localhost certificate in .NET Aspire](https://learn.microsoft.com/dotnet/aspire/troubleshooting/untrusted-localhost-certificate) for more information. +# Updating JavaScript dependencies + +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. + # Learn More To learn more about development with .NET and AI, check out the following links: diff --git a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/wwwroot/lib/dompurify/README.md b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/wwwroot/lib/dompurify/README.md index 3a791cd9324..cc6e6b4153f 100644 --- a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/wwwroot/lib/dompurify/README.md +++ b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/wwwroot/lib/dompurify/README.md @@ -2,4 +2,4 @@ https://github.com/cure53/DOMPurify License: Apache 2.0 and Mozilla Public License 2.0 -To update, replace the files with an updated build from https://www.npmjs.com/package/dompurify +To update, replace the `dist/purify.es.mjs` file with an updated version from https://www.npmjs.com/package/dompurify. diff --git a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/wwwroot/lib/marked/README.md b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/wwwroot/lib/marked/README.md index 889562dd0ca..352b52d5503 100644 --- a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/wwwroot/lib/marked/README.md +++ b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/wwwroot/lib/marked/README.md @@ -2,4 +2,4 @@ https://github.com/markedjs/marked License: MIT -To update, replace the files with with an updated build from https://www.npmjs.com/package/marked +To update, replace the `dist/marked.esm.js` file with with an updated version from https://www.npmjs.com/package/marked. diff --git a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/wwwroot/lib/pdfjs-dist/README.md b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/wwwroot/lib/pdfjs-dist/README.md index 4f4e041bcdf..8e77fba7d43 100644 --- a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/wwwroot/lib/pdfjs-dist/README.md +++ b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.BasicAspire.verified/aichatweb/aichatweb.Web/wwwroot/lib/pdfjs-dist/README.md @@ -2,4 +2,9 @@ https://github.com/mozilla/pdf.js License: Apache-2.0 -To update, replace the files with an updated build from https://www.npmjs.com/package/pdfjs-dist +To update, replace the following files with updated versions from https://www.npmjs.com/package/pdfjs-dist: +* `build/pdf.min.mjs` +* `build/pdf.worker.min.mjs` +* `web/pdf_viewer.css` +* `web/pdf_viewer.mjs` +* `web/images/loading-icon.gif` diff --git a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/README.md b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/README.md index f4a928c401a..53730a18884 100644 --- a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/README.md +++ b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/README.md @@ -57,6 +57,10 @@ Make sure to replace `YOUR-AZURE-AI-SEARCH-ENDPOINT` with your actual Azure AI S 3. Once installed, Open the `Program.cs` file. 4. Run the project by clicking the "Run" button in the Debug view. +# Updating JavaScript dependencies + +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. + # Learn More To learn more about development with .NET and AI, check out the following links: diff --git a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/wwwroot/lib/dompurify/README.md b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/wwwroot/lib/dompurify/README.md index 3a791cd9324..cc6e6b4153f 100644 --- a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/wwwroot/lib/dompurify/README.md +++ b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/wwwroot/lib/dompurify/README.md @@ -2,4 +2,4 @@ https://github.com/cure53/DOMPurify License: Apache 2.0 and Mozilla Public License 2.0 -To update, replace the files with an updated build from https://www.npmjs.com/package/dompurify +To update, replace the `dist/purify.es.mjs` file with an updated version from https://www.npmjs.com/package/dompurify. diff --git a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/wwwroot/lib/marked/README.md b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/wwwroot/lib/marked/README.md index 889562dd0ca..352b52d5503 100644 --- a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/wwwroot/lib/marked/README.md +++ b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/wwwroot/lib/marked/README.md @@ -2,4 +2,4 @@ https://github.com/markedjs/marked License: MIT -To update, replace the files with with an updated build from https://www.npmjs.com/package/marked +To update, replace the `dist/marked.esm.js` file with with an updated version from https://www.npmjs.com/package/marked. diff --git a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/wwwroot/lib/pdfjs-dist/README.md b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/wwwroot/lib/pdfjs-dist/README.md index 4f4e041bcdf..8e77fba7d43 100644 --- a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/wwwroot/lib/pdfjs-dist/README.md +++ b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Snapshots/aichatweb.OpenAI_AzureAISearch.verified/aichatweb/wwwroot/lib/pdfjs-dist/README.md @@ -2,4 +2,9 @@ https://github.com/mozilla/pdf.js License: Apache-2.0 -To update, replace the files with an updated build from https://www.npmjs.com/package/pdfjs-dist +To update, replace the following files with updated versions from https://www.npmjs.com/package/pdfjs-dist: +* `build/pdf.min.mjs` +* `build/pdf.worker.min.mjs` +* `web/pdf_viewer.css` +* `web/pdf_viewer.mjs` +* `web/images/loading-icon.gif` From 901c6be39f16a63023f908b30849f09d034eb1a5 Mon Sep 17 00:00:00 2001 From: Mackinnon Buck Date: Mon, 5 May 2025 12:20:46 -0700 Subject: [PATCH 2/2] Add info about CG --- src/ProjectTemplates/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ProjectTemplates/README.md b/src/ProjectTemplates/README.md index 6f69a23450d..5ac7bb096f8 100644 --- a/src/ProjectTemplates/README.md +++ b/src/ProjectTemplates/README.md @@ -11,6 +11,16 @@ To update project template JavaScript dependencies: To add a new dependency, run `npm install ` and update the `scripts` section in `package.json` to specify how the new dependency should be copied into its template. +# Component governance + +There are two types of template dependencies that need to get scanned for component governance (CG): +* .NET dependencies (specified via `` in each `.csproj` file) +* JS dependencies (everything in the `wwwroot/lib` folder of the `.Web` project) + +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. + +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`. + # Running AI templates ## Build the templates using just-built library package versions