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

Commit 93e2aa0

Browse files
committed
fix: support email address in path
1 parent 5684cea commit 93e2aa0

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

lib/schemas.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const Joi = require('joi');
99

1010
const file = Joi.string()
1111
.label('entrypoint filename')
12-
.regex(/^[a-zA-Z0-9/._-]+\.(js|jsx|css|ts|tsx)$/)
12+
.regex(/^[a-zA-Z0-9@/._-]+\.(js|jsx|css|ts|tsx)$/)
1313
.lowercase()
1414
.trim()
1515
.required();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@
4141
"@asset-pipe/dev-middleware": "^2.0.8",
4242
"@asset-pipe/js-writer": "^2.0.4",
4343
"@metrics/client": "^2.5.0",
44-
"JSONStream": "^1.3.5",
4544
"abslog": "^2.4.0",
4645
"boom": "^7.3.0",
4746
"commander": "^4.1.0",
4847
"is-stream": "^2.0.0",
4948
"joi": "^14.3.1",
49+
"JSONStream": "^1.3.5",
5050
"ow": "^0.15.0",
5151
"request": "^2.88.0"
5252
},

test/unit/__snapshots__/main.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ exports[`publishAssets(tag, entrypoints) - files array must contain .css or .js
1616
"two"
1717
]
1818

19-
[1] "entrypoint filename" with value "one" fails to match the required pattern: /^[a-zA-Z0-9/._-]+\\.(js|jsx|css|ts|tsx)$/[0m]
19+
[1] "entrypoint filename" with value "one" fails to match the required pattern: /^[a-zA-Z0-9@/._-]+\\.(js|jsx|css|ts|tsx)$/[0m]
2020
`;
2121

2222
exports[`publishAssets(tag, entrypoints) - files array must only contain strings 1`] = `
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`file schema does not allow for non .js/.css/.ts/.tsx file extensions 1`] = `[ValidationError: "entrypoint filename" with value "index.json" fails to match the required pattern: /^[a-zA-Z0-9/._-]+\\.(js|jsx|css|ts|tsx)$/]`;
3+
exports[`file schema does not allow for non .js/.css/.ts/.tsx file extensions 1`] = `[ValidationError: "entrypoint filename" with value "index.json" fails to match the required pattern: /^[a-zA-Z0-9@/._-]+\\.(js|jsx|css|ts|tsx)$/]`;

test/unit/schemas.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ test('file schema allows for absolute file paths', () => {
3838
expect(result.error).toEqual(null);
3939
});
4040

41+
test('file schema allows for email address in path', () => {
42+
const result = Joi.validate('/path/test@test.com/index.js', schemas.file);
43+
expect(result.error).toEqual(null);
44+
});
45+
4146
test('hash schema', () => {
4247
const hash = 'a1b2c3a1b2c3';
4348
const result = Joi.validate(hash, schemas.hash);

0 commit comments

Comments
 (0)