Sha256: 8b605449f91218ada55a7155ba3f4f44d44d05780cbf2d30171dac39c2e96c4d

Contents?: true

Size: 775 Bytes

Versions: 2

Compression:

Stored size: 775 Bytes

Contents

class JetsUpgrade::Javascript
  class Remove < Base
    def run
      return unless any_remove_files_exist?
      puts "Jets v5 defaults to importmap. Do not need node-related code anymore."
      remove_files.each do |path|
        remove(path)
      end
      remove_empty_dir("bin")
    end

    def remove(path)
      if File.exist?(path)
        FileUtils.rm_rf(path)
        puts "Removed #{path}"
      end
    end

    def any_remove_files_exist?
      remove_files.any? { |path| File.exist?(path) }
    end

    def remove_files
      %w[
        node_modules
        babel.config.js
        bin/webpack
        bin/webpack-dev-server
        package.json
        postcss.config.js
        yarn.lock
      ]
    end

    def self.run
      new.run
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jets-upgrade-0.1.1 lib/jets_upgrade/javascript/remove.rb
jets-upgrade-0.1.0 lib/jets_upgrade/javascript/remove.rb