forked from dotnet/aspnetcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Infrastructure] Move back to NPM (dotnet#52914)
This change removes Yarn from our infrastructure completely and replaces it with NPM. There is a package.json in the top folder of the respository that defines the workspace. The workspace lists all the paths to packages that are part of the repository. In addition to that, the top package.json defines scripts that can be run from the root of the repository to install, build test, etc. all the packages in the repository. Each package has its own package.json file that defines its dependencies and scripts. The scripts in the top package.json file are just wrappers around the scripts in the individual package.json files. ## Developer workflow ### Restore dependencies To install the dependencies, you can run npm ci from the root of the repository. This will install all the dependencies for all the packages in the repository and automatically link them together. This normally takes very little time once you've have downloaded the packages onto your machine (10s for me). ### Install or update new dependencies Run npm install ... on whatever node you want to install the dependencies. The package-lock.json will get updated accordingly. For installing new dependencies you might need to authenticate yourself with the NPM VSTS feed. To do that, run: * `npm install -g vsts-npm-auth` * `vsts-npm-auth -config .npmrc -F`. This will walk you through the auth process and provision the required credentials. * `npm install` ### Updating deps to fix Component Governance alerts * Run npm audit to see the list of issues. * Run npm audit fix to see if the issues can get addressed automatically. * If that's not the case: * If possible, update to a newer version of the package that doesn't include the vulnerable dependency. * If that's not possible, at the appropriate node, add an entry to the "overrides" property to force the transitive dependency into a non-vulnerable version. * run npm install from the root. * run npm audit again to see if the issues have disappeared, if they haven't continue making changes (update more packages, etc). Upgrading the main deps should always be the preferred route over using overrides. Overrides require that we periodically remove them to check if we can update the dependency later on. ### Building JS components You can run `npm run build` at the repo root and it will build all the projects (takes about 2 minutes). Or alternatively, you can run `npm run build` on an individual project.json to build only that `project.json`. If you do this, any dependent project should have been built previously. Dependencies won't get build automatically. ### Testing JS components There are two test categories: * Unit tests: They are self-contained and don't depend on any of the .NET Code. Run `npm run test`. * Integration tests: They test the JS in combination with the .NET Code, for which you first need to have run `eng\Build.cmd`, before you invoke the tests. To execute them, run `npm run integration-test`
- Loading branch information
Showing
93 changed files
with
20,049 additions
and
23,633 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<Project> | ||
|
||
<!-- Import Directory.Build.Props --> | ||
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.props" /> | ||
|
||
<PropertyGroup> | ||
<IsTestProject>true</IsTestProject> | ||
<IsUnitTestProject>true</IsUnitTestProject> | ||
<IsIntegrationTestProject>true</IsIntegrationTestProject> | ||
<TestDependsOnAspNetPackages>false</TestDependsOnAspNetPackages> | ||
<TestDependsOnAspNetAppPackages>false</TestDependsOnAspNetAppPackages> | ||
<TestDependsOnAspNetRuntime>false</TestDependsOnAspNetRuntime> | ||
<ContainsFunctionalTestAssets>false</ContainsFunctionalTestAssets> | ||
<BuildHelixPayload>false</BuildHelixPayload> | ||
<PackageVersion>$(VersionPrefix)$(VersionSuffix)</PackageVersion> | ||
<RequiresDelayedBuild>true</RequiresDelayedBuild> | ||
<TestGroupName>FunctionalTests</TestGroupName> | ||
<RuntimeIdentifier Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">win-x86</RuntimeIdentifier> | ||
</PropertyGroup> | ||
|
||
<Target Name="Restore" /> | ||
<Target Name="Build" /> | ||
<Target Name="Pack" /> | ||
<Target Name="Publish" /> | ||
|
||
<Target Name="_Test" BeforeTargets="Test"> | ||
<Message Text="Testing NPM packages..." Importance="high" /> | ||
<Exec Command="npm run integration-test" WorkingDirectory="$(MSBuildThisFileDirectory).." /> | ||
</Target> | ||
|
||
<Target Name="GetReferencesProvided" Returns="@(ProvidesReference)"> | ||
<ItemGroup> | ||
<!-- Include File name without the extension --> | ||
<ProvidesReference Include="Npm.Workspace.FunctionalTests"> | ||
<IsAspNetCoreApp>$([MSBuild]::ValueOrDefault($(IsAspNetCoreApp),'false'))</IsAspNetCoreApp> | ||
<IsPackable>$([MSBuild]::ValueOrDefault($(IsPackable),'false'))</IsPackable> | ||
<ProjectFileRelativePath>$([MSBuild]::MakeRelative($(RepoRoot), $(MSBuildProjectFullPath)))</ProjectFileRelativePath> | ||
<IsTrimmable>$([MSBuild]::ValueOrDefault($(IsTrimmable),'false'))</IsTrimmable> | ||
<IsShippingPackage>$([MSBuild]::ValueOrDefault($(IsShippingPackage),'false'))</IsShippingPackage> | ||
|
||
<!-- True if the project may be referenced using a @(Reference) item. --> | ||
<IsProjectReferenceProvider>$([MSBuild]::ValueOrDefault($(IsProjectReferenceProvider),'false'))</IsProjectReferenceProvider> | ||
|
||
<!-- True if project must be restored etc. after App.Ref and App.Runtime are fully built. --> | ||
<RequiresDelayedBuild>$([MSBuild]::ValueOrDefault($(RequiresDelayedBuild),'false'))</RequiresDelayedBuild> | ||
</ProvidesReference> | ||
</ItemGroup> | ||
</Target> | ||
|
||
<!-- Import Directory.Build.targets --> | ||
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.targets" /> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<Project> | ||
|
||
<!-- Import Directory.Build.Props --> | ||
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.props" /> | ||
|
||
<PropertyGroup> | ||
<IsTestProject>true</IsTestProject> | ||
<IsUnitTestProject>true</IsUnitTestProject> | ||
<TestDependsOnAspNetPackages>false</TestDependsOnAspNetPackages> | ||
<TestDependsOnAspNetAppPackages>false</TestDependsOnAspNetAppPackages> | ||
<TestDependsOnAspNetRuntime>false</TestDependsOnAspNetRuntime> | ||
<ContainsFunctionalTestAssets>false</ContainsFunctionalTestAssets> | ||
<BuildHelixPayload>false</BuildHelixPayload> | ||
<PackageVersion>$(VersionPrefix)$(VersionSuffix)</PackageVersion> | ||
</PropertyGroup> | ||
|
||
<Target Name="Restore"> | ||
<Message Text="Restoring NPM packages..." Importance="high" /> | ||
<Exec Command="npm ci" WorkingDirectory="$(MSBuildThisFileDirectory).." /> | ||
</Target> | ||
|
||
<Target Name="Build"> | ||
<Message Text="Building NPM packages..." Importance="high" /> | ||
<Exec Command="npm run build" WorkingDirectory="$(MSBuildThisFileDirectory).." /> | ||
</Target> | ||
|
||
<Target Name="_Test" BeforeTargets="Test"> | ||
<Message Text="Testing NPM packages..." Importance="high" /> | ||
<Exec Command="npm run test" ContinueOnError="true" WorkingDirectory="$(MSBuildThisFileDirectory).." /> | ||
</Target> | ||
|
||
<Target Name="Pack"> | ||
<Message Text="Packing NPM packages..." Importance="high" /> | ||
<MakeDir Directories="$(PackageOutputPath)" Condition="!Exists('$(PackageOutputPath)')" /> | ||
<Exec Command="node $(MSBuildThisFileDirectory)scripts\pack-workspace.js $(RepoRoot)package.json $(PackageVersion) $(PackageOutputPath)" /> | ||
</Target> | ||
|
||
<!-- Import Directory.Build.targets --> | ||
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.targets" /> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.