diff --git a/index.js b/index.js index 58f330b..557e33b 100644 --- a/index.js +++ b/index.js @@ -47,6 +47,7 @@ class RustPlugin { dockerTag: DEFAULT_DOCKER_TAG, dockerImage: DEFAULT_DOCKER_IMAGE, dockerless: false, + inWorkspace: false, }, (this.serverless.service.custom && this.serverless.service.custom.rust) || {} @@ -167,7 +168,7 @@ class RustPlugin { const zip = new AdmZip(); zip.addFile( "bootstrap", - readFileSync(path.join(sourceDir, binary)), + readFileSync(path.join(this.custom.inWorkspace ? '..' : '', sourceDir, binary)), "", 0o755 ); diff --git a/tests/unit/index.test.js b/tests/unit/index.test.js index 28714cd..38200bb 100644 --- a/tests/unit/index.test.js +++ b/tests/unit/index.test.js @@ -40,6 +40,7 @@ describe("RustPlugin", () => { dockerImage: "softprops/lambda-rust", dockerTag: "latest", dockerless: false, + inWorkspace: false }); }); @@ -54,6 +55,7 @@ describe("RustPlugin", () => { dockerImage: "notsoftprops/lambda-rust", dockerTag: "custom-tag", dockerless: true, + inWorkspace: false }, }, package: {}, @@ -67,6 +69,7 @@ describe("RustPlugin", () => { dockerImage: "notsoftprops/lambda-rust", dockerTag: "custom-tag", dockerless: true, + inWorkspace: false }); });