Skip to content

Commit

Permalink
new: Support dashes in input names.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Apr 24, 2022
1 parent a045d38 commit aa76abe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/packemon/src/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ export const packemonBlueprint: Blueprint<PackemonPackageConfig> = {
bundle: bool(true),
externals: union([]).of([string(), array().of(string())]),
format,
inputs: object({ index: DEFAULT_INPUT }).of(string()).keysOf(string().match(/^\w+$/u)),
inputs: object({ index: DEFAULT_INPUT })
.of(string())
.keysOf(string().match(/^[a-zA-Z0-9-_]+$/u)),
namespace: string(),
platform: union(DEFAULT_PLATFORM).of([array().of(platform), platform]),
support,
Expand Down
4 changes: 2 additions & 2 deletions packages/packemon/tests/__snapshots__/Package.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

exports[`Package setConfigs() errors if input name contains a slash 1`] = `
"The following validations have failed for \`flag-common\`:
- Invalid field \\"inputs\\". Invalid key \\"foo/bar\\". String does not match. (pattern \\"^\\\\w+$\\")"
- Invalid field \\"inputs\\". Invalid key \\"foo/bar\\". String does not match. (pattern \\"^[a-zA-Z0-9-_]+$\\")"
`;

exports[`Package setConfigs() errors if input name contains a space 1`] = `
"The following validations have failed for \`flag-common\`:
- Invalid field \\"inputs\\". Invalid key \\"foo bar\\". String does not match. (pattern \\"^\\\\w+$\\")"
- Invalid field \\"inputs\\". Invalid key \\"foo bar\\". String does not match. (pattern \\"^[a-zA-Z0-9-_]+$\\")"
`;

exports[`Package setConfigs() errors if invalid format is provided for \`browser\` platform 1`] = `
Expand Down

0 comments on commit aa76abe

Please sign in to comment.