File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -41,12 +41,11 @@ def unpin(*packages)
41
41
if packager . packaged? ( package )
42
42
if options [ :download ]
43
43
puts %(Unpinning and removing "#{ package } ")
44
- packager . remove ( package )
45
44
else
46
45
puts %(Unpinning "#{ package } ")
47
46
end
48
47
49
- remove_line_from_file "config/importmap.rb" , /pin " #{ package } "/
48
+ packager . remove ( package )
50
49
end
51
50
end
52
51
else
Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ def download(package, url)
53
53
54
54
def remove ( package )
55
55
remove_existing_package_file ( package )
56
+ remove_package_from_importmap ( package )
56
57
end
57
58
58
59
private
@@ -94,6 +95,15 @@ def remove_existing_package_file(package)
94
95
FileUtils . rm_rf "#{ vendored_package_path ( package ) } .br" # Temp workaround for jspm.io
95
96
end
96
97
98
+ def remove_package_from_importmap ( package )
99
+ all_lines = File . readlines ( @importmap_path )
100
+ with_lines_removed = all_lines . select { |line | line !~ /pin "#{ package } "/ }
101
+
102
+ File . open ( @importmap_path , "w" ) do |file |
103
+ with_lines_removed . each { |line | file . write ( line ) }
104
+ end
105
+ end
106
+
97
107
def download_package_file ( package , url )
98
108
if url =~ /jspm.io/
99
109
# Temporary workaround jspm.io only sending brotli
You can’t perform that action at this time.
0 commit comments