Sha256: 386aee3ed1ed909481e20a898b966a3e4918ff48a8b9dc3bb88c4f3107aa6d7a
Contents?: true
Size: 536 Bytes
Versions: 24
Compression:
Stored size: 536 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
24 entries across 24 versions & 1 rubygems