Skip to content

Commit aa65574

Browse files
author
bweigel
committed
consistent naming of artifacts, when moving modules up
1 parent 136baf0 commit aa65574

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

lib/inject.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,17 @@ function injectAllRequirements(funcArtifact) {
9090
this.options.IndividuallyMoveUpModules === 'true'
9191
) {
9292
const artifact = func.package ? func.package.artifact : funcArtifact;
93-
const newArtifact = path.join(
94-
'.serverless',
95-
`${func.module}-${func.name}.zip`
96-
);
93+
94+
let newArtifact;
95+
if (func.module === '.') {
96+
newArtifact = path.join('.serverless', `root-${func.name}.zip`);
97+
} else {
98+
newArtifact = path.join(
99+
'.serverless',
100+
`${func.module}-${func.name}.zip`
101+
);
102+
}
103+
97104
func.package.artifact = newArtifact;
98105
return injectSourceCode(artifact, newArtifact, func.module).then(
99106
() => func

test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,9 @@ test('can package individually, moving modules to root of zip-File with Individu
414414
npm(['i', path]);
415415
sls(['--individually=true', '--moveup=true', 'package']);
416416

417-
const zipfiles_hello = listZipFiles('.serverless/hello.zip');
417+
const zipfiles_hello = listZipFiles(
418+
'.serverless/root-sls-py-req-test-dev-hello.zip'
419+
);
418420
t.false(
419421
zipfiles_hello.includes(`fn2${sep}__init__.py`),
420422
'fn2 is not packaged in function hello'

0 commit comments

Comments
 (0)