# Node.js with React
# Build a Node.js project that uses React.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- main

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '16.x'
  displayName: 'Install Node.js'


- script: |
    npm install
    
    npm run build
  displayName: 'npm install and build'
  workingDirectory: '$(Build.SourcesDirectory)/frontend'

- task: CmdLine@2
  inputs:
    script: |
      echo Write your commands here
      ls
      ls $(agent.builddirectory)
      ls $(System.DefaultWorkingDirectory)
      echo Hello world

- task: CopyFiles@2
  inputs:
    SourceFolder: '$(Build.SourcesDirectory)/frontend/build'
    Contents: '**'
    TargetFolder: '$(Build.ArtifactStagingDirectory)'

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'