Add a src/tools dir to show exports

This commit is contained in:
garronej 2023-05-21 10:14:54 +02:00
parent a05c843d46
commit 16dbde73a5
3 changed files with 13 additions and 2 deletions

View file

@ -6,8 +6,6 @@
"type": "git", "type": "git",
"url": "git://github.com/#{USER_OR_ORG}#/#{REPO_NAME}#.git" "url": "git://github.com/#{USER_OR_ORG}#/#{REPO_NAME}#.git"
}, },
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": { "scripts": {
"test": "echo DODO", "test": "echo DODO",
"build": "tsc", "build": "tsc",
@ -18,6 +16,13 @@
"format:check": "npm run _format -- --list-different", "format:check": "npm run _format -- --list-different",
"link-in-app": "ts-node --skipProject scripts/link-in-app.ts" "link-in-app": "ts-node --skipProject scripts/link-in-app.ts"
}, },
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": "./dist/index.js",
"./*": "./dist/*.js",
"./tools": "./dist/tools/index.js"
},
"lint-staged": { "lint-staged": {
"*.{ts,tsx}": [ "*.{ts,tsx}": [
"eslint --fix" "eslint --fix"

5
src/tools/capitalize.ts Normal file
View file

@ -0,0 +1,5 @@
/** @see <https://docs.tsafe.dev/capitalize> */
export function capitalize<S extends string>(str: S): Capitalize<S> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return (str.charAt(0).toUpperCase() + str.slice(1)) as any;
}

1
src/tools/index.ts Normal file
View file

@ -0,0 +1 @@
export * from "./capitalize";