Skip to content
This repository was archived by the owner on May 22, 2024. It is now read-only.

Commit 6e491e6

Browse files
feat: add config property to CLI entry point (#426)
* feat: add config property to CLI entry point * chore: remove unused property
1 parent 21f8155 commit 6e491e6

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

src/bin.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ const OPTIONS = {
3030
default: ARCHIVE_FORMAT_ZIP,
3131
describe: 'Format of the archive created for each function',
3232
},
33+
config: {
34+
default: {},
35+
describe:
36+
'An object matching glob-like expressions to objects containing configuration properties. Whenever a function name matches one of the expressions, it inherits the configuration properties',
37+
},
3338
'parallel-limit': {
3439
number: true,
3540
describe: 'Maximum number of Functions to bundle at the same time',

tests/main.js

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -477,25 +477,21 @@ testBundlers('Can use zipFunction()', [ESBUILD, ESBUILD_ZISI, DEFAULT], async (b
477477
t.deepEqual(result.config, bundler === DEFAULT ? {} : { nodeBundler: outBundler })
478478
})
479479

480-
testBundlers(
481-
'Can list function main files with listFunctions()',
482-
[ESBUILD, ESBUILD_ZISI, DEFAULT],
483-
async (bundler, t) => {
484-
const fixtureDir = `${FIXTURES_DIR}/list`
485-
const functions = await listFunctions(fixtureDir)
486-
t.deepEqual(
487-
functions,
488-
[
489-
{ name: 'test', mainFile: 'test.zip', runtime: 'js', extension: '.zip' },
490-
{ name: 'test', mainFile: 'test.js', runtime: 'js', extension: '.js' },
491-
{ name: 'four', mainFile: 'four.js/four.js.js', runtime: 'js', extension: '.js' },
492-
{ name: 'one', mainFile: 'one/index.js', runtime: 'js', extension: '.js' },
493-
{ name: 'two', mainFile: 'two/two.js', runtime: 'js', extension: '.js' },
494-
{ name: 'test', mainFile: 'test', runtime: 'go', extension: '' },
495-
].map(normalizeFiles.bind(null, fixtureDir)),
496-
)
497-
},
498-
)
480+
test('Can list function main files with listFunctions()', async (t) => {
481+
const fixtureDir = `${FIXTURES_DIR}/list`
482+
const functions = await listFunctions(fixtureDir)
483+
t.deepEqual(
484+
functions,
485+
[
486+
{ name: 'test', mainFile: 'test.zip', runtime: 'js', extension: '.zip' },
487+
{ name: 'test', mainFile: 'test.js', runtime: 'js', extension: '.js' },
488+
{ name: 'four', mainFile: 'four.js/four.js.js', runtime: 'js', extension: '.js' },
489+
{ name: 'one', mainFile: 'one/index.js', runtime: 'js', extension: '.js' },
490+
{ name: 'two', mainFile: 'two/two.js', runtime: 'js', extension: '.js' },
491+
{ name: 'test', mainFile: 'test', runtime: 'go', extension: '' },
492+
].map(normalizeFiles.bind(null, fixtureDir)),
493+
)
494+
})
499495

500496
testBundlers(
501497
'Can list all function files with listFunctionsFiles()',

0 commit comments

Comments
 (0)