diff --git a/lib/schemas.js b/lib/schemas.js index 1fd91f8..f851e14 100644 --- a/lib/schemas.js +++ b/lib/schemas.js @@ -9,7 +9,7 @@ const Joi = require('joi'); const file = Joi.string() .label('entrypoint filename') - .regex(/^[a-zA-Z0-9/._-]+\.(js|jsx|css|ts|tsx)$/) + .regex(/^[a-zA-Z0-9@/._-]+\.(js|jsx|css|ts|tsx)$/) .lowercase() .trim() .required(); diff --git a/package.json b/package.json index 9f2a018..ae4c95b 100644 --- a/package.json +++ b/package.json @@ -41,12 +41,12 @@ "@asset-pipe/dev-middleware": "^2.0.8", "@asset-pipe/js-writer": "^2.0.4", "@metrics/client": "^2.5.0", - "JSONStream": "^1.3.5", "abslog": "^2.4.0", "boom": "^7.3.0", "commander": "^4.1.0", "is-stream": "^2.0.0", "joi": "^14.3.1", + "JSONStream": "^1.3.5", "ow": "^0.15.0", "request": "^2.88.0" }, diff --git a/test/unit/__snapshots__/main.test.js.snap b/test/unit/__snapshots__/main.test.js.snap index ab97dc7..554ba09 100644 --- a/test/unit/__snapshots__/main.test.js.snap +++ b/test/unit/__snapshots__/main.test.js.snap @@ -16,7 +16,7 @@ exports[`publishAssets(tag, entrypoints) - files array must contain .css or .js "two" ]  -[1] "entrypoint filename" with value "one" fails to match the required pattern: /^[a-zA-Z0-9/._-]+\\.(js|jsx|css|ts|tsx)$/] +[1] "entrypoint filename" with value "one" fails to match the required pattern: /^[a-zA-Z0-9@/._-]+\\.(js|jsx|css|ts|tsx)$/] `; exports[`publishAssets(tag, entrypoints) - files array must only contain strings 1`] = ` diff --git a/test/unit/__snapshots__/schemas.test.js.snap b/test/unit/__snapshots__/schemas.test.js.snap index db6ec47..20da0bd 100644 --- a/test/unit/__snapshots__/schemas.test.js.snap +++ b/test/unit/__snapshots__/schemas.test.js.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -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)$/]`; +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)$/]`; diff --git a/test/unit/schemas.test.js b/test/unit/schemas.test.js index 2ebdcf4..cdc3a77 100644 --- a/test/unit/schemas.test.js +++ b/test/unit/schemas.test.js @@ -38,6 +38,11 @@ test('file schema allows for absolute file paths', () => { expect(result.error).toEqual(null); }); +test('file schema allows for email address in path', () => { + const result = Joi.validate('/path/test@test.com/index.js', schemas.file); + expect(result.error).toEqual(null); +}); + test('hash schema', () => { const hash = 'a1b2c3a1b2c3'; const result = Joi.validate(hash, schemas.hash);