Skip to content

Commit

Permalink
fix: rename from file-paths to patha
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Aug 19, 2022
1 parent 62bbf0a commit 3101e38
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 47 deletions.
35 changes: 15 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!-- Generated via running `pnpm run docs` -->

<h1 align="center">file-paths</h1>
<h1 align="center">patha</h1>
<p>
<a href="https://github.com/aminya/file-paths/actions/workflows/CI.yml" target="_blank">
<img alt="CI" src="https://github.com/aminya/file-paths/actions/workflows/CI.yml/badge.svg">
<a href="https://github.com/aminya/patha/actions/workflows/CI.yml" target="_blank">
<img alt="CI" src="https://github.com/aminya/patha/actions/workflows/CI.yml/badge.svg">
</a>
<img alt="Version" src="https://img.shields.io/badge/version-0.1.0-blue.svg?cacheSeconds=2592000" />
<img src="https://img.shields.io/badge/node-%3E%3D12.x-blue.svg" />
Expand All @@ -20,26 +20,21 @@

- [Install](#install)
- [Usage](#usage)
- [`addNamePrefix` (function)](#addnameprefix-function)
- [`addNameSuffix` (function)](#addnamesuffix-function)
- [`normalizeTrim` (function)](#normalizetrim-function)
- [`name` (function)](#name-function)
- [`removeExt` (function)](#removeext-function)
- [🤝 Contributing](#contributing)

<!-- /code_chunk_output -->

## Install

```sh
npm install --save file-paths
npm install --save patha
```

`file-paths` is tiny and treeshakable.
`patha` is tiny and treeshakable.

## Usage

`file-paths` is a drop-replacement for `path`, which is explained in [the Nodejs documentation](https://nodejs.org/api/path.html).
`patha` is a drop-replacement for `path`, which is explained in [the Nodejs documentation](https://nodejs.org/api/path.html).

```js
import {
Expand All @@ -58,13 +53,13 @@ import {
sep,
toNamespacedPath,
win32,
} from "file-paths"
} from "patha"
```

Additionally, `file-paths` supports the following functions:
Additionally, `patha` supports the following functions:

```js
import { addNamePrefix, addNameSuffix, normalizeTrim, name, removeExt } from "file-paths"
import { addNamePrefix, addNameSuffix, normalizeTrim, name, removeExt } from "patha"
```

<!-- INSERT GENERATED DOCS START -->
Expand All @@ -81,7 +76,7 @@ Adds a prefix to the start of the name of the given path
**returns:** string

```js
import { addNamePrefix } from "file-paths"
import { addNamePrefix } from "patha"

addNamePrefix("path/to/file-name.ext", "new-") // gives "path/to/new-file-name.ext"
```
Expand All @@ -98,7 +93,7 @@ Adds a suffix to the end of the name of the given path
**returns:** string

```js
import { addNameSuffix } from "file-paths"
import { addNameSuffix } from "patha"

addNameSuffix("path/to/file-name.ext", "-old") // gives "path/to/file-name-old.ext"

Expand All @@ -116,7 +111,7 @@ Normalizes the path and removes the trailing slashes.
**returns:** string

```js
import { normalize, normalizeTrim } from "file-paths"
import { normalize, normalizeTrim } from "patha"

normalizeTrim("/foo/bar//baz/asdf/hello/../") // gives "/foo/bar/baz/asdf"

Expand All @@ -137,7 +132,7 @@ By default the file extension is included in the returned name. To remove the ex
**returns:** string

```js
import { name } from "file-paths"
import { name } from "patha"

name("path/to/file.md") // gives "file.md"

Expand All @@ -155,7 +150,7 @@ Remove a path's extension.
**returns:** string

```js
import { removeExt } from "file-paths"
import { removeExt } from "patha"
removeExt("some/dir/file.ext") // gives "some/dir/file"
```

Expand All @@ -168,4 +163,4 @@ You can sponsor my work here:
https://github.com/sponsors/aminya

Pull requests, issues and feature requests are welcome.
See the [Contributing guide](https://github.com/aminya/file-paths/blob/master/CONTRIBUTING.md).
See the [Contributing guide](https://github.com/aminya/patha/blob/master/CONTRIBUTING.md).
3 changes: 2 additions & 1 deletion cspell.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ ignorePaths:
- dist/
- dev/cpp_vcpkg_project
words:
- posix
- aarch
- aminya
- applellvm
Expand Down Expand Up @@ -59,7 +58,9 @@ words:
- npmrc
- Opencppcoverage
- OSSDK
- patha
- pnpm
- posix
- pwsh
- pypy
- setupcpp
Expand Down
16 changes: 8 additions & 8 deletions dev/docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<h1 align="center"><%= projectName %></h1>
<p>
<a href="https://github.com/aminya/file-paths/actions/workflows/CI.yml" target="_blank">
<img alt="CI" src="https://github.com/aminya/file-paths/actions/workflows/CI.yml/badge.svg">
<a href="https://github.com/aminya/patha/actions/workflows/CI.yml" target="_blank">
<img alt="CI" src="https://github.com/aminya/patha/actions/workflows/CI.yml/badge.svg">
</a>
<% if (isProjectOnNpm) { -%>
<a href="https://www.npmjs.com/package/<%= projectName %>" target="_blank">
Expand Down Expand Up @@ -60,11 +60,11 @@
npm install --save <%= projectName %>
```

`file-paths` is tiny and treeshakable.
`patha` is tiny and treeshakable.

## Usage

`file-paths` is a drop-replacement for `path`, which is explained in [the Nodejs documentation](https://nodejs.org/api/path.html).
`patha` is a drop-replacement for `path`, which is explained in [the Nodejs documentation](https://nodejs.org/api/path.html).

```js
import {
Expand All @@ -83,13 +83,13 @@ import {
sep,
toNamespacedPath,
win32,
} from "file-paths"
} from "patha"
```

Additionally, `file-paths` supports the following functions:
Additionally, `patha` supports the following functions:

```js
import { addNamePrefix, addNameSuffix, normalizeTrim, name, removeExt } from "file-paths"
import { addNamePrefix, addNameSuffix, normalizeTrim, name, removeExt } from "patha"
```

<!-- INSERT GENERATED DOCS START -->
Expand All @@ -103,4 +103,4 @@ You can sponsor my work here:
https://github.com/sponsors/aminya

Pull requests, issues and feature requests are welcome.
See the [Contributing guide](https://github.com/aminya/file-paths/blob/master/CONTRIBUTING.md).
See the [Contributing guide](https://github.com/aminya/patha/blob/master/CONTRIBUTING.md).
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "file-paths",
"name": "patha",
"version": "0.1.0",
"description": "File paths library. All you need to work with paths. drop-in replacement for Nodejs 'path'. Tiny and tree-shakable.",
"repository": "https://github.com/aminya/file-paths",
"repository": "https://github.com/aminya/patha",
"license": "Apache-2.0",
"author": "Amin Yahyaabadi",
"exports": {
Expand Down Expand Up @@ -33,7 +33,7 @@
"lint.cspell": "cspell lint --no-progress --show-suggestions",
"lint.eslint": "eslint **/*.{ts,tsx,js,jsx,cjs,mjs,json,yaml} --no-error-on-unmatched-pattern --cache --cache-location ./.cache/eslint/ --fix",
"lint.prettier": "prettier --write .",
"prepare": "run-s build docs",
"prepare": "run-s build",
"test": "run-p --continue-on-error test.lint test.unit test.integration",
"test.integration": "run-s build && node ./test/integration.mjs && node ./test/integration.js",
"test.lint": "run-p --aggregate-output --continue-on-error lint.cspell test.lint.eslint test.lint.prettier",
Expand Down
10 changes: 1 addition & 9 deletions pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion src/add-name-prefix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { basename, dirname, extname, join } from "path"
* @example
*
* ```js
* import { addNamePrefix } from "file-paths"
* import { addNamePrefix } from "patha"
*
* addNamePrefix("path/to/file-name.ext", "new-") // gives "path/to/new-file-name.ext"
* ```
Expand Down
2 changes: 1 addition & 1 deletion src/add-name-suffix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { basename, dirname, extname, join } from "path"
* @example
*
* ```js
* import { addNameSuffix } from "file-paths"
* import { addNameSuffix } from "patha"
*
* addNameSuffix("path/to/file-name.ext", "-old") // gives "path/to/file-name-old.ext"
*
Expand Down
2 changes: 1 addition & 1 deletion src/name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { basename, extname } from "path"
* @example
*
* ```js
* import { name } from "file-paths"
* import { name } from "patha"
*
* name("path/to/file.md") // gives "file.md"
*
Expand Down
2 changes: 1 addition & 1 deletion src/normalize-trim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import escapeRegexp from "escape-string-regexp"
* @example
*
* ```js
* import { normalize, normalizeTrim } from "file-paths"
* import { normalize, normalizeTrim } from "patha"
*
* normalizeTrim("/foo/bar//baz/asdf/hello/../") // gives "/foo/bar/baz/asdf"
*
Expand Down
2 changes: 1 addition & 1 deletion src/path.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare module "file-paths" {
declare module "patha" {
import path = require("path")
export = path
}
2 changes: 1 addition & 1 deletion src/remove-ext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { extname } from "path"
* @example
*
* ```js
* import { removeExt } from "file-paths"
* import { removeExt } from "patha"
* removeExt("some/dir/file.ext") // gives "some/dir/file"
* ```
*
Expand Down

0 comments on commit 3101e38

Please sign in to comment.