serverless-basic-authentication
Advanced tools
Comparing version 0.13.0 to 0.14.0
23
index.js
const fs = require('fs'); | ||
const chalk = require('chalk'); | ||
const path = require('path'); | ||
@@ -28,3 +29,3 @@ module.exports = class SetupBasicAuthentication { | ||
this.serverless.cli.consoleLog(`Basic Authentication: ${chalk.yellow('Removing Symlink for Basic Authenticator')}`); | ||
fs.unlinkSync(`${this.serverless.config.servicePath}/basic_auth.py`); | ||
fs.unlinkSync(path.normalize(`${this.serverless.config.servicePath}/basic_auth.py`)); | ||
} | ||
@@ -45,5 +46,19 @@ | ||
// append our auth.py file to the package | ||
this.serverless.package.include.push(`${__dirname}/auth.py`); | ||
fs.symlinkSync(`${__dirname}/basic_auth.py`, `${this.serverless.config.servicePath}/basic_auth.py`); | ||
// append our basic_auth.py file to the package | ||
this.serverless.package.include.push(path.normalize(`${__dirname}/basic_auth.py`)); | ||
try { | ||
fs.symlinkSync( | ||
path.normalize(`${__dirname}/basic_auth.py`), | ||
path.normalize(`${this.serverless.config.servicePath}/basic_auth.py`) | ||
); | ||
} catch (error) { | ||
if (error.errno === -4048 && error.code === 'EPERM') { | ||
fs.copyFileSync( | ||
path.normalize(`${__dirname}/basic_auth.py`), | ||
path.normalize(`${this.serverless.config.servicePath}/basic_auth.py`) | ||
); | ||
} else { | ||
throw error; | ||
} | ||
} | ||
} | ||
@@ -50,0 +65,0 @@ |
{ | ||
"name": "serverless-basic-authentication", | ||
"version": "0.13.0", | ||
"version": "0.14.0", | ||
"devDependencies": { | ||
"eslint": "^5.15.1", | ||
"eslint-config-airbnb-base": "^13.1.0", | ||
"eslint-plugin-import": "^2.14.0", | ||
"jest": "^24.1.0" | ||
"eslint": "^5.16.0", | ||
"eslint-config-airbnb-base": "^13.2.0", | ||
"eslint-plugin-import": "^2.18.0", | ||
"jest": "^24.8.0" | ||
}, | ||
@@ -10,0 +10,0 @@ "license": "MIT", |
11194
7
104