feat: new path util package

This commit is contained in:
2025-09-16 23:17:19 +00:00
parent 68ca8cbccd
commit 691798c56d
5 changed files with 95 additions and 0 deletions

34
packages/path/.gitignore vendored Normal file
View File

@@ -0,0 +1,34 @@
# dependencies (bun install)
node_modules
# output
out
dist
*.tgz
# code coverage
coverage
*.lcov
# logs
logs
_.log
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# caches
.eslintcache
.cache
*.tsbuildinfo
# IntelliJ based IDEs
.idea
# Finder (MacOS) folder config
.DS_Store

15
packages/path/README.md Normal file
View File

@@ -0,0 +1,15 @@
# @fileone/path
To install dependencies:
```bash
bun install
```
To run:
```bash
bun run index.ts
```
This project was created using `bun init` in bun v1.2.22. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.

9
packages/path/index.ts Normal file
View File

@@ -0,0 +1,9 @@
export const PATH_SEPARATOR = "/"
export function baseName(path: string): string {
return path.split(PATH_SEPARATOR).pop() ?? ""
}
export function joinPath(...paths: string[]): string {
return paths.join(PATH_SEPARATOR)
}

View File

@@ -0,0 +1,8 @@
{
"name": "@fileone/path",
"module": "index.ts",
"type": "module",
"peerDependencies": {
"typescript": "^5"
}
}

View File

@@ -0,0 +1,29 @@
{
"compilerOptions": {
// Environment setup & latest features
"lib": ["ESNext"],
"target": "ESNext",
"module": "Preserve",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,
// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
}
}