fix: honour package.pattern over internally set exclusion list#339
fix: honour package.pattern over internally set exclusion list#339codingnuclei wants to merge 1 commit intofloydspace:masterfrom
Conversation
3d3fb50 to
55a0675
Compare
|
@floydspace is there a chance for this PR to be merge ? const copyStaticFiles = require('esbuild-copy-static-files');
module.exports = (serverless) => ({
bundle: true,
minify: true,
format: 'cjs',
logLevel: 'info',
platform: 'node',
sourcemap: true,
tsconfig: 'tsconfig.json',
watch: {
pattern: ['src/**/*.ts'],
ignore: ['.serverless/**/*', '.build']
},
plugins: [
copyStaticFiles({
src: './package.json',
dest: '.esbuild/.build/package.json',
dereference: true,
recursive: false
}),
copyStaticFiles({
src: './src/docs',
dest: '.esbuild/.build/src/docs',
dereference: true,
recursive: true
})
]
});Until I read the code and the felt on this issue... |
|
Btw, I'm not event sure why we should exclude any files from the build folder. |
|
Amazon Inspector can now scan Lambda functions for vulnerabilities. However it looks like it is using |
Hey,
This PR enables the
package.patternto behave such that the user has the final say over what files are packaged.Currently a list of predefined files are always excluded from the final zip, which is not great from a flexibility point of view #315
serverless-esbuild/src/pack.ts
Line 38 in a233a1a
Further more currently the files returned from the pattern glob are added to an include list...
serverless-esbuild/src/pack.ts
Line 171 in a233a1a
... so although I may have used a glob like
!**/*.md, those files will still be included into the final zip as thefilterFilesForZipPackagewill return true for any file that does not meet an exclusion criteria.Taking the view that what is defined in both
package.patternandfunction.patternas what files the user wants then we can remove files as needed.Let me know what you think :)
Considerations:
globbyhas been removed.excludedFilesDefault.