Skip to content

Commit a3136a1

Browse files
committed
fix: prettify
1 parent 05dc4db commit a3136a1

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

lib/inject.js

+26-12
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ function injectRequirements(
2323
injectionRelativePath,
2424
options
2525
) {
26+
console.log('requirementsPath', requirementsPath);
27+
console.log('injectionRelativePath', injectionRelativePath);
28+
console.log('packagePath', packagePath);
2629
const noDeploy = new Set(options.noDeploy || []);
2730

2831
return fse
@@ -31,17 +34,21 @@ function injectRequirements(
3134
.then((zip) =>
3235
BbPromise.resolve(
3336
glob.sync([path.join(requirementsPath, '**')], {
37+
// glob.sync([path.join(packagePath, '..', 'requirements', '**')], {
3438
mark: true,
3539
dot: true,
3640
})
3741
)
38-
.map((file) => [
39-
file,
40-
path.join(
41-
injectionRelativePath,
42-
path.relative(requirementsPath, file)
43-
),
44-
])
42+
.map((file) => {
43+
// console.log('first map file', file);
44+
return [
45+
file,
46+
path.join(
47+
injectionRelativePath,
48+
path.relative(requirementsPath, file)
49+
),
50+
];
51+
})
4552
.filter(
4653
([file, relativeFile]) =>
4754
!file.endsWith('/') &&
@@ -51,12 +58,13 @@ function injectRequirements(
5158
.map(([file, relativeFile]) =>
5259
Promise.all([file, relativeFile, fse.statAsync(file)])
5360
)
54-
.mapSeries(([file, relativeFile, fileStat]) =>
55-
zipFile(zip, relativeFile, fse.readFileAsync(file), {
61+
.mapSeries(([file, relativeFile, fileStat]) => {
62+
// console.log('file', file);
63+
return zipFile(zip, relativeFile, fse.readFileAsync(file), {
5664
unixPermissions: fileStat.mode,
5765
createFolders: false,
58-
})
59-
)
66+
});
67+
})
6068
.then(() => writeZip(zip, packagePath))
6169
);
6270
}
@@ -150,10 +158,16 @@ async function injectAllRequirements(funcArtifact) {
150158
}
151159
})
152160
.map((func) => {
161+
console.log('func.module', func.module);
153162
return this.options.zip
154163
? func
155164
: injectRequirements(
156-
path.join(this.serverless.serviceDir, '.serverless', func.module, 'requirements'),
165+
path.join(
166+
this.serverless.serviceDir,
167+
'.serverless',
168+
func.module,
169+
'requirements'
170+
),
157171
func.package.artifact,
158172
injectionRelativePath,
159173
this.options

0 commit comments

Comments
 (0)