Skip to content

Commit

Permalink
fix: compile for es2020 instead of es2021 (#128)
Browse files Browse the repository at this point in the history
* chore: use es2020 instead of es2021

* chore: forgot the package json

* chore: ci test on all lts releases

* chore: fix jest

* chore: fix compat with node14

* chore: coverage/matrix fix

* chore: lets be correct in readme too
  • Loading branch information
vladfrangu authored Jun 19, 2022
1 parent cb9bc50 commit 051344d
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 14 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"dist/**/*.d*"
],
"engines": {
"node": ">=v15.0.0",
"node": ">=v14.0.0",
"npm": ">=7.0.0"
},
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion src/lib/errors/CombinedError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
})
Expand Down
2 changes: 1 addition & 1 deletion src/lib/errors/CombinedPropertyError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
})
Expand Down
2 changes: 1 addition & 1 deletion src/lib/errors/ExpectedConstraintError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class ExpectedConstraintError<T = unknown> extends BaseConstraintError<T>
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');
Expand Down
4 changes: 2 additions & 2 deletions src/lib/errors/ExpectedValidationError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export class ExpectedValidationError<T> 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');
Expand Down
2 changes: 1 addition & 1 deletion src/lib/errors/MultiplePossibilitiesConstraintError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class MultiplePossibilitiesConstraintError<T = unknown> 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');
Expand Down
2 changes: 1 addition & 1 deletion src/lib/errors/UnknownPropertyError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion src/lib/errors/ValidationError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@sapphire/ts-config/extra-strict-without-decorators",
"compilerOptions": {
"target": "ES2021",
"target": "ES2020",
"useDefineForClassFields": false,
"emitDecoratorMetadata": false
}
Expand Down
2 changes: 1 addition & 1 deletion tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 051344d

Please sign in to comment.