Code Monkey home page Code Monkey logo

yarn.msbuild's Introduction

Yarn.MSBuild

Status

This project is now archived. It supported Yarn v1, but will not be updated to support Yarn v2 and beyond. See https://yarnpkg.com for recommended instructions on installing and using Yarn.

About this project

An MSBuild task for running the Yarn package manager.

See Yarn's Official Website for more information about using Yarn.

Installation

Package Manager Console in Visual Studio

PM> Install-Package Yarn.MSBuild

.NET Core Command Line

dotnet add package Yarn.MSBuild

In csproj

<ItemGroup>
  <PackageReference Include="Yarn.MSBuild" Version="*" />
</ItemGroup>

With Visual Studio 2017 and .NET Core SDK 2.1 or newer, you can use this package as an "SDK" element.

See Microsoft's documentation for details on project SDKs.

<Project>
  <Sdk Name="Microsoft.NET.Sdk.Web" />
  <!-- An exact version is required -->
  <Sdk Name="Yarn.MSBuild" Version="1.22.0" />

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>
</Project>

Usage

This package installs yarn so you can use it from MSBuild without needing to install yarn globally.

YarnBuildCommand

If you set the YarnBuildCommand property, the command will run automatically in the "YarnBuild" target when you compile the application.

Example:

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <YarnBuildCommand>run webpack</YarnBuildCommand>
    <YarnBuildCommand Condition="'$(Configuration)' == 'Release'">run webpack --env.prod</YarnBuildCommand>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Yarn.MSBuild" Version="**" />
  </ItemGroup>

</Project>
{
  "scripts": {
    "webpack": "webpack"
  },
  "dependencies": {
    "react": "^16.0.0"
  },
  "devDependencies": {
    "webpack": "^4.0.0"
  }
}

You can also chain of this target to run additional commands.

  <Target Name="YarnInstall" BeforeTargets="YarnBuild">
    <Yarn Command="install" Condition=" ! Exists('node_modules/')" />
  </Target>

Changing the directory where YarnBuild runs

You can set the YarnWorkingDir property to change the folder in which YarnBuildCommand executes.

For example, if you wanted to run yarn run webpack in wwwroot/ instead:

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <YarnWorkingDir>$(MSBuildProjectDirectory)/wwwroot/</YarnWorkingDir>
    <YarnBuildCommand>run webpack</YarnBuildCommand>
    <YarnBuildCommand Condition="'$(Configuration)' == 'Release'">run webpack --env.prod</YarnBuildCommand>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Yarn.MSBuild" Version="*" />
  </ItemGroup>

</Project>

Running yarn from a custom target

This package makes the Yarn task available for execution from your targets.

<Project>
  <Target Name="RunMyYarnCommands">
    <!-- defaults to "install" in the current directory using the bundled version of yarn. -->
    <Yarn />

    <!-- Specify the command -->
    <Yarn Command="run myscript" />

    <!-- Allow failures -->
    <Yarn Command="upgrade" IgnoreExitCode="true" />

    <!-- Change the directory where yarn is executed -->
    <Yarn Command="run test" WorkingDirectory="wwwroot/" />

    <!-- Set where NodeJS is installed -->
    <Yarn Command="run cmd" NodeJSExecutablePath="/opt/node8/bin/nodejs" />
  </Target>
</Project>

Additional options

Yarn inherits all properties available on ToolTask which allows further fine-tuning, such as controlling the logging-level of stderr and stdout and the process environment.

The Yarn task supports the following parameters

[Optional]
string Command                            The arguments to pass to yarn.

[Optional]
string ExecutablePath                     Where to find yarn (*nix) or yarn.cmd (Windows)

[Optional]
string NodeJsExecutablePath               Where to find node(js) (*nix) or node.cmd (Windows).
                                          If not provided, node is expected to be in the PATH environment variable.

[Optional]
string WorkingDirectory                   The directory in which to execute the yarn command

[Optional]
bool IgnoreExitCode                       Don't create and error if the exit code is non-zero

[Optional]
bool IgnoreStandardErrorWarningFormat     Don't create MSBuild errors or warnings when Yarn output logs lines starting with 'warning' and 'error'

Task outputs:

[Output]
int ExitCode                              Returns the exit code of the yarn process

About

This is not an official Yarn project. See LICENSE.txt and the Third Party Notice for more details.

yarn.msbuild's People

Contributors

cgravill avatar dependabot-preview[bot] avatar dependabot[bot] avatar gentoo90 avatar jelical avatar mwahaworld avatar natemcmaster avatar neckro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

yarn.msbuild's Issues

Some feedback on default behavior: yarn clean, install on restore, and bundling

We're having a discussion within fable on whether or not to embed yarn and I came across this package. Here is an excerpt of a comment I made on that issue wrt how the msbuild targets work after trying it out.

  • The nuget package for that bundles a version of yarn with it, so it works without yarn installed.
    • I wondered if it made more sense for the msbuild task to try and use path first and if not, then fallback to dist.
  • The package currently calls yarn install on dotnet build. I think this would make more sense being on dotnet restore like paket does.
  • The package currently calls yarn clean when dotnet clean is called. This doesn't seem right considering that dotnet clean is intended to clean build artifacts and yarn clean seems to be dealing with cleaning out unneeded files in your node_modules folder, not build artifacts. It also creates a .yarnclean file when you run it, which may confuse users. https://yarnpkg.com/lang/en/docs/cli/clean/

If interested, you can see the full conversation at fable-compiler/Fable#925

Cannot chain YarnBuildCommand

I have this configuration:

  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <AddRazorSupportForMvc>true</AddRazorSupportForMvc>
    <YarnWorkingDir>$(MSBuildProjectDirectory)/ClientApp/</YarnWorkingDir>
    <YarnBuildCommand Condition="'$(Configuration)' == 'Debug'">run build:debug</YarnBuildCommand>
    <YarnBuildCommand Condition="'$(Configuration)' == 'Release'">run build:release</YarnBuildCommand>
    <YarnBuildCommand>install</YarnBuildCommand>
    <TypeScriptToolsVersion>3.4</TypeScriptToolsVersion>
    <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
  </PropertyGroup>

On build it executes only one YarnBuildCommand. In current way as it is setup only yarn install is being executed:

1>yarn install v1.15.2
1>[1/4] Resolving packages...
1>success Already up-to-date.
1>Done in 0.62s.

When I remove <YarnBuildCommand>install</YarnBuildCommand> it proceeds executing run build:debug.

How to chain YarnBuildCommand correctly?

With Publish yarn runs twice

Using publish wizard, webpack compilation runs twice.
Using VS2019 and latest Yarn.MSBuild

csproj

  <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
    <YarnBuildCommand Condition="'$(Configuration)' == 'Release'">run prod</YarnBuildCommand>
  </PropertyGroup>

  <Target Name="YarnInstall" BeforeTargets="YarnBuild">
    <Message Text="Instalando y compilando dependencias cliente" Importance="high" />
    <Yarn Command="install" />
  </Target>

Publish profile

<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121. 
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <PublishProvider>FileSystem</PublishProvider>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <ProjectGuid></ProjectGuid>
    <publishUrl>D:\Development\Projects\Via010\publish</publishUrl>
    <DeleteExistingFiles>True</DeleteExistingFiles>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <SelfContained>false</SelfContained>
    <_IsPortable>true</_IsPortable>
    <EnvironmentName>Staging</EnvironmentName>
  </PropertyGroup>
</Project>
1>------ Build started: Project: Via010.Web, Configuration: Release Any CPU ------
1>Instalando y compilando dependencias cliente
1>yarn install v1.16.0
1>[1/4] Resolving packages...
1>success Already up-to-date.
1>Done in 0.72s.
1>yarn run v1.16.0
1>$ webpack --mode production
1>Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
1>Hash: 508a77d8d7bf826837af
1>Version: webpack 4.30.0
1>Time: 30257ms
1>Built at: 2019-08-07 14:19:23
1>                                                   Asset       Size  Chunks                    Chunk Names
1>                                              COMMITHASH   40 bytes          [emitted]
1>                                                 VERSION    5 bytes          [emitted]
1>                       firmaA5\miniapplet-full_1_6_5.jar   4.66 MiB          [emitted]  [big]
1>                                   firmaA5\miniapplet.js    148 KiB          [emitted]
1>                              via010.aytojerez.es-app.js   4.11 KiB       3  [emitted]         app
1>                          via010.aytojerez.es-app.js.map   3.31 KiB       3  [emitted]         app
1>                via010.aytojerez.es-errors-page-error.js   2.19 KiB       5  [emitted]         errors-page-error
1>            via010.aytojerez.es-errors-page-error.js.map   2.69 KiB       5  [emitted]         errors-page-error
1>                           via010.aytojerez.es-errors.js   1.88 KiB       4  [emitted]         errors
1>                       via010.aytojerez.es-errors.js.map  225 bytes       4  [emitted]         errors
1>    via010.aytojerez.es-general-registrogeneral-index.js     12 KiB       6  [emitted]         general-registrogeneral-index
1>via010.aytojerez.es-general-registrogeneral-index.js.map   14.7 KiB       6  [emitted]         general-registrogeneral-index
1>                          via010.aytojerez.es-runtime.js   1.57 KiB       0  [emitted]         runtime
1>                      via010.aytojerez.es-runtime.js.map   2.69 KiB       0  [emitted]         runtime
1>                          via010.aytojerez.es-styles.css    190 KiB       2  [emitted]         styles
1>                      via010.aytojerez.es-styles.css.map   68.4 KiB       2  [emitted]         styles
1>                           via010.aytojerez.es-styles.js   21.1 KiB       2  [emitted]         styles
1>                       via010.aytojerez.es-styles.js.map   26.6 KiB       2  [emitted]         styles
1>               via010.aytojerez.es-tramite-finalizado.js   3.15 KiB       7  [emitted]         tramite-finalizado
1>           via010.aytojerez.es-tramite-finalizado.js.map   4.43 KiB       7  [emitted]         tramite-finalizado
1>                           via010.aytojerez.es-vendor.js    611 KiB       1  [emitted]  [big]  vendor
1>                       via010.aytojerez.es-vendor.js.map    870 KiB       1  [emitted]         vendor
1>Entrypoint app [big] = via010.aytojerez.es-runtime.js via010.aytojerez.es-runtime.js.map via010.aytojerez.es-styles.css via010.aytojerez.es-styles.js via010.aytojerez.es-styles.css.map via010.aytojerez.es-styles.js.map via010.aytojerez.es-vendor.js via010.aytojerez.es-vendor.js.map via010.aytojerez.es-app.js via010.aytojerez.es-app.js.map
1>Entrypoint errors [big] = via010.aytojerez.es-runtime.js via010.aytojerez.es-runtime.js.map via010.aytojerez.es-vendor.js via010.aytojerez.es-vendor.js.map via010.aytojerez.es-errors.js via010.aytojerez.es-errors.js.map
1>Entrypoint errors-page-error [big] = via010.aytojerez.es-runtime.js via010.aytojerez.es-runtime.js.map via010.aytojerez.es-vendor.js via010.aytojerez.es-vendor.js.map via010.aytojerez.es-errors-page-error.js via010.aytojerez.es-errors-page-error.js.map
1>Entrypoint general-registrogeneral-index [big] = via010.aytojerez.es-runtime.js via010.aytojerez.es-runtime.js.map via010.aytojerez.es-styles.css via010.aytojerez.es-styles.js via010.aytojerez.es-styles.css.map via010.aytojerez.es-styles.js.map via010.aytojerez.es-vendor.js via010.aytojerez.es-vendor.js.map via010.aytojerez.es-general-registrogeneral-index.js via010.aytojerez.es-general-registrogeneral-index.js.map
1>Entrypoint tramite-finalizado [big] = via010.aytojerez.es-runtime.js via010.aytojerez.es-runtime.js.map via010.aytojerez.es-styles.css via010.aytojerez.es-styles.js via010.aytojerez.es-styles.css.map via010.aytojerez.es-styles.js.map via010.aytojerez.es-vendor.js via010.aytojerez.es-vendor.js.map via010.aytojerez.es-tramite-finalizado.js via010.aytojerez.es-tramite-finalizado.js.map
1>  [5] ./Client/modules/eventBus.js 2.16 KiB {3} {5} {6} {7} [built]
1> [14] ./Client/modules/http.js 722 bytes {3} {6} {7} [built]
1> [27] ./Client/modules/constants.js 193 bytes {6} {7} [built]
1> [35] ./Client/modules/vue-init.js + 2 modules 1.06 KiB {3} {5} {6} {7} [built]
1>      | ./Client/modules/vue-init.js 246 bytes [built]
1>      | ./Client/modules/vue-material.js 553 bytes [built]
1>      | ./Client/modules/vue-directives/directives.js 268 bytes [built]
1> [62] ./Client/components/MdCardForm.vue + 4 modules 2.68 KiB {2} [built]
1>      |    5 modules
1>[427] ./Client/components/Documents.vue + 14 modules 10.9 KiB {2} [built]
1>      |    15 modules
1>[429] ./Client/components/TramiteDetail.vue + 4 modules 9.8 KiB {2} [built]
1>      |    5 modules
1>[431] multi ./Client/entrypoints/main.js ./Client/styles/index.scss 40 bytes {3} [built]
1>[459] ./Client/styles/index.scss 39 bytes {2} [built]
1>[460] multi ./Client/entrypoints/errors.js 28 bytes {4} [built]
1>[461] ./Client/entrypoints/errors.js 4.17 KiB {4} [built]
1>[472] ./Client/entrypoints/Pages/Errors/page-error.js 209 bytes {5} [built]
1>[558] ./Client/entrypoints/Pages/tramite-finalizado.js 1.03 KiB {7} [built]
1>[560] ./Client/entrypoints/Pages/General/RegistroGeneral/index.js + 2 modules 18.1 KiB {6} [built]
1>      | ./Client/entrypoints/Pages/General/RegistroGeneral/index.js 1.59 KiB [built]
1>      | ./Client/modules/vue-mixins/myform.js 12.7 KiB [built]
1>      | ./Client/modules/vue-mixins/user-info.js 3.75 KiB [built]
1>[561] ./Client/entrypoints/main.js + 1 modules 432 bytes {3} [built]
1>      | ./Client/entrypoints/main.js 132 bytes [built]
1>      | ./Client/entrypoints/partials/header.js 275 bytes [built]
1>    + 554 hidden modules
1>
1>C:\Users\jrebollo\.nuget\packages\yarn.msbuild\1.16.0\build\Yarn.MSBuild.targets(10,5): warning : in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
1>This can impact web performance.
1>Assets:
1>  via010.aytojerez.es-vendor.js (611 KiB)
1>  firmaA5\miniapplet-full_1_6_5.jar (4.66 MiB)
1>
1>C:\Users\jrebollo\.nuget\packages\yarn.msbuild\1.16.0\build\Yarn.MSBuild.targets(10,5): warning : in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
1>Entrypoints:
1>  app (828 KiB)
1>      via010.aytojerez.es-runtime.js
1>      via010.aytojerez.es-styles.css
1>      via010.aytojerez.es-styles.js
1>      via010.aytojerez.es-vendor.js
1>      via010.aytojerez.es-app.js
1>  errors (614 KiB)
1>      via010.aytojerez.es-runtime.js
1>      via010.aytojerez.es-vendor.js
1>      via010.aytojerez.es-errors.js
1>  errors-page-error (615 KiB)
1>      via010.aytojerez.es-runtime.js
1>      via010.aytojerez.es-vendor.js
1>      via010.aytojerez.es-errors-page-error.js
1>  general-registrogeneral-index (835 KiB)
1>      via010.aytojerez.es-runtime.js
1>      via010.aytojerez.es-styles.css
1>      via010.aytojerez.es-styles.js
1>      via010.aytojerez.es-vendor.js
1>      via010.aytojerez.es-general-registrogeneral-index.js
1>  tramite-finalizado (827 KiB)
1>      via010.aytojerez.es-runtime.js
1>      via010.aytojerez.es-styles.css
1>      via010.aytojerez.es-styles.js
1>      via010.aytojerez.es-vendor.js
1>      via010.aytojerez.es-tramite-finalizado.js
1>
1>
1>C:\Users\jrebollo\.nuget\packages\yarn.msbuild\1.16.0\build\Yarn.MSBuild.targets(10,5): warning : in webpack performance recommendations:
1>You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
1>For more info visit https://webpack.js.org/guides/code-splitting/
1>Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--2-1!node_modules/postcss-loader/src/index.js??ref--2-2!node_modules/sass-loader/lib/loader.js??ref--2-3!Client/styles/index.scss:
1>    Entrypoint mini-css-extract-plugin = *
1>    [1] ./node_modules/css-loader/dist/cjs.js??ref--2-1!./node_modules/postcss-loader/src??ref--2-2!./node_modules/sass-loader/lib/loader.js??ref--2-3!./Client/styles/index.scss 299 KiB {0} [built]
1>        + 2 hidden modules
1>Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--2-1!node_modules/vue-loader/lib/loaders/stylePostLoader.js!node_modules/postcss-loader/src/index.js??ref--2-2!node_modules/sass-loader/lib/loader.js??ref--2-3!node_modules/vue-loader/lib/index.js??vue-loader-options!Client/components/Contact.vue?vue&type=style&index=0&id=0da5b0e6&lang=scss&scoped=true&:
1>    Entrypoint mini-css-extract-plugin = *
1>       2 modules
1>Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--2-1!node_modules/vue-loader/lib/loaders/stylePostLoader.js!node_modules/postcss-loader/src/index.js??ref--2-2!node_modules/sass-loader/lib/loader.js??ref--2-3!node_modules/vue-loader/lib/index.js??vue-loader-options!Client/components/FileUpload.vue?vue&type=style&index=0&id=520271c0&lang=scss&scoped=true&:
1>    Entrypoint mini-css-extract-plugin = *
1>       2 modules
1>Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--2-1!node_modules/vue-loader/lib/loaders/stylePostLoader.js!node_modules/postcss-loader/src/index.js??ref--2-2!node_modules/sass-loader/lib/loader.js??ref--2-3!node_modules/vue-loader/lib/index.js??vue-loader-options!Client/components/FileUploadItem.vue?vue&type=style&index=0&id=3420bb73&lang=scss&scoped=true&:
1>    Entrypoint mini-css-extract-plugin = *
1>       2 modules
1>Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--2-1!node_modules/vue-loader/lib/loaders/stylePostLoader.js!node_modules/postcss-loader/src/index.js??ref--2-2!node_modules/sass-loader/lib/loader.js??ref--2-3!node_modules/vue-loader/lib/index.js??vue-loader-options!Client/components/MdCardForm.vue?vue&type=style&index=0&id=9aa29264&lang=scss&scoped=true&:
1>    Entrypoint mini-css-extract-plugin = *
1>       2 modules
1>Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--2-1!node_modules/vue-loader/lib/loaders/stylePostLoader.js!node_modules/postcss-loader/src/index.js??ref--2-2!node_modules/sass-loader/lib/loader.js??ref--2-3!node_modules/vue-loader/lib/index.js??vue-loader-options!Client/components/TramiteDetail.vue?vue&type=style&index=0&id=05ef3664&lang=scss&scoped=true&:
1>    Entrypoint mini-css-extract-plugin = *
1>       2 modules
1>Done in 32.36s.
1>Via010.Web -> D:\Development\Projects\Via010\src\Via010.Web\bin\Release\netcoreapp2.2\Via010.Web.dll
1>Via010.Web -> D:\Development\Projects\Via010\src\Via010.Web\bin\Release\netcoreapp2.2\Via010.Web.Views.dll
1>Done building project "Via010.Web.csproj".
2>------ Publish started: Project: Via010.Web, Configuration: Release Any CPU ------
Connecting to D:\Development\Projects\Via010\publish...
Instalando y compilando dependencias cliente
C:\Users\jrebollo\.nuget\packages\yarn.msbuild\1.16.0\dist\bin\yarn.cmd install 
yarn install v1.16.0
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.80s.
C:\Users\jrebollo\.nuget\packages\yarn.msbuild\1.16.0\dist\bin\yarn.cmd run prod 
yarn run v1.16.0
$ webpack --mode production
Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
Hash: 508a77d8d7bf826837af
Version: webpack 4.30.0
Time: 30007ms
Built at: 2019-08-07 14:20:00
                                                   Asset       Size  Chunks                    Chunk Names
                                              COMMITHASH   40 bytes          [emitted]         
                                                 VERSION    5 bytes          [emitted]         
                       firmaA5\miniapplet-full_1_6_5.jar   4.66 MiB          [emitted]  [big]  
                                   firmaA5\miniapplet.js    148 KiB          [emitted]         
                              via010.aytojerez.es-app.js   4.11 KiB       3  [emitted]         app
                          via010.aytojerez.es-app.js.map   3.31 KiB       3  [emitted]         app
                via010.aytojerez.es-errors-page-error.js   2.19 KiB       5  [emitted]         errors-page-error
            via010.aytojerez.es-errors-page-error.js.map   2.69 KiB       5  [emitted]         errors-page-error
                           via010.aytojerez.es-errors.js   1.88 KiB       4  [emitted]         errors
                       via010.aytojerez.es-errors.js.map  225 bytes       4  [emitted]         errors
    via010.aytojerez.es-general-registrogeneral-index.js     12 KiB       6  [emitted]         general-registrogeneral-index
via010.aytojerez.es-general-registrogeneral-index.js.map   14.7 KiB       6  [emitted]         general-registrogeneral-index
                          via010.aytojerez.es-runtime.js   1.57 KiB       0  [emitted]         runtime
                      via010.aytojerez.es-runtime.js.map   2.69 KiB       0  [emitted]         runtime
                          via010.aytojerez.es-styles.css    190 KiB       2  [emitted]         styles
                      via010.aytojerez.es-styles.css.map   68.4 KiB       2  [emitted]         styles
                           via010.aytojerez.es-styles.js   21.1 KiB       2  [emitted]         styles
                       via010.aytojerez.es-styles.js.map   26.6 KiB       2  [emitted]         styles
               via010.aytojerez.es-tramite-finalizado.js   3.15 KiB       7  [emitted]         tramite-finalizado
           via010.aytojerez.es-tramite-finalizado.js.map   4.43 KiB       7  [emitted]         tramite-finalizado
                           via010.aytojerez.es-vendor.js    611 KiB       1  [emitted]  [big]  vendor
                       via010.aytojerez.es-vendor.js.map    870 KiB       1  [emitted]         vendor
Entrypoint app [big] = via010.aytojerez.es-runtime.js via010.aytojerez.es-runtime.js.map via010.aytojerez.es-styles.css via010.aytojerez.es-styles.js via010.aytojerez.es-styles.css.map via010.aytojerez.es-styles.js.map via010.aytojerez.es-vendor.js via010.aytojerez.es-vendor.js.map via010.aytojerez.es-app.js via010.aytojerez.es-app.js.map
Entrypoint errors [big] = via010.aytojerez.es-runtime.js via010.aytojerez.es-runtime.js.map via010.aytojerez.es-vendor.js via010.aytojerez.es-vendor.js.map via010.aytojerez.es-errors.js via010.aytojerez.es-errors.js.map
Entrypoint errors-page-error [big] = via010.aytojerez.es-runtime.js via010.aytojerez.es-runtime.js.map via010.aytojerez.es-vendor.js via010.aytojerez.es-vendor.js.map via010.aytojerez.es-errors-page-error.js via010.aytojerez.es-errors-page-error.js.map
Entrypoint general-registrogeneral-index [big] = via010.aytojerez.es-runtime.js via010.aytojerez.es-runtime.js.map via010.aytojerez.es-styles.css via010.aytojerez.es-styles.js via010.aytojerez.es-styles.css.map via010.aytojerez.es-styles.js.map via010.aytojerez.es-vendor.js via010.aytojerez.es-vendor.js.map via010.aytojerez.es-general-registrogeneral-index.js via010.aytojerez.es-general-registrogeneral-index.js.map
Entrypoint tramite-finalizado [big] = via010.aytojerez.es-runtime.js via010.aytojerez.es-runtime.js.map via010.aytojerez.es-styles.css via010.aytojerez.es-styles.js via010.aytojerez.es-styles.css.map via010.aytojerez.es-styles.js.map via010.aytojerez.es-vendor.js via010.aytojerez.es-vendor.js.map via010.aytojerez.es-tramite-finalizado.js via010.aytojerez.es-tramite-finalizado.js.map
  [5] ./Client/modules/eventBus.js 2.16 KiB {3} {5} {6} {7} [built]
 [14] ./Client/modules/http.js 722 bytes {3} {6} {7} [built]
 [27] ./Client/modules/constants.js 193 bytes {6} {7} [built]
 [35] ./Client/modules/vue-init.js + 2 modules 1.06 KiB {3} {5} {6} {7} [built]
      | ./Client/modules/vue-init.js 246 bytes [built]
      | ./Client/modules/vue-material.js 553 bytes [built]
      | ./Client/modules/vue-directives/directives.js 268 bytes [built]
 [62] ./Client/components/MdCardForm.vue + 4 modules 2.68 KiB {2} [built]
      |    5 modules
[427] ./Client/components/Documents.vue + 14 modules 10.9 KiB {2} [built]
      |    15 modules
[429] ./Client/components/TramiteDetail.vue + 4 modules 9.8 KiB {2} [built]
      |    5 modules
[431] multi ./Client/entrypoints/main.js ./Client/styles/index.scss 40 bytes {3} [built]
[459] ./Client/styles/index.scss 39 bytes {2} [built]
[460] multi ./Client/entrypoints/errors.js 28 bytes {4} [built]
[461] ./Client/entrypoints/errors.js 4.17 KiB {4} [built]
[472] ./Client/entrypoints/Pages/Errors/page-error.js 209 bytes {5} [built]
[558] ./Client/entrypoints/Pages/tramite-finalizado.js 1.03 KiB {7} [built]
[560] ./Client/entrypoints/Pages/General/RegistroGeneral/index.js + 2 modules 18.1 KiB {6} [built]
      | ./Client/entrypoints/Pages/General/RegistroGeneral/index.js 1.59 KiB [built]
      | ./Client/modules/vue-mixins/myform.js 12.7 KiB [built]
      | ./Client/modules/vue-mixins/user-info.js 3.75 KiB [built]
[561] ./Client/entrypoints/main.js + 1 modules 432 bytes {3} [built]
      | ./Client/entrypoints/main.js 132 bytes [built]
      | ./Client/entrypoints/partials/header.js 275 bytes [built]
    + 554 hidden modules

C:\Users\jrebollo\.nuget\packages\yarn.msbuild\1.16.0\build\Yarn.MSBuild.targets(10,5): Warning : in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets: 
  via010.aytojerez.es-vendor.js (611 KiB)
  firmaA5\miniapplet-full_1_6_5.jar (4.66 MiB)

C:\Users\jrebollo\.nuget\packages\yarn.msbuild\1.16.0\build\Yarn.MSBuild.targets(10,5): Warning : in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  app (828 KiB)
      via010.aytojerez.es-runtime.js
      via010.aytojerez.es-styles.css
      via010.aytojerez.es-styles.js
      via010.aytojerez.es-vendor.js
      via010.aytojerez.es-app.js
  errors (614 KiB)
      via010.aytojerez.es-runtime.js
      via010.aytojerez.es-vendor.js
      via010.aytojerez.es-errors.js
  errors-page-error (615 KiB)
      via010.aytojerez.es-runtime.js
      via010.aytojerez.es-vendor.js
      via010.aytojerez.es-errors-page-error.js
  general-registrogeneral-index (835 KiB)
      via010.aytojerez.es-runtime.js
      via010.aytojerez.es-styles.css
      via010.aytojerez.es-styles.js
      via010.aytojerez.es-vendor.js
      via010.aytojerez.es-general-registrogeneral-index.js
  tramite-finalizado (827 KiB)
      via010.aytojerez.es-runtime.js
      via010.aytojerez.es-styles.css
      via010.aytojerez.es-styles.js
      via010.aytojerez.es-vendor.js
      via010.aytojerez.es-tramite-finalizado.js


C:\Users\jrebollo\.nuget\packages\yarn.msbuild\1.16.0\build\Yarn.MSBuild.targets(10,5): Warning : in webpack performance recommendations: 
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--2-1!node_modules/postcss-loader/src/index.js??ref--2-2!node_modules/sass-loader/lib/loader.js??ref--2-3!Client/styles/index.scss:
    Entrypoint mini-css-extract-plugin = *
    [1] ./node_modules/css-loader/dist/cjs.js??ref--2-1!./node_modules/postcss-loader/src??ref--2-2!./node_modules/sass-loader/lib/loader.js??ref--2-3!./Client/styles/index.scss 299 KiB {0} [built]
        + 2 hidden modules
Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--2-1!node_modules/vue-loader/lib/loaders/stylePostLoader.js!node_modules/postcss-loader/src/index.js??ref--2-2!node_modules/sass-loader/lib/loader.js??ref--2-3!node_modules/vue-loader/lib/index.js??vue-loader-options!Client/components/Contact.vue?vue&type=style&index=0&id=0da5b0e6&lang=scss&scoped=true&:
    Entrypoint mini-css-extract-plugin = *
       2 modules
Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--2-1!node_modules/vue-loader/lib/loaders/stylePostLoader.js!node_modules/postcss-loader/src/index.js??ref--2-2!node_modules/sass-loader/lib/loader.js??ref--2-3!node_modules/vue-loader/lib/index.js??vue-loader-options!Client/components/FileUpload.vue?vue&type=style&index=0&id=520271c0&lang=scss&scoped=true&:
    Entrypoint mini-css-extract-plugin = *
       2 modules
Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--2-1!node_modules/vue-loader/lib/loaders/stylePostLoader.js!node_modules/postcss-loader/src/index.js??ref--2-2!node_modules/sass-loader/lib/loader.js??ref--2-3!node_modules/vue-loader/lib/index.js??vue-loader-options!Client/components/FileUploadItem.vue?vue&type=style&index=0&id=3420bb73&lang=scss&scoped=true&:
    Entrypoint mini-css-extract-plugin = *
       2 modules
Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--2-1!node_modules/vue-loader/lib/loaders/stylePostLoader.js!node_modules/postcss-loader/src/index.js??ref--2-2!node_modules/sass-loader/lib/loader.js??ref--2-3!node_modules/vue-loader/lib/index.js??vue-loader-options!Client/components/MdCardForm.vue?vue&type=style&index=0&id=9aa29264&lang=scss&scoped=true&:
    Entrypoint mini-css-extract-plugin = *
       2 modules
Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--2-1!node_modules/vue-loader/lib/loaders/stylePostLoader.js!node_modules/postcss-loader/src/index.js??ref--2-2!node_modules/sass-loader/lib/loader.js??ref--2-3!node_modules/vue-loader/lib/index.js??vue-loader-options!Client/components/TramiteDetail.vue?vue&type=style&index=0&id=05ef3664&lang=scss&scoped=true&:
    Entrypoint mini-css-extract-plugin = *
       2 modules
Done in 32.08s.
Via010.Web -> D:\Development\Projects\Via010\src\Via010.Web\bin\Release\netcoreapp2.2\Via010.Web.dll
Via010.Web -> D:\Development\Projects\Via010\src\Via010.Web\bin\Release\netcoreapp2.2\Via010.Web.Views.dll
Via010.Web -> D:\Development\Projects\Via010\src\Via010.Web\obj\Release\netcoreapp2.2\PubTmp\Out\
Web App was published successfully file:///D:/Development/Projects/Via010/publish

========== Build: 1 succeeded, 0 failed, 4 up-to-date, 0 skipped ==========
========== Publish: 1 succeeded, 0 failed, 0 skipped ==========

Package provided yarn not available to webpack commands

Not sure if this would fit well in this package or not. I am finding that my webpack sub-tasks that need to call yarn can't make use of the package-provided version of yarn because it isn't on the path even when I invoke the top level task using Yarn.MsBuild.

I am using Yarn.MSBuild to first call yarn install and then to call yarn run build which invokes a webpack task in package.json (I think it's webpack, I'm using the new asp.net SPA template).

It works fine if I have yarn installed, but I'd rather not have that as a dependency. Maybe the better thing is to add yarn as a npm devDependency which I've just tested and works fine.

Feel free to close this if you don't think it's appropriate for Yarn.MsBuild to make this work.

I vaguely wondered if: yarnpkg/yarn@3a04db7 would make it work automatically but I don't know what CWD is used for in yarn.

Question about "webpack serve"

The command "run webpack" is working great for me, but when I try "run webpack serve" (or "run webpack --watch") it doesn't continue with the rest of the build.

I am guessing that is because "run webpack serve" starts a process that doesn't finish (it just starts up the webpack server and doesn't exit the command line), and that blocks the rest of the build.

So I think one possible approach would be to run the yarn command as a non-blocking background process, but I don't know if such a thing is possible or supported.

I'm interested if anyone has run into this issue, or if anyone knows a good approach to using webpack dev-server with Yarn.MSBuild. It seems like a very common use-case.

Global Node.js dependency

Thanks for making this tool, I've found it useful locally.

I'd like to use it on build agents where we don't have a globally installed Node.js. This is to ensure reproducible builds and make it easier to configure agents. There's a NuGet for Node.js which is current https://www.nuget.org/packages/Node.js.redist/

I experimented in a few ways but couldn't see a clean way to provide this instance of node.exe i.e. copying it in, calling yarn.js directory, or sticking it the ExecutablePath as a prefix. Do you have a suggested approach for this?

Warning when using `dotnet restore` use `.shproj` ?

Hello,

When using this I got a warning at build

.... warning NU1503: Skipping restore for project .... . The project file may be invalid or missing targets required for restore. [C:\dev\git\mediaclip-hub\Mediaclip.Hub.sln]

After some search I found that instead of using a .csproj, we can use .shproj and then this warning disable since the project will not be in the list of project to restore: https://github.com/NuGet/NuGet.Client/blob/b0fef98e6328948e7669297d6869fa792b39e805/src/NuGet.Core/NuGet.Build.Tasks/NuGet.targets#L269

I don't know if this change imply any unexpected change but maybe the documentation could mention it in the README ?

Duplicate files in NuGet with Paket

We use the Paket tool (https://fsprojects.github.io/Paket/) to manage our NuGets.

I tried updating Yarn.MSBuild to 1.3.2 and had an error:
IOException: Zip entry name ends in directory separator character but contains data.

I traced back and it's same issue in 1.2.1 and 1.2.0 with the last compatible version 1.1.0.

The NuGets work perfectly fine without error using the built-in Visual Studio 2017 NuGet tool.

Inspecting the NuGet there are duplicate files in the /dist/bin directory.

If I remove these two lines:

<file src="dist/bin/yarn.cmd" target="dist/bin/" />
<file src="dist/bin/yarn" target="dist/bin/" />

then I'm able to install from the file locally. The overall directory is included after

<file src="dist\" target="dist/" />

Comparison in 7Zip of the relevant folder:

image

[Announcement] no more automatic call to `yarn install`

In the 1.2.0 version of this package, I will be removing the default MSBuild target that calls yarn install when your project compiles. After discussion with others (#1) and a lot of dogfooding with this package on my own, I realized that there is no good default command.

Note: this will not affect those who have specified YarnBuildCommand in their projects.

Preserving existing behavior

To keep the existing behavior from 1.1 and earlier, add this to your project

<PropertyGroup>
  <YarnBuildCommand>install</YarnBuildCommand>
</PropertyGroup>

Justification

yarn install -
NuGet does not support on-install hooks, and does not have any plans to add it. Therefore, it is impossible to make this command run by default when dotnet restore works, or in Visual Studio. Although NuGet made improvements in 15.4 to add your own targets to MSBuild restore, it is not possible to do this reliably from within a package.

On build?
There is not default convention for how to run the "build" command on a javascript project. For some this is yarn run webpack, for others it's yarn run gulp. It's really up to your project, therefore, YarnBuildCommand is required.

Project status: maintenance mode

Project status: Yarn.MSBuild is stable and there are no features planned. This project has a very low volume of issues and pull requests opened. Therefore...

Release schedule: there is none.

That said, Yarn itself is under active development and releases updates often. I've configured Dependabot to send updates automatically, and I'll try to get those releases out in a reasonable timeframe.

If you have questions about this, feel free to leave a comment below. I will continue to monitor this project for comments.

Add new package or option for Yarn v2

Is your feature request related to a problem? Please describe.
Yarn v2 has improved reliability when installing packages (my main want)

Describe the solution you'd like
Since Yarn v2 is a breaking change, it's probably not a good idea to just change the version in this package.

Two solutions I see:

  • have a v2 of this package for Yarn v2
  • have an option to choose which Yarn version is used and default to Yarn v1 to not break anyone

Describe alternatives you've considered
N/A

Additional context
Migration guide for moving from Yarn v1 to v2
https://yarnpkg.com/getting-started/migration

How does this work?

Not really an issue, more like a question…

I found this repo through your issue NuGet/Home#5063 and closely looked at its project implementation because I'm trying to achieve the same thing: I want to make a NuGet package that installs a custom MSBuild task and always runs it when building the project this package is installed in. But it doesn't do anything.

I created the task project, targeting .NET 4.6 and .NET Standard 1.6, all with VS 2017 update 3 preview 3, and manually set it up in my demo project. The purpose of my task is to determine the software version from Git for example and provide it to the project's Version property. (Others have done similar things before, but for the old MSBuild format, and I have more features to port from an older tool, see ygoe/NetRevisionTool#18.) In my manual setup everything worked. But I needed to do the following things in my demo project:

  • Determine the custom task assembly file name depending on the MSBuild runtime type
  • Register it with <UsingTask>
  • Add a target that runs BeforeTargets="BeforeBuild"
  • Call my custom task in there to have the Version property set

My goal is to move all of this into the NuGet package and it should be active without further configuration. (It will have configuration, but for other things like the version string format.)

I guess after installing that package there should be some visible references in my demo project (.csproj file, targeting .NET Standard 2.0 for now) but I can't find any, and I also can't find the location that the package has been installed to. No "tools" directory anywhere and also no "*.targets" file. Is there some magic spell I need to add to it?

Maybe you'd like to write a comprehensive blog post about making MSBuild task NuGet packages. :-)

[macOS] Yarn executable missing executable bit

Build gives an error:

/Users/jwostenberg/Code/FSharp/StageForge-WV/packages/Yarn.MSBuild/build/Yarn.MSBuild.targets(5,5): Error MSB6003: The specified task executable "yarn" could not be run. ApplicationName='/Users/jwostenberg/Code/FSharp/StageForge-WV/packages/Yarn.MSBuild/dist/bin/yarn', CommandLine=' build', CurrentDirectory='/Users/jwostenberg/Code/FSharp/StageForge-WV/src/StageForge.MacOS', Native error= Access denied (MSB6003) (StageForge.MacOS)

performing ls -l packages/Yarn.MSBuild/dist/bin/yarn shows the permissions -rw-r-r--r--; in other words, not executable. Workaround is to run chmod +x packages/Yarn.MSBuild/dist/bin/yarn, which fixes the problem temporarily.

I believe a solution is to make sure that the nuget package is built on a unix system, so that the executable bit can survive. If I can be of any help, let me know.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.