Welcome to mirror list, hosted at ThFree Co, Russian Federation.

yarn.rake « tasks « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 667d850d2de01e2a85bcc2d91f488ea4f32ae142 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# frozen_string_literal: true

namespace :yarn do
  desc 'Ensure Yarn is installed'
  task :available do
    unless system('yarn --version', out: File::NULL)
      warn(
        'Error: Yarn executable was not detected in the system.'.color(:red),
        'Download Yarn at https://yarnpkg.com/en/docs/install'.color(:green)
      )
      abort
    end
  end

  desc 'Ensure Node dependencies are installed'
  task check: ['yarn:available'] do
    unless system('yarn check --ignore-engines', out: File::NULL)
      warn(
        'Error: You have unmet dependencies. (`yarn check` command failed)'.color(:red),
        'Run `yarn install` to install missing modules.'.color(:green)
      )
      abort
    end
  end

  desc 'Install Node dependencies with Yarn'
  task install: ['yarn:available'] do
    unless system('yarn install --pure-lockfile --ignore-engines --prefer-offline')
      abort 'Error: Unable to install node modules.'.color(:red)
    end
  end

  desc 'Remove Node dependencies'
  task :clobber do
    warn 'Purging ./node_modules directory'.color(:red)
    FileUtils.rm_rf 'node_modules'
  end
end

desc 'Install Node dependencies with Yarn'
task yarn: ['yarn:install']