Skip to content

Commit

Permalink
⚙️ Chore(packages): implemetation
Browse files Browse the repository at this point in the history
o-internal-export package at build
  • Loading branch information
INeedJobToStartWork committed Nov 4, 2024
1 parent 4f04fe2 commit 85d4473
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 28 deletions.
4 changes: 3 additions & 1 deletion config/tsuprc/tsup.prod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { copy } from "esbuild-plugin-copy";
import noInternalExportsPlugin from "@esplugins/no-internal-exports";
import config from "./tsup.base";
import { defineConfig } from "tsup";

Expand All @@ -19,6 +20,7 @@ export default defineConfig({
{ from: "./.npmignore", to: "./.npmignore" },
{ from: "./README.md", to: "./README.md" }
]
})
}),
noInternalExportsPlugin
]
});
3 changes: 2 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ export default ineedj({
}).removeRules(
"@typescript-eslint/no-throw-literal" /** Use custom Error */,
"@EslintSecurity/detect-object-injection",
"MD010/no-hard-tabs"
"MD010/no-hard-tabs",
"@EslintTSDocs/syntax"
);
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
},
"devDependencies": {
"@changesets/cli": "^2.27.8",
"@esplugins/no-internal-exports": "^1.0.0",
"@ineedj/eslintrc": "^1.2.2",
"@ineedj/prettierrc": "^2.0.0",
"@ineedj/tsconfig": "^1.0.0",
Expand Down
93 changes: 86 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/functions/myErrorHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { myError, myErrorWrapperAsync } from "@/functions";
import type { TMyErrorList } from "@/types";

/** @internal */
const ErrorList = {
noKeyInList: {
code: "EH001",
Expand Down
15 changes: 0 additions & 15 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,2 @@
export * from "@/functions";
export * from "@/types";
// export type {
// TMyErrorList,
// IMyError,
// IMyErrorAPI,
// IMyErrorRateLimit,
// IMyErrorValidation,
// TCauseError,
// TDetails,
// TBaseError,
// TBaseErrorExt,
// TValidationError,
// TApiError,
// TApiRateLimit,
// TAllMyErrorTypes
// } from "@/types";
11 changes: 9 additions & 2 deletions src/types/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import type { IMyError, TMyErrorList } from "@/types";
* `any` - But only allowed in development.
* @internal
*/
export type TODO = any; // eslint-disable-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type TODO = any;
/**
* @internal
* @dontexport
*/
export type Prettify<T> = {
[K in keyof T]: NonNullable<T[K]>;
};

/** @dontexport */
export type arrowFunction<T extends (...arguments_: Parameters<T>) => ReturnType<T>> = (
...arguments_: Parameters<T>
) => ReturnType<T>;
Expand All @@ -24,8 +26,11 @@ export type ErrorTypesCatched =
| SyntaxErrorConstructor
| TypeErrorConstructor;

/** @dontexport */
export type TDataReturn<T> = [T, false];
/** @dontexport */
export type TErrorReturn<CustomError = NonNullable<unknown>> = [CustomError & IMyError, true];
/** @dontexport */
export type TFunctionReturn<T> = Prettify<TDataReturn<T>> | Prettify<TErrorReturn>;

// export type TMyErrorList<CustomError = NonNullable<unknown>> = Record<string, Required<IMyError<CustomError>>>;
Expand All @@ -43,4 +48,6 @@ export type TMyHandler<
// [K in T[keyof T]["code"]]: (...args: K[]) => TFunctionReturn<unknown>;
// }>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
/** @dontexport */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type NoInfer<T> = [T][T extends any ? 0 : never];
3 changes: 2 additions & 1 deletion src/utils/isPromise.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @internal */
// eslint-disable-next-line @typescript-eslint/ban-types
export function isPromise(value: Function): Boolean {
export function isPromise(value: Function): boolean {
return value.constructor.name == "AsyncFuncton";
}
export default isPromise;
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"baseUrl": "./src",
"paths": {
"@/*": ["*", "*/index.ts", "*.ts"]
}
},
"stripInternal": true
},
"extends": "@ineedj/tsconfig/base.json"
}

0 comments on commit 85d4473

Please sign in to comment.