This repository has been archived by the owner on Dec 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1311369
commit 8f2442f
Showing
3 changed files
with
55 additions
and
7 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/*--------------------------------------------------------- | ||
* Copyright (C) Microsoft Corporation. All rights reserved. | ||
*--------------------------------------------------------*/ | ||
|
||
const gulp = require('gulp'); | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
|
||
function verifyNotALinkedModule(modulePath) { | ||
return new Promise((resolve, reject) => { | ||
fs.lstat(modulePath, (err, stat) => { | ||
if (stat.isSymbolicLink()) { | ||
reject(new Error('Symbolic link found: ' + modulePath)); | ||
} else { | ||
resolve(); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
function verifyNoLinkedModules() { | ||
return new Promise((resolve, reject) => { | ||
fs.readdir('./node_modules', (err, files) => { | ||
Promise.all(files.map(file => { | ||
const modulePath = path.join('.', 'node_modules', file); | ||
return verifyNotALinkedModule(modulePath); | ||
})).then(resolve, reject); | ||
}); | ||
}); | ||
} | ||
|
||
gulp.task('verify-no-linked-modules', cb => verifyNoLinkedModules().then(() => cb, cb)); |
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