diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 1ae02e8a..a6dc9f95 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -29,13 +29,16 @@ jobs: Testing: name: Unit Tests runs-on: ubuntu-latest + strategy: + matrix: + node: [14, 16, 18] steps: - name: Checkout Project uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 - - name: Use Node.js v16 + - name: Use Node.js ${{ matrix.node }} uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # tag=v3 with: - node-version: 16 + node-version: ${{ matrix.node }} cache: yarn registry-url: https://registry.npmjs.org/ - name: Install Dependencies @@ -44,6 +47,7 @@ jobs: run: yarn test --coverage - name: Store code coverage report uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # tag=v3 + if: matrix.node == 18 with: name: coverage path: coverage/ diff --git a/README.md b/README.md index 785f20b0..cae9cfae 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ Blazing fast input validation and transformation ⚡ A very fast and lightweight input validation and transformation library for JavaScript. -> **Note**: ShapeShift requires Node.js v15.0.0 or higher to work. +> **Note**: ShapeShift requires Node.js v14.0.0 or higher to work. ## Features diff --git a/package.json b/package.json index 65780dbf..eeaf40c5 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "dist/**/*.d*" ], "engines": { - "node": ">=v15.0.0", + "node": ">=v14.0.0", "npm": ">=7.0.0" }, "keywords": [ diff --git a/src/lib/errors/CombinedError.ts b/src/lib/errors/CombinedError.ts index bc99d206..9e431ff2 100644 --- a/src/lib/errors/CombinedError.ts +++ b/src/lib/errors/CombinedError.ts @@ -24,7 +24,7 @@ export class CombinedError extends BaseError { const errors = this.errors .map((error, i) => { const index = options.stylize((i + 1).toString(), 'number'); - const body = error[customInspectSymbolStackLess](depth - 1, newOptions).replaceAll('\n', padding); + const body = error[customInspectSymbolStackLess](depth - 1, newOptions).replace(/\n/g, padding); return ` ${index} ${body}`; }) diff --git a/src/lib/errors/CombinedPropertyError.ts b/src/lib/errors/CombinedPropertyError.ts index eb422f8b..eeea5a8d 100644 --- a/src/lib/errors/CombinedPropertyError.ts +++ b/src/lib/errors/CombinedPropertyError.ts @@ -24,7 +24,7 @@ export class CombinedPropertyError extends BaseError { const errors = this.errors .map(([key, error]) => { const property = CombinedPropertyError.formatProperty(key, options); - const body = error[customInspectSymbolStackLess](depth - 1, newOptions).replaceAll('\n', padding); + const body = error[customInspectSymbolStackLess](depth - 1, newOptions).replace(/\n/g, padding); return ` input${property}${padding}${body}`; }) diff --git a/src/lib/errors/ExpectedConstraintError.ts b/src/lib/errors/ExpectedConstraintError.ts index 8e72aca3..c5cd4b9e 100644 --- a/src/lib/errors/ExpectedConstraintError.ts +++ b/src/lib/errors/ExpectedConstraintError.ts @@ -28,7 +28,7 @@ export class ExpectedConstraintError extends BaseConstraintError const newOptions = { ...options, depth: options.depth === null ? null : options.depth! - 1 }; const padding = `\n ${options.stylize('|', 'undefined')} `; - const given = inspect(this.given, newOptions).replaceAll('\n', padding); + const given = inspect(this.given, newOptions).replace(/\n/g, padding); const header = `${options.stylize('ExpectedConstraintError', 'special')} > ${constraint}`; const message = options.stylize(this.message, 'regexp'); diff --git a/src/lib/errors/ExpectedValidationError.ts b/src/lib/errors/ExpectedValidationError.ts index 1c5248cd..3aa699c4 100644 --- a/src/lib/errors/ExpectedValidationError.ts +++ b/src/lib/errors/ExpectedValidationError.ts @@ -28,8 +28,8 @@ export class ExpectedValidationError extends ValidationError { const newOptions = { ...options, depth: options.depth === null ? null : options.depth! - 1 }; const padding = `\n ${options.stylize('|', 'undefined')} `; - const expected = inspect(this.expected, newOptions).replaceAll('\n', padding); - const given = inspect(this.given, newOptions).replaceAll('\n', padding); + const expected = inspect(this.expected, newOptions).replace(/\n/g, padding); + const given = inspect(this.given, newOptions).replace(/\n/g, padding); const header = `${options.stylize('ExpectedValidationError', 'special')} > ${validator}`; const message = options.stylize(this.message, 'regexp'); diff --git a/src/lib/errors/MultiplePossibilitiesConstraintError.ts b/src/lib/errors/MultiplePossibilitiesConstraintError.ts index 82b85ae3..d42b6dd2 100644 --- a/src/lib/errors/MultiplePossibilitiesConstraintError.ts +++ b/src/lib/errors/MultiplePossibilitiesConstraintError.ts @@ -29,7 +29,7 @@ export class MultiplePossibilitiesConstraintError extends BaseConst const verticalLine = options.stylize('|', 'undefined'); const padding = `\n ${verticalLine} `; - const given = inspect(this.given, newOptions).replaceAll('\n', padding); + const given = inspect(this.given, newOptions).replace(/\n/g, padding); const header = `${options.stylize('MultiplePossibilitiesConstraintError', 'special')} > ${constraint}`; const message = options.stylize(this.message, 'regexp'); diff --git a/src/lib/errors/UnknownPropertyError.ts b/src/lib/errors/UnknownPropertyError.ts index 546f5cd8..7837da96 100644 --- a/src/lib/errors/UnknownPropertyError.ts +++ b/src/lib/errors/UnknownPropertyError.ts @@ -29,7 +29,7 @@ export class UnknownPropertyError extends BaseError { const newOptions = { ...options, depth: options.depth === null ? null : options.depth! - 1, compact: true }; const padding = `\n ${options.stylize('|', 'undefined')} `; - const given = inspect(this.value, newOptions).replaceAll('\n', padding); + const given = inspect(this.value, newOptions).replace(/\n/g, padding); const header = `${options.stylize('UnknownPropertyError', 'special')} > ${property}`; const message = options.stylize(this.message, 'regexp'); diff --git a/src/lib/errors/ValidationError.ts b/src/lib/errors/ValidationError.ts index 8d4893f3..93f71946 100644 --- a/src/lib/errors/ValidationError.ts +++ b/src/lib/errors/ValidationError.ts @@ -29,7 +29,7 @@ export class ValidationError extends BaseError { const newOptions = { ...options, depth: options.depth === null ? null : options.depth! - 1, compact: true }; const padding = `\n ${options.stylize('|', 'undefined')} `; - const given = inspect(this.given, newOptions).replaceAll('\n', padding); + const given = inspect(this.given, newOptions).replace(/\n/g, padding); const header = `${options.stylize('ValidationError', 'special')} > ${validator}`; const message = options.stylize(this.message, 'regexp'); diff --git a/tsconfig.base.json b/tsconfig.base.json index 19213533..2b4e4584 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1,7 +1,7 @@ { "extends": "@sapphire/ts-config/extra-strict-without-decorators", "compilerOptions": { - "target": "ES2021", + "target": "ES2020", "useDefineForClassFields": false, "emitDecoratorMetadata": false } diff --git a/tsup.config.ts b/tsup.config.ts index 817eeb20..e4a975e1 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -8,7 +8,7 @@ export default defineConfig({ minify: false, skipNodeModulesBundle: true, sourcemap: true, - target: 'es2021', + target: 'es2020', tsconfig: 'src/tsconfig.json', keepNames: true, globalName: 'SapphireShapeshift',