Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/main.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -406,9 +406,7 @@ Lambda.prototype._zip = (program, codeDirectory) =>{

const filePath = file.path.replace(path.join(codeDirectory, path.sep), '')
if (file.stats.isSymbolicLink()){
// # archiver.js
// Implementation supporting symlink has been done,
// but it seems that release has not been done yet
return archive.symlink(filePath, fs.readlinkSync(file.path))
}

archive.append(
Expand Down
74 changes: 20 additions & 54 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,9 +36,9 @@
"standard": "^10.0.2"
},
"dependencies":{
"archiver": "^1.3.0",
"aws-sdk": "^2.76.0",
"commander": "^2.10.0",
"archiver": "^2.0.0",
"aws-sdk": "^2.81.0",
"commander": "^2.11.0",
"dotenv": "^0.4.0",
"fs-extra": "^0.30.0",
"minimatch": "^3.0.3",
Expand Down
20 changes: 17 additions & 3 deletions test/main.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -529,21 +529,27 @@ describe('lib/main', function (){
return lambda._fileCopy(program, '.', codeDirectory, true)
}).then(() =>{
return lambda._npmInstall(program, codeDirectory)
}).then(() =>{
if (process.platform !== 'win32'){
fs.symlinkSync(
path.join(__dirname, '..', 'bin', 'node-lambda'),
path.join(codeDirectory, 'node-lambda-link')
)
}
})
})

it('Compress the file. `index.js` and `bin/node-lambda` are included and the permission is also preserved.', function (){
_timeout({this: this, sec: 30 }) // give it time to zip

return lambda._zip(program, codeDirectory).then((data) =>{
const indexJsStat = fs.lstatSync('index.js')
const binNodeLambdaStat = fs.lstatSync(path.join('bin', 'node-lambda'))

const archive = new Zip(data)
assert.include(archive.files['index.js'].name, 'index.js')
assert.include(archive.files['bin/node-lambda'].name, 'bin/node-lambda')

if (process.platform !== 'win32'){
const indexJsStat = fs.lstatSync('index.js')
const binNodeLambdaStat = fs.lstatSync(path.join('bin', 'node-lambda'))
assert.equal(
archive.files['index.js'].unixPermissions,
indexJsStat.mode
Expand All@@ -552,6 +558,14 @@ describe('lib/main', function (){
archive.files['bin/node-lambda'].unixPermissions,
binNodeLambdaStat.mode
)

// isSymbolicLink
assert.include(archive.files['node-lambda-link'].name, 'node-lambda-link')
const fsConstants = process.binding('constants').fs || require('constants')
assert.equal(
archive.files['node-lambda-link'].unixPermissions & fsConstants.S_IFMT,
fsConstants.S_IFLNK
)
}
})
})
Expand Down
Loading