mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
Merge pull request #960 from nicka/master
Add support for symbolic links and retain original file permissions
This commit is contained in:
commit
04ff1e08d4
@ -112,13 +112,17 @@ module.exports = function(S) {
|
||||
return new BbPromise(function(resolve, reject) {
|
||||
fse.walk(_this.evt.options.pathDist)
|
||||
.on('data', function (item) {
|
||||
let symbolicLink = item.stats.isSymbolicLink() && fs.existsSync(item.path);
|
||||
|
||||
if (item.stats.isFile()) {
|
||||
if (item.stats.isFile() || symbolicLink) {
|
||||
let name = path.relative(_this.evt.options.pathDist, item.path);
|
||||
let permissions = fs.statSync(item.path).mode;
|
||||
|
||||
// Exclude certain files
|
||||
if (name.indexOf('DS_Store') == -1) {
|
||||
zip.file(name, fs.readFileSync(item.path));
|
||||
zip.file(name, fs.readFileSync(item.path), {
|
||||
unixPermissions: permissions
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -134,7 +138,8 @@ module.exports = function(S) {
|
||||
// Compress
|
||||
_this.zipBuffer = zip.generate({
|
||||
type: 'nodebuffer',
|
||||
compression: 'DEFLATE'
|
||||
compression: 'DEFLATE',
|
||||
platform: process.platform
|
||||
});
|
||||
|
||||
if (_this.zipBuffer.length > 52428800) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user