diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 38f69696..23e2d67f 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -61,7 +61,7 @@ jobs: run: python -m pip install --force setuptools wheel - name: Install pipenv / poetry - run: python -m pip install pipenv poetry + run: python -m pip install pipenv poetry && poetry self add poetry-plugin-export - name: Install serverless run: npm install -g serverless@${{ matrix.sls-version }} diff --git a/index.js b/index.js index ca8b191f..44906956 100644 --- a/index.js +++ b/index.js @@ -74,7 +74,7 @@ class ServerlessPythonRequirements { options.pythonBin = 'python'; } if (/python3[0-9]+/.test(options.pythonBin)) { - // "google" and "scaleway" providers' runtimes uses python3XX + // "google" and "scaleway" providers' runtimes use python3XX options.pythonBin = options.pythonBin.replace(/3([0-9]+)/, '3.$1'); } if (options.dockerizePip === 'non-linux') { diff --git a/lib/inject.js b/lib/inject.js index 12267376..f4acde9d 100644 --- a/lib/inject.js +++ b/lib/inject.js @@ -153,7 +153,12 @@ async function injectAllRequirements(funcArtifact) { return this.options.zip ? func : injectRequirements( - path.join('.serverless', func.module, 'requirements'), + path.join( + this.serverless.serviceDir, + '.serverless', + func.module, + 'requirements' + ), func.package.artifact, injectionRelativePath, this.options @@ -161,7 +166,7 @@ async function injectAllRequirements(funcArtifact) { }); } else if (!this.options.zip) { await injectRequirements( - path.join('.serverless', 'requirements'), + path.join(this.serverless.serviceDir, '.serverless', 'requirements'), this.serverless.service.package.artifact || funcArtifact, injectionRelativePath, this.options diff --git a/package.json b/package.json index 07466e23..f5754f24 100644 --- a/package.json +++ b/package.json @@ -77,9 +77,6 @@ "sha256-file": "1.0.0", "shell-quote": "^1.8.1" }, - "peerDependencies": { - "serverless": ">=2.32" - }, "lint-staged": { "*.js": [ "eslint" diff --git a/test.js b/test.js index 488b500f..1967330b 100644 --- a/test.js +++ b/test.js @@ -206,7 +206,7 @@ test( process.chdir('tests/base'); const { stdout: path } = npm(['pack', '../..']); npm(['i', path]); - const { stderr } = sls(['package'], { + const { stdout } = sls(['package'], { noThrow: true, env: { dockerizePip: true, @@ -216,7 +216,7 @@ test( }, }); t.true( - stderr.includes( + stdout.includes( `-v ${__dirname}${sep}tests${sep}base${sep}custom_ssh:/root/.ssh/custom_ssh:z` ), 'docker command properly resolved' @@ -1742,12 +1742,12 @@ test('poetry py3.9 fails packaging if poetry.lock is missing and flag requirePoe const { stdout: path } = npm(['pack', '../..']); npm(['i', path]); - const { stderr } = sls(['package'], { + const { stdout } = sls(['package'], { env: { requirePoetryLockFile: 'true', slim: 'true' }, noThrow: true, }); t.true( - stderr.includes( + stdout.includes( 'poetry.lock file not found - set requirePoetryLockFile to false to disable this error' ), 'flag works and error is properly reported'