-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Persistence: prevent NPM from overwriting node_modules by setting rea…
…d-only attribute on the persisted directory junction.
- Loading branch information
1 parent
2a34d13
commit 4382206
Showing
2 changed files
with
7 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -976,19 +976,19 @@ function persist_def($persist) { | |
function persist_data($manifest) { | ||
$persist = $manifest.persist | ||
if($persist) { | ||
ensure $data_dir | ||
$data_dir = ensure $data_dir | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
if ($persist -is [String]) { | ||
$persist = @($persist); | ||
} | ||
|
||
write-host "Persisting data..." | ||
write-host "Persisting $persist" | ||
$persist | % { | ||
$source, $target = persist_def $_ | ||
|
||
# add base paths | ||
$source = "$original_dir\$source" | ||
$target = "$data_dir\$target" | ||
$source = "$(resolve-path $original_dir\$source)" | ||
This comment has been minimized.
Sorry, something went wrong.
lukesampson
Author
Member
|
||
$target = fullpath "$data_dir\$target" | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
# TODO test with files | ||
if (!(test-path $target)) { | ||
|
@@ -1007,6 +1007,7 @@ function persist_data($manifest) { | |
# create link | ||
# TODO use /h for files | ||
cmd /c "mklink /j $source $target" | out-null | ||
attrib $source +R /L # | ||
This comment has been minimized.
Sorry, something went wrong.
lukesampson
Author
Member
|
||
} | ||
} | ||
} |
I think this logs the directory to the console if you don't reassign it.