Skip to content

Commit

Permalink
fix(deps): update dependency change-case to v5 (#176)
Browse files Browse the repository at this point in the history
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [change-case](https://togithub.com/blakeembrey/change-case/tree/master/packages/change-case#readme) ([source](https://togithub.com/blakeembrey/change-case)) | [`4.1.2` -> `5.3.0`](https://renovatebot.com/diffs/npm/change-case/4.1.2/5.3.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/change-case/5.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/change-case/5.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/change-case/4.1.2/5.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/change-case/4.1.2/5.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>blakeembrey/change-case (change-case)</summary>

### [`v5.3.0`](https://togithub.com/blakeembrey/change-case/releases/tag/change-case%405.3.0): Add `suffixCharacters` option

[Compare Source](https://togithub.com/blakeembrey/change-case/compare/[email protected]@5.3.0)

**Added**

-   New `suffixCharacters` option to retain characters during case conversion. Useful for retaining something like the `_` in `type_`. Closes [https:/blakeembrey/change-case/issues/322](https://togithub.com/blakeembrey/change-case/issues/322).

### [`v5.2.0`](https://togithub.com/blakeembrey/change-case/releases/tag/change-case%405.2.0): New `delimiter` and `mergeAmbiguousCharacters` options

[Compare Source](https://togithub.com/blakeembrey/change-case/compare/[email protected])

**Added**

-   Add `delimiter` option for customizing join character in any change case method
-   Add `mergeAmbiguousCharacters` for camel and pascal case to avoid prefixing `_` before numbers

### [`v5.1.2`](https://togithub.com/blakeembrey/change-case/compare/[email protected])

[Compare Source](https://togithub.com/blakeembrey/change-case/compare/[email protected])

### [`v5.1.1`](https://togithub.com/blakeembrey/change-case/compare/[email protected]@5.1.1)

[Compare Source](https://togithub.com/blakeembrey/change-case/compare/[email protected]@5.1.1)

### [`v5.1.0`](https://togithub.com/blakeembrey/change-case/releases/tag/change-case%405.1.0): Add `prefixCharacters` option

[Compare Source](https://togithub.com/blakeembrey/change-case/compare/[email protected])

**Added**

-   New `prefixCharacters` option to retain characters during case conversion. Useful for something like `_$` to keep "private".

### [`v5.0.2`](https://togithub.com/blakeembrey/change-case/compare/0d8e4d9e2dbb0e60eda50a5deafd57b4d227ef60...8d3793fa2fc1646c4c2e1fba036681a42f8cdab9)

[Compare Source](https://togithub.com/blakeembrey/change-case/compare/0d8e4d9e2dbb0e60eda50a5deafd57b4d227ef60...8d3793fa2fc1646c4c2e1fba036681a42f8cdab9)

### [`v5.0.1`](https://togithub.com/blakeembrey/change-case/compare/[email protected])

[Compare Source](https://togithub.com/blakeembrey/change-case/compare/[email protected])

### [`v5.0.0`](https://togithub.com/blakeembrey/change-case/releases/tag/change-case%405.0.0): Huge ESM rewrite

[Compare Source](https://togithub.com/blakeembrey/change-case/compare/[email protected]@5.0.0)

**Changed:**

-   The package is now only supported using ESM imports in node.js
-   Merged all core case changing libraries into `change-case`
-   Added support for internationalization using unicode regex features
-   Renamed `paramCase` to `kebabCase`

**Removed:**

-   Removed ability to specify word split and strip regexes

**Added:**

-   Exposed a new `split` function for accessing behavior of word splitting before case change
-   Added `locale` and `separateNumbers` options
-   Added `pascalSnakeCase` support
-   Added `change-case/keys` for transforming objects into the requested case

**Deprecated packages:**

-   `camel-case` (use `change-case`)
-   `capital-case` (use `change-case`)
-   `constant-case` (use `change-case`)
-   `dot-case` (use `change-case`)
-   `header-case` (use `change-case` -> `trainCase`)
-   `is-lower-case` (prefer manual: `input.toLocaleLowerCase(locale) === input`)
-   `is-upper-case` (prefer manual: `input.toLocaleUpperCase(locale) === input`)
-   `lower-case-first` (prefer manual: `input.charAt(0).toLowerCase() + input.slice(1)`)
-   `lower-case` (prefer manual: `input.toLowerCase()` or `input.toLocaleLowerCase(locale)`)
-   ` no-case (use  `change-case\`)
-   `param-case` (use `change-case` -> `kebabCase`)
-   `pascal-case` (use `change-case`)
-   `path-case` (use `change-case`)
-   `sentence-case` (use `change-case`)
-   `snake-case` (use `change-case`)
-   `upper-case-first` (prefer manual: `input.charAt(0).toLowerCase() + input.slice(1)`)
-   `upper-case` (prefer manual: `input.toUpperCase()` or `input.toLocaleUpperCase(locale)`)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 3pm on Friday" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/hoonoh/ts-pg-model).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjMiLCJ1cGRhdGVkSW5WZXIiOiIzNy44MS4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: hoonoh <[email protected]>

BREAKING CHANGE: configuration changed due to change-case v5
  • Loading branch information
renovate[bot] authored Dec 12, 2023
1 parent ad87ff5 commit 63a3bcb
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 196 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,21 @@ export type ChangeCase =
| 'capitalCase'
| 'constantCase'
| 'dotCase'
| 'headerCase'
| 'kebabCase'
| 'noCase'
| 'paramCase'
| 'pascalCase'
| 'pathCase'
| 'sentenceCase'
| 'snakeCase'
| 'trainCase'
| 'keep';

const config: UserConfig = {
conventions: {
schemas: 'camelCase',
columns: 'keep',
types: 'camelCase',
paths: 'paramCase',
paths: 'kebabCase',
},
};
```
Expand All @@ -95,7 +95,7 @@ Enum type code conventions are applied to Enum member names. Defaults to `camelC

#### Paths and filename conventions

Generated file paths and filename conventions. Defaults to `paramCase`.
Generated file paths and filename conventions. Defaults to `kebabCase`.

### Selecting targets

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
},
"dependencies": {
"chalk": "5.3.0",
"change-case": "4.1.2",
"change-case": "5.3.0",
"dotenv": "16.3.1",
"esbuild": "0.19.9",
"lodash-es": "4.17.21",
Expand Down
30 changes: 15 additions & 15 deletions src/config/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import {
capitalCase,
constantCase,
dotCase,
headerCase,
kebabCase,
noCase,
paramCase,
pascalCase,
pathCase,
sentenceCase,
snakeCase,
trainCase,
} from 'change-case';
import { DeepRequired } from 'ts-essentials';
import z from 'zod';
Expand All @@ -31,27 +31,27 @@ export type ChangeCase =
| 'capitalCase'
| 'constantCase'
| 'dotCase'
| 'headerCase'
| 'kebabCase'
| 'noCase'
| 'paramCase'
| 'pascalCase'
| 'pathCase'
| 'sentenceCase'
| 'snakeCase'
| 'trainCase'
| 'keep';

export const changeCaseMap: Record<ChangeCase, (input: string) => string> = {
camelCase: camelCase,
capitalCase: capitalCase,
constantCase: constantCase,
dotCase: dotCase,
headerCase: headerCase,
noCase: noCase,
paramCase: paramCase,
pascalCase: pascalCase,
pathCase: pathCase,
sentenceCase: sentenceCase,
snakeCase: snakeCase,
camelCase,
capitalCase,
constantCase,
dotCase,
kebabCase,
noCase,
pascalCase,
pathCase,
sentenceCase,
snakeCase,
trainCase,
keep: (input: string) => input,
} as const;

Expand Down
2 changes: 1 addition & 1 deletion src/config/validators/user-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ export const validateUserConfig = async ({
schemas: changeCaseMap[conventions?.schemas || 'camelCase'],
columns: changeCaseMap[conventions?.columns || 'keep'],
types: changeCaseMap[conventions?.types || 'camelCase'],
paths: changeCaseMap[conventions?.paths || 'paramCase'],
paths: changeCaseMap[conventions?.paths || 'kebabCase'],
},
schemas: Object.keys(renderTargets),
renderTargets,
Expand Down
4 changes: 2 additions & 2 deletions src/generators/barrel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { paramCase, pascalCase } from 'change-case';
import { kebabCase, pascalCase } from 'change-case';
import { lstatSync } from 'fs';
import { readdir } from 'fs/promises';
import { resolve } from 'path';
Expand All @@ -25,7 +25,7 @@ export const generateBarrel: FileGenerator = async (config: Config) => {

await Promise.all(
files.map(async filename => {
const filenameNormalize = paramCase(filename.split('.').shift() || '');
const filenameNormalize = kebabCase(filename.split('.').shift() || '');
if (
// enum type file
filenameNormalize === 'enum-types' &&
Expand Down
14 changes: 7 additions & 7 deletions src/generators/helpers/change-case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import {
capitalCase,
constantCase,
dotCase,
headerCase,
kebabCase,
noCase,
paramCase,
pascalCase,
pathCase,
sentenceCase,
snakeCase,
trainCase,
} from 'change-case';

import { ChangeCase } from '../../config/types/config.js';
Expand All @@ -29,15 +29,12 @@ export const changeCase = (input: string, caseType?: ChangeCase) => {
case 'dotCase':
rtn = dotCase(input);
break;
case 'headerCase':
rtn = headerCase(input);
case 'kebabCase':
rtn = kebabCase(input);
break;
case 'noCase':
rtn = noCase(input);
break;
case 'paramCase':
rtn = paramCase(input);
break;
case 'pascalCase':
rtn = pascalCase(input);
break;
Expand All @@ -50,6 +47,9 @@ export const changeCase = (input: string, caseType?: ChangeCase) => {
case 'snakeCase':
rtn = snakeCase(input);
break;
case 'trainCase':
rtn = trainCase(input);
break;
default:
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Generated by [AVA](https://avajs.dev).
connectionURI: 'postgresql://postgres:secretpassword@localhost:54321/postgres',
conventions: {
columns: Function keep {},
paths: Function paramCase {},
paths: Function kebabCase {},
schemas: Function camelCase {},
types: Function camelCase {},
},
Expand Down
Binary file not shown.
Loading

0 comments on commit 63a3bcb

Please sign in to comment.