geeklearningio / gl-vsts-tasks-yarn

Yarn Package Manager Visual Studio Team Services Build and Release Management extensions
MIT License
52 stars 18 forks source link

How to run other Yarn comands #83

Closed jvskriubakken closed 3 years ago

jvskriubakken commented 3 years ago

Before opening an issue please read this.

Are you reporting a bug or a feature request ?

Description

I thought this plugin was going to help me with using Yarn in Azure to run different Yarn run xxx commands. It this Azure Task supposed to work in this way?

Cannot find any docs on it either, so I am beginning to wonder.

sandorfr commented 3 years ago

It has two tasks on is to install yarn the other one is to use yarn.

I handles authentification with package feeds (if you need) and you can pass an arts that you want to yarn. Just like you would normally do using yarn.

jvskriubakken commented 3 years ago

The possibility to execute any Yarn command and automatic authentication towards package feeds is what I need. So that sounds promising. But I cannot understand from the documentation how to run any Yarn command.

When I try something like this:

  task: Yarn@3
    displayName: "Test"
    inputs:
      projectDirectory: "src/${{parameters.projectName}}"
      arguments: "run test-ci"
      customRegistry: useFeed
      customFeed: "0000000-0000000-0000000-0000000"

I get the error:

"Mapping values are not allowed in this context"

Do you have any example on how to run a given script task or any other Yarn command for that sake?

That would be very helpful!

Thanks :)

jvskriubakken commented 3 years ago

I figured out my problem. It was incorrect indention in the task definitions that caused the error.

I'm adding an example on how to run a script in package.json named "test-ci" using Yarn@3 for others having the same noob problems :)


- task: Yarn@3
  displayName: 'Test'
  inputs:
    projectDirectory: "src/${{parameters.projectName}}"
    arguments: 'run test-ci'
sandorfr commented 3 years ago

YAML... 😅

You didn’t find the wiki page? https://github.com/geeklearningio/gl-vsts-tasks-yarn/wiki/Yarn

It’s linked in the overview of the extension and readme of the github. Any suggestions on making it more visible?

jvskriubakken commented 3 years ago

I've read the page many times :) But, lacking a clear example on how to run other commands (other than the implicit yarn install command) in combination with my YAML struggles made me doubt the Yarn task possibilities :)

sandorfr commented 3 years ago

So just adding another example with different arguments?

jvskriubakken commented 3 years ago

Yes, I think that will clarify.