Sha256: accff4ac505ac73f14a49586f8dda45de36e985ea9ef8986282ca31f95c8a00f
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true # Copy all installed JavaScript components to the public root. def update require 'fileutils' require 'utopia/path' root = Pathname.new(context.root) yarn_package_root = root + "node_modules" # This is a legacy path: unless yarn_package_root.directory? yarn_package_root = root + "lib/components" end yarn_install_root = root + "public/_components" yarn_package_root.children.select(&:directory?).collect(&:basename).each do |package_directory| install_path = yarn_install_root + package_directory package_path = yarn_package_root + package_directory dist_path = package_path + 'dist' FileUtils::Verbose.rm_rf(install_path) FileUtils::Verbose.mkpath(install_path.dirname) # If a package has a dist directory, we only symlink that... otherwise we have to do the entire package, and hope that bower's ignore was setup correctly: if dist_path.exist? link_path = Utopia::Path.shortest_path(dist_path, install_path) else link_path = Utopia::Path.shortest_path(package_path, install_path) end FileUtils::Verbose.cp_r File.expand_path(link_path, install_path), install_path end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
utopia-2.15.1 | bake/utopia/yarn.rb |
utopia-2.15.0 | bake/utopia/yarn.rb |