Replace npm commands with yarn

This commit is contained in:
Nate McMaster 2019-02-13 20:47:04 -08:00 committed by Nate McMaster
parent f19e8da1da
commit 5be7d30231
21 changed files with 69 additions and 35 deletions

View File

@ -9,5 +9,6 @@
--> -->
<add key="dotnet-core" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" /> <add key="dotnet-core" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
<add key="myget.org aspnetcore-tools" value="https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json" /> <add key="myget.org aspnetcore-tools" value="https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources> </packageSources>
</configuration> </configuration>

View File

@ -306,6 +306,7 @@ $MSBuildArguments += "/p:TargetOsName=win"
Import-Module -Force -Scope Local (Join-Path $korebuildPath 'KoreBuild.psd1') Import-Module -Force -Scope Local (Join-Path $korebuildPath 'KoreBuild.psd1')
try { try {
$env:KOREBUILD_KEEPGLOBALJSON = 1
Set-KoreBuildSettings -ToolsSource $ToolsSource -DotNetHome $DotNetHome -RepoPath $PSScriptRoot -ConfigFile $ConfigFile -CI:$CI Set-KoreBuildSettings -ToolsSource $ToolsSource -DotNetHome $DotNetHome -RepoPath $PSScriptRoot -ConfigFile $ConfigFile -CI:$CI
if ($ForceCoreMsbuild) { if ($ForceCoreMsbuild) {
$global:KoreBuildSettings.MSBuildType = 'core' $global:KoreBuildSettings.MSBuildType = 'core'
@ -315,4 +316,5 @@ try {
finally { finally {
Remove-Module 'KoreBuild' -ErrorAction Ignore Remove-Module 'KoreBuild' -ErrorAction Ignore
Remove-Item env:DOTNET_HOME Remove-Item env:DOTNET_HOME
Remove-Item env:KOREBUILD_KEEPGLOBALJSON
} }

View File

@ -14,6 +14,7 @@
<PackageReference Remove="Internal.AspNetCore.Sdk" /> <PackageReference Remove="Internal.AspNetCore.Sdk" />
<PackageReference Include="NuGet.Build.Tasks" Version="4.9.3" /> <PackageReference Include="NuGet.Build.Tasks" Version="4.9.3" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="2.1.0" /> <PackageReference Include="Microsoft.Extensions.DependencyModel" Version="2.1.0" />
<PackageReference Include="Yarn.MSBuild" Version="1.13.0" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(BuildInstallers)' == 'true' AND '$(TargetOsName)' == 'win'"> <ItemGroup Condition="'$(BuildInstallers)' == 'true' AND '$(TargetOsName)' == 'win'">

View File

@ -1,11 +1,15 @@
<Project DefaultTargets="Build" InitialTargets="_CheckForInvalidConfiguration"> <Project DefaultTargets="Build" InitialTargets="_CheckForInvalidConfiguration">
<!-- Version of this SDK is set in global.json -->
<Sdk Name="Yarn.MSBuild" />
<PropertyGroup> <PropertyGroup>
<NormalizedPackageId>$(PackageId.Replace('@','').Replace('/','-'))</NormalizedPackageId> <NormalizedPackageId>$(PackageId.Replace('@','').Replace('/','-'))</NormalizedPackageId>
<PackageFileName>$(NormalizedPackageId)-$(PackageVersion).tgz</PackageFileName> <PackageFileName>$(NormalizedPackageId)-$(PackageVersion).tgz</PackageFileName>
<PackageJson>$(MSBuildProjectDirectory)\package.json</PackageJson> <PackageJson>$(MSBuildProjectDirectory)\package.json</PackageJson>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)' == ''">$(MSBuildProjectDirectory)\obj\</BaseIntermediateOutputPath> <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)' == ''">$(MSBuildProjectDirectory)\obj\</BaseIntermediateOutputPath>
<IntermediateOutputPath>$([MSBuild]::NormalizeDirectory('$(BaseIntermediateOutputPath)'))$(Configuration)\</IntermediateOutputPath> <IntermediateOutputPath>$([MSBuild]::NormalizeDirectory('$(BaseIntermediateOutputPath)'))$(Configuration)\</IntermediateOutputPath>
<InstallArgs Condition="'$(RestoreLockedMode)' == 'true'">--frozen-lockfile</InstallArgs>
</PropertyGroup> </PropertyGroup>
<Target Name="_CheckForInvalidConfiguration"> <Target Name="_CheckForInvalidConfiguration">
@ -13,9 +17,8 @@
</Target> </Target>
<Target Name="Restore"> <Target Name="Restore">
<Message Importance="High" Text="Running npm install on $(MSBuildProjectFullPath)" /> <Message Importance="High" Text="Running yarn install on $(MSBuildProjectFullPath)" />
<Exec Command="npm ci" Condition="'$(CI)' == 'true'" /> <Yarn Command="install $(InstallArgs)" />
<Exec Command="npm install --no-optional" Condition="'$(CI)' != 'true'" />
</Target> </Target>
<Target Name="PrepareForBuild"> <Target Name="PrepareForBuild">
@ -28,7 +31,7 @@
</Target> </Target>
<Target Name="Build" DependsOnTargets="PrepareForBuild;ResolveProjectReferences"> <Target Name="Build" DependsOnTargets="PrepareForBuild;ResolveProjectReferences">
<Exec Command="npm run build" IgnoreStandardErrorWarningFormat="true" Condition="'$(IsBuildable)' != 'false'" /> <Yarn Command="run build" Condition="'$(IsBuildable)' != 'false'" StandardOutputImportance="High" StandardErrorImportance="High" />
</Target> </Target>
<PropertyGroup> <PropertyGroup>
@ -50,8 +53,8 @@
<Copy SourceFiles="$(PackageJson)" DestinationFiles="$(_BackupPackageJson)" /> <Copy SourceFiles="$(PackageJson)" DestinationFiles="$(_BackupPackageJson)" />
<Exec Command="npm --no-git-tag-version --allow-same-version version $(PackageVersion)" StandardOutputImportance="Normal" StandardErrorImportance="Normal" /> <Yarn Command="version --no-git-tag-version --new-version $(PackageVersion)" />
<Exec Command="npm pack" StandardOutputImportance="Normal" StandardErrorImportance="Normal" /> <Yarn Command="pack --filename $(PackageFileName)" />
<Move SourceFiles="$(_PackageTargetPath)" DestinationFolder="$(PackageOutputPath)" /> <Move SourceFiles="$(_PackageTargetPath)" DestinationFolder="$(PackageOutputPath)" />
<Message Importance="High" Text="$(MSBuildProjectName) -> $(_PackageTargetPath)" /> <Message Importance="High" Text="$(MSBuildProjectName) -> $(_PackageTargetPath)" />
@ -66,7 +69,7 @@
<Target Name="Test" Condition="'$(IsTestProject)' == 'true'"> <Target Name="Test" Condition="'$(IsTestProject)' == 'true'">
<Message Importance="High" Text="Running npm tests for $(MSBuildProjectName)" /> <Message Importance="High" Text="Running npm tests for $(MSBuildProjectName)" />
<Exec Command="npm $(NpmTestArgs)" IgnoreStandardErrorWarningFormat="true" /> <Yarn Command="$(NpmTestArgs)" StandardOutputImportance="High" StandardErrorImportance="High" />
</Target> </Target>
</Project> </Project>

View File

@ -3,6 +3,6 @@
"version": "3.0.100-preview-010184" "version": "3.0.100-preview-010184"
}, },
"msbuild-sdks": { "msbuild-sdks": {
"Internal.AspNetCore.Sdk": "3.0.0-build-20190219.1" "Yarn.MSBuild": "1.13.0"
} }
} }

View File

@ -17,8 +17,8 @@
Inputs="@(WebpackInputs)" Inputs="@(WebpackInputs)"
Outputs="dist\components.webassembly.js;dist\components.server.js"> Outputs="dist\components.webassembly.js;dist\components.server.js">
<RemoveDir Directories="dist" /> <RemoveDir Directories="dist" />
<Exec Command="npm run build:debug" Condition="'$(Configuration)' == 'Debug'" /> <Yarn Command="run build:debug" Condition="'$(Configuration)' == 'Debug'" />
<Exec Command="npm run build:production" Condition="'$(Configuration)' != 'Debug'" /> <Yarn Command="run build:production" Condition="'$(Configuration)' != 'Debug'" />
</Target> </Target>
</Project> </Project>

View File

@ -1,5 +1,6 @@
{ {
"name": "microsoft.aspnetcore.components.browser.js", "name": "microsoft.aspnetcore.components.browser.js",
"private": true,
"version": "0.0.1", "version": "0.0.1",
"description": "", "description": "",
"main": "index.js", "main": "index.js",

View File

@ -18,9 +18,12 @@
<Compile Include="$(SharedSourceRoot)Process\**\*.cs" LinkBase="Shared" /> <Compile Include="$(SharedSourceRoot)Process\**\*.cs" LinkBase="Shared" />
</ItemGroup> </ItemGroup>
<Target Name="EnsureNpmRestored" BeforeTargets="Build" Condition="!Exists('node_modules') AND '$(BlazorAllTests)'=='true'"> <!-- Version of this SDK is set in global.json -->
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." /> <Sdk Name="Yarn.MSBuild" />
<Exec Command="npm ci" />
<Target Name="EnsureNodeJSRestored" BeforeTargets="Build" Condition="'$(BlazorAllTests)'=='true'">
<Message Text="Running yarn install on $(MSBuildProjectFile)" Importance="High" />
<Yarn Command="install" />
</Target> </Target>
<ItemGroup> <ItemGroup>

View File

@ -3,6 +3,7 @@
"version": "0.0.1", "version": "0.0.1",
"description": "Not a real package. This file exists only to declare dependencies.", "description": "Not a real package. This file exists only to declare dependencies.",
"main": "index.js", "main": "index.js",
"private": true,
"scripts": { "scripts": {
"selenium-standalone": "selenium-standalone", "selenium-standalone": "selenium-standalone",
"prepare": "selenium-standalone install" "prepare": "selenium-standalone install"

View File

@ -14,7 +14,7 @@
<Target Name="InstallPuppeteer" BeforeTargets="Restore"> <Target Name="InstallPuppeteer" BeforeTargets="Restore">
<!-- Explicitly install puppeteer. This will install the bundled Chromium as part of restore instead of as part of execution --> <!-- Explicitly install puppeteer. This will install the bundled Chromium as part of restore instead of as part of execution -->
<Exec Command="npm install puppeteer" /> <Yarn Command="add puppeteer" />
</Target> </Target>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" /> <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />

View File

@ -1,4 +1,5 @@
{ {
"private": true,
"devDependencies": { "devDependencies": {
"jest": "^23.6.0", "jest": "^23.6.0",
"merge": "^1.2.1", "merge": "^1.2.1",

View File

@ -17,8 +17,15 @@
<Reference Include="Newtonsoft.Json" /> <Reference Include="Newtonsoft.Json" />
</ItemGroup> </ItemGroup>
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish" Condition=" '$(IsCrossTargetingBuild)' != 'true' "> <!-- Version of this SDK is set in global.json -->
<Exec Command="npm install" /> <Sdk Name="Yarn.MSBuild" />
<Target Name="YarnInstall">
<Message Text="Running yarn install on $(MSBuildProjectFile)" Importance="High" />
<Yarn Command="install" />
</Target>
<Target Name="PrepublishScript" DependsOnTargets="YarnInstall" BeforeTargets="PrepareForPublish" Condition=" '$(IsCrossTargetingBuild)' != 'true' ">
<Exec Command="node node_modules/webpack/bin/webpack.js" /> <Exec Command="node node_modules/webpack/bin/webpack.js" />
</Target> </Target>

View File

@ -2,6 +2,7 @@
"name": "nodeservices", "name": "nodeservices",
"version": "1.0.0", "version": "1.0.0",
"description": "This is not really an NPM package and will not be published. This file exists only to reference compilation tools.", "description": "This is not really an NPM package and will not be published. This file exists only to reference compilation tools.",
"private": true,
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",

View File

@ -20,8 +20,15 @@
<Reference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" /> <Reference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" />
</ItemGroup> </ItemGroup>
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish" Condition=" '$(IsCrossTargetingBuild)' != 'true' "> <!-- Version of this SDK is set in global.json -->
<Exec Command="npm install" /> <Sdk Name="Yarn.MSBuild" />
<Target Name="YarnInstall">
<Message Text="Running yarn install on $(MSBuildProjectFile)" Importance="High" />
<Yarn Command="install" />
</Target>
<Target Name="PrepublishScript" DependsOnTargets="YarnInstall" BeforeTargets="PrepareForPublish" Condition=" '$(IsCrossTargetingBuild)' != 'true' ">
<Exec Command="node node_modules/webpack/bin/webpack.js" /> <Exec Command="node node_modules/webpack/bin/webpack.js" />
</Target> </Target>

View File

@ -2,6 +2,7 @@
"name": "spaservices", "name": "spaservices",
"version": "1.0.0", "version": "1.0.0",
"description": "This is not really an NPM package and will not be published. This file exists only to reference compilation tools.", "description": "This is not really an NPM package and will not be published. This file exists only to reference compilation tools.",
"private": true,
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",

View File

@ -8,12 +8,10 @@
<_TestSauceArgs>--verbose --no-color --configuration $(Configuration) --sauce-user "$(SauceUser)" --sauce-key "$(SauceKey)"</_TestSauceArgs> <_TestSauceArgs>--verbose --no-color --configuration $(Configuration) --sauce-user "$(SauceUser)" --sauce-key "$(SauceKey)"</_TestSauceArgs>
<_TestSauceArgs Condition="'$(BrowserTestHostName)' != ''">$(_TestSauceArgs) --use-hostname "$(BrowserTestHostName)"</_TestSauceArgs> <_TestSauceArgs Condition="'$(BrowserTestHostName)' != ''">$(_TestSauceArgs) --use-hostname "$(BrowserTestHostName)"</_TestSauceArgs>
<NpmTestArgs Condition="'$(DailyTests)' != 'true'">run test:local -- --no-color --configuration $(Configuration)</NpmTestArgs> <NpmTestArgs Condition="'$(DailyTests)' != 'true'">run test:local -- --no-color --configuration $(Configuration)</NpmTestArgs>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="FunctionalTests.csproj" Condition="'$(BuildManaged)' != 'false'" /> <ProjectReference Include="FunctionalTests.csproj" Condition="'$(BuildManaged)' == 'true'" />
<ProjectReference Include="..\signalr\signalr.npmproj" /> <ProjectReference Include="..\signalr\signalr.npmproj" />
<ProjectReference Include="..\signalr-protocol-msgpack\signalr-protocol-msgpack.npmproj" /> <ProjectReference Include="..\signalr-protocol-msgpack\signalr-protocol-msgpack.npmproj" />
</ItemGroup> </ItemGroup>
@ -21,21 +19,20 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" /> <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
<Target Name="Test" Condition="'$(IsTestProject)' == 'true'"> <Target Name="Test" Condition="'$(IsTestProject)' == 'true'">
<Message Importance="High" Text="Running npm tests for $(MSBuildProjectName)" /> <Message Importance="High" Text="Running tests for $(MSBuildProjectName)" />
<Exec Condition="'$(DailyTests)' != 'true'" Command="npm $(NpmTestArgs)" IgnoreStandardErrorWarningFormat="true" /> <Yarn Condition="'$(DailyTests)' != 'true'" Command="$(NpmTestArgs)" />
<CallTarget Condition="'$(DailyTests)' == 'true'" Targets="RunBrowserTests" /> <CallTarget Condition="'$(DailyTests)' == 'true'" Targets="RunBrowserTests" />
</Target> </Target>
<Target Name="RunBrowserTests"> <Target Name="RunBrowserTests">
<Message Text="Running JavaScript client Browser tests" Importance="high" /> <Message Text="Running JavaScript client Browser tests" Importance="high" />
<Exec Command="npm run test:inner -- --no-color --configuration $(Configuration)" WorkingDirectory="$(RepositoryRoot)src/SignalR/clients/ts/FunctionalTests" IgnoreStandardErrorWarningFormat="true" /> <Yarn Command="run test:inner -- --no-color --configuration $(Configuration)" WorkingDirectory="$(RepositoryRoot)src/SignalR/clients/ts/FunctionalTests" />
<Message Text="Running JavaScript tests" Importance="high" /> <Message Text="Running JavaScript tests" Importance="high" />
<!-- Skip the "inner" test run when we're running DailyTests --> <!-- Skip the "inner" test run when we're running DailyTests -->
<Exec Command="npm run test:inner -- --no-color --configuration $(Configuration)" <Yarn Command="run test:inner -- --no-color --configuration $(Configuration)"
Condition="'$(DailyTests)' != 'true'" Condition="'$(DailyTests)' != 'true'"
WorkingDirectory="$(RepositoryRoot)src/SignalR/clients/ts/FunctionalTests" WorkingDirectory="$(RepositoryRoot)src/SignalR/clients/ts/FunctionalTests" />
IgnoreStandardErrorWarningFormat="true" />
<PropertyGroup> <PropertyGroup>
<BrowserTestHostName Condition="'$(CI)' == 'true'">sauce.local</BrowserTestHostName> <BrowserTestHostName Condition="'$(CI)' == 'true'">sauce.local</BrowserTestHostName>

View File

@ -5,8 +5,8 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@aspnet/signalr": "file:../signalr", "@aspnet/signalr": "link:../signalr",
"@aspnet/signalr-protocol-msgpack": "file:../signalr-protocol-msgpack", "@aspnet/signalr-protocol-msgpack": "link:../signalr-protocol-msgpack",
"msgpack5": "^4.0.2" "msgpack5": "^4.0.2"
}, },
"devDependencies": { "devDependencies": {

View File

@ -5,6 +5,10 @@ MsgPack support for SignalR for ASP.NET Core
```bash ```bash
npm install @aspnet/signalr-protocol-msgpack npm install @aspnet/signalr-protocol-msgpack
``` ```
or
```bash
yarn add @aspnet/signalr-protocol-msgpack
```
## Usage ## Usage

View File

@ -5,6 +5,10 @@ JavaScript and TypeScript clients for SignalR for ASP.NET Core
```bash ```bash
npm install @aspnet/signalr npm install @aspnet/signalr
``` ```
or
```bash
yarn add @aspnet/signalr
```
## Usage ## Usage

View File

@ -39,14 +39,14 @@
"src/**/*" "src/**/*"
], ],
"devDependencies": { "devDependencies": {
"es6-promise": "^4.2.2",
"@types/node": "^10.9.4",
"@types/eventsource": "^1.0.2", "@types/eventsource": "^1.0.2",
"@types/request": "^2.47.1" "@types/node": "^10.9.4",
"@types/request": "^2.47.1",
"es6-promise": "^4.2.2"
}, },
"dependencies": { "dependencies": {
"ws": "^6.0.0",
"eventsource": "^1.0.7", "eventsource": "^1.0.7",
"request": "^2.88.0" "request": "^2.88.0",
"ws": "^6.0.0"
} }
} }

View File

@ -13,7 +13,7 @@ Our JavaScript client functional tests are written using [Jasmine](https://jasmi
### Iterating ### Iterating
The `npm test` command will take a while, because it will build the `clients\ts\signalr`, `clients\ts\signalr-protocol-msgpack` and `clients\ts\FunctionalTests` folders as well as `dotnet build` the `clients\ts\FunctionalTests` folder (to build the server-side components). If you are making changes, it's nice to be able to build only the things you need to build. To skip all the optional build steps, you can run `npm run test:inner` in `clients\ts\FunctionalTests`. This will skip building `clients\ts\signalr` and `clients\signalr-protocol-msgpack` (it will still build the `clients\ts\FunctionalTests` folder). If you make changes to those libraries, you have to manually build those directories. The `npm test` command will take a while, because it will build the `clients\ts\signalr`, `clients\ts\signalr-protocol-msgpack` and `clients\ts\FunctionalTests` folders as well as `dotnet build` the `clients\ts\FunctionalTests` folder (to build the server-side components). If you are making changes, it's nice to be able to build only the things you need to build. To skip all the optional build steps, you can run `yarn run test:inner` in `clients\ts\FunctionalTests`. This will skip building `clients\ts\signalr` and `clients\signalr-protocol-msgpack` (it will still build the `clients\ts\FunctionalTests` folder). If you make changes to those libraries, you have to manually build those directories.
## Running tests from the browser ## Running tests from the browser