Sha256: 8102f5ca169c0798ae6c69e1fb11cad18cfc489316dde67d1a253972e0bed9e6

Contents?: true

Size: 540 Bytes

Versions: 17

Compression:

Stored size: 540 Bytes

Contents

# frozen_string_literal: true

require 'json' unless defined?(JSON)

module Prettier
  PLUGIN = -File.expand_path('..', __dir__)
  BINARY = -File.join(PLUGIN, 'node_modules', 'prettier', 'bin-prettier.js')
  VERSION = -JSON.parse(File.read(File.join(PLUGIN, 'package.json')))['version']

  class << self
    def run(args)
      quoted = args.map { |arg| arg.start_with?('-') ? arg : "\"#{arg}\"" }
      command = "node #{BINARY} --plugin \"#{PLUGIN}\" #{quoted.join(' ')}"

      system({ 'RBPRETTIER' => '1' }, command)
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
prettier-2.0.0.pre.rc3 lib/prettier.rb
prettier-2.0.0.pre.rc2 lib/prettier.rb
prettier-2.0.0.pre.rc1 lib/prettier.rb
prettier-1.6.1 lib/prettier.rb
prettier-1.6.0 lib/prettier.rb
prettier-1.5.5 lib/prettier.rb
prettier-1.5.4 lib/prettier.rb
prettier-1.5.3 lib/prettier.rb
prettier-1.5.2 lib/prettier.rb
prettier-1.5.1 lib/prettier.rb
prettier-1.5.0 lib/prettier.rb
prettier-1.4.0 lib/prettier.rb
prettier-1.3.0 lib/prettier.rb
prettier-1.2.5 lib/prettier.rb
prettier-1.2.4 lib/prettier.rb
prettier-1.2.3 lib/prettier.rb
prettier-1.2.2 lib/prettier.rb