Sha256: 0ff4bd96ad1b871a5f34a8d4e866420d521d7b8cd02d1b0206ed5a8af532f1aa

Contents?: true

Size: 1004 Bytes

Versions: 5

Compression:

Stored size: 1004 Bytes

Contents

# frozen_string_literal: true

##
# Usage example:
#
#   ConvenientService::Examples::Dry::Gemfile::Services::AssertNpmPackageAvailable.result(name: "lodash")
#
module ConvenientService
  module Examples
    module Dry
      class Gemfile
        module Services
          class AssertNpmPackageAvailable
            include DryService::Config

            option :name

            contract do
              schema do
                required(:name).filled(:string)
              end
            end

            step Services::AssertNodeAvailable

            ##
            # NOTE: `> /dev/null 2>&1` is used to hide output.
            # https://unix.stackexchange.com/a/119650/394253
            #
            # NOTE: For `npm list` and its options docs, see
            # https://docs.npmjs.com/cli/v7/commands/npm-ls
            #
            step Services::RunShellCommand, in: {command: -> { "npm list #{name} --depth=0 > /dev/null 2>&1" }}
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
convenient_service-0.17.0 lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb
convenient_service-0.16.0 lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb
convenient_service-0.15.0 lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb
convenient_service-0.14.0 lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb
convenient_service-0.13.0 lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb