From bbf1b30c4decce34a115e64201702f270eb003c3 Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Mon, 2 Jan 2017 21:18:16 +0100 Subject: [PATCH] Set a default file mode for package.json --- lib/index.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/index.js b/lib/index.js index 7f3474d..c1072fb 100644 --- a/lib/index.js +++ b/lib/index.js @@ -129,17 +129,24 @@ export default class Now extends EventEmitter { // array has a group of files with the same sha but different path const files = await Promise.all(Array.prototype.concat.apply([], await Promise.all((Array.from(this._files)).map(async ([sha, {data, names}]) => { return await names.map(async name => { - if (this._static && toRelative(name, this._path) !== 'package.json') { - name = this.pathInsideContent(name) - } + let mode + + if (this._static) { + if (toRelative(name, this._path) === 'package.json') { + mode = 33261 + } else { + const st = await (followSymlinks ? stat(name) : lstat(name)) + mode = st.mode - const st = await (followSymlinks ? stat(name) : lstat(name)) + name = this.pathInsideContent(name) + } + } return { sha, size: data.length, file: toRelative(name, this._path), - mode: st.mode + mode } }) }))))