From acb0b4f1950c3c37d9bfccc33fa36287d4bfa59f Mon Sep 17 00:00:00 2001 From: Joakim Carlstein Date: Fri, 24 Nov 2023 15:55:32 +0100 Subject: [PATCH] fix(new): keep upper cased letters in migration file names by default --- .changeset/slimy-jars-know.md | 5 +++++ packages/plugin-tools/src/index.test.ts | 4 ++-- packages/plugin-tools/src/index.ts | 3 +-- 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 .changeset/slimy-jars-know.md diff --git a/.changeset/slimy-jars-know.md b/.changeset/slimy-jars-know.md new file mode 100644 index 0000000..646e2b6 --- /dev/null +++ b/.changeset/slimy-jars-know.md @@ -0,0 +1,5 @@ +--- +'@emigrate/plugin-tools': patch +--- + +Keep upper cased letters in migration file names by default diff --git a/packages/plugin-tools/src/index.test.ts b/packages/plugin-tools/src/index.test.ts index 99b3466..f071501 100644 --- a/packages/plugin-tools/src/index.test.ts +++ b/packages/plugin-tools/src/index.test.ts @@ -32,7 +32,7 @@ describe('sanitizeMigrationName', () => { assert.strictEqual(sanitizeMigrationName('foo_? :*<>'), 'foo'); }); - it('should lower case the filename', () => { - assert.strictEqual(sanitizeMigrationName('Are you, Foo?'), 'are_you_foo'); + it('should keep upper cased letters in the filename', () => { + assert.strictEqual(sanitizeMigrationName('Are you, Foo?'), 'Are_you_Foo'); }); }); diff --git a/packages/plugin-tools/src/index.ts b/packages/plugin-tools/src/index.ts index 10479e6..9cfb4da 100644 --- a/packages/plugin-tools/src/index.ts +++ b/packages/plugin-tools/src/index.ts @@ -215,5 +215,4 @@ export const sanitizeMigrationName = (name: string) => name .replaceAll(/[\W/\\:|*?'"<>_]+/g, '_') .trim() - .replace(/^_|_$/, '') - .toLocaleLowerCase(); + .replace(/^_|_$/, '');