Sha256: aa0246913c18508bdcf4da4b81d01b6ca3020152ebb50af65144e8a21d43de47

Contents?: true

Size: 998 Bytes

Versions: 13

Compression:

Stored size: 998 Bytes

Contents

# frozen_string_literal: true

##
# Usage example:
#
#   ConvenientService::Examples::Dry::Gemfile::Services::AssertNpmPackageAvailable.result(name: "lodash")
#
module ConvenientService
  module Examples
    module Dry
      module 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::RunShell, in: {command: -> { "npm list #{name} --depth=0 > /dev/null 2>&1" }}
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
convenient_service-0.12.0 lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb
convenient_service-0.11.0 lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb
convenient_service-0.10.1 lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb
convenient_service-0.10.0 lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb
convenient_service-0.9.0 lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb
convenient_service-0.8.0 lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb
convenient_service-0.7.0 lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb
convenient_service-0.6.0 lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb
convenient_service-0.5.0 lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb
convenient_service-0.4.0 lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb
convenient_service-0.3.1 lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb
convenient_service-0.3.0 lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb
convenient_service-0.2.1 lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb