Skip to content

Commit

Permalink
chore: move files and delete useless files
Browse files Browse the repository at this point in the history
  • Loading branch information
Axel committed Sep 6, 2022
1 parent d1db984 commit 1ade2a9
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 79 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"import"
],
"rules": {
"max-classes-per-file": 0,
"@typescript-eslint/no-shadow": 0,
"@typescript-eslint/no-non-null-assertion": 0,
"guard-for-in": 0,
Expand Down
7 changes: 1 addition & 6 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ lint:

.PHONY: publish-npmjs
publish-npmjs:
yarn publish --access public --registry https://registry.npmjs.org/ --new-version $(PACKAGE_VERSION) --non-interactive

.PHONY: github-tag
github-tag:
git tag -a v$(PACKAGE_VERSION) -m "update to v$(PACKAGE_VERSION)"
git push origin v$(PACKAGE_VERSION)
yarn publish --registry https://registry.npmjs.org/ --access public --new-version $(PACKAGE_VERSION) --non-interactive

.PHONY: types
types:
Expand Down
48 changes: 11 additions & 37 deletions rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,15 @@ import {resolve} from "node:path";
import {terser} from "rollup-plugin-terser";
import typescript from "@rollup/plugin-typescript";

export default [
{
input: resolve("src", "Validator/index.ts"),
plugins: [
remove({targets: resolve("lib", "*")}),
typescript(),
terser()
],
output: {
file: resolve("lib", "Validator/index.js"),
format: "cjs"
}
},
{
input: resolve("src", "Error/index.ts"),
plugins: [
remove({targets: resolve("lib", "*")}),
typescript(),
terser()
],
output: {
file: resolve("lib", "Error/index.js.js"),
format: "cjs"
}
},
{
input: resolve("src", "index.ts"),
plugins: [
remove({targets: resolve("lib", "*")}),
typescript(),
terser()
],
output: {
file: resolve("lib", "index.js"),
format: "cjs"
}
export default {
input: resolve("src", "Validator.ts"),
plugins: [
remove({targets: resolve("lib", "*")}),
typescript(),
terser()
],
output: {
file: resolve("lib", "Validator.js"),
format: "cjs"
}
];
}
16 changes: 0 additions & 16 deletions src/Error/index.ts

This file was deleted.

29 changes: 27 additions & 2 deletions src/Validator/index.ts → src/Validator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
import { CallableRule, Rules } from "../types";
import { Error } from "../Error";
type CallableRule = ((data: string, ...args: unknown[]) => boolean);

type Rule = {
cb: CallableRule,
optionalParams?: unknown[]
};

type Rules = Record<string, Rule>;

class Error {
constructor(private _field: string, private _error: string) {
}

public get field(): string {
return this._field;
}

public get error(): string {
return this._error;
}

public toString(): string {
return `${this.error.replace("{champ}", this.field)}`;
}
}

export class Validator {
private _rules: Rules = {};
Expand Down Expand Up @@ -113,3 +136,5 @@ export class Validator {
this._rulesMapping[input] = [rule];
}
}

export default Validator;
4 changes: 0 additions & 4 deletions src/index.ts

This file was deleted.

12 changes: 0 additions & 12 deletions src/types.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/vite-env.d.ts

This file was deleted.

4 changes: 3 additions & 1 deletion tsconfig.types.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"extends": "./tsconfig.json",
"files": ["src/index.ts"],
"files": [
"src/Validator.ts"
],
"compilerOptions": {
"declaration": true,
"declarationMap": true,
Expand Down

0 comments on commit 1ade2a9

Please sign in to comment.