Skip to content

Commit 7dc368d

Browse files
committed
chore: export splitNameAndExtension
1 parent 238de88 commit 7dc368d

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

packages/openapi-ts/src/generate/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { getClientPlugin } from '../plugins/@hey-api/client-core/utils';
99
import type { DefinePlugin } from '../plugins/types';
1010
import type { ImportExportItemObject } from '../tsc/utils';
1111
import type { Config } from '../types/config';
12-
import { _test } from './file';
12+
import { splitNameAndExtension } from './file';
1313
import { ensureDirSync, relativeModulePath } from './utils';
1414

1515
// Use require.resolve to find the package root, then construct the path
@@ -121,7 +121,7 @@ const infixDotGenToFiles = (outputPath: string) => {
121121
for (const file of coreFiles) {
122122
const filePath = path.resolve(outputPath, file);
123123
if (file !== 'index.ts') {
124-
const { extension, name } = _test.splitNameAndExtension(filePath);
124+
const { extension, name } = splitNameAndExtension(filePath);
125125
const newFilePath = path.resolve(
126126
outputPath,
127127
[name, 'gen', extension].filter(Boolean).join('.'),

packages/openapi-ts/src/generate/file/__tests__/file.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { describe, expect, it } from 'vitest';
22

3-
import { _test } from '../index';
3+
import { _test, splitNameAndExtension } from '../index';
44
import type { Identifiers } from '../types';
55

6-
const { ensureUniqueIdentifier, parseRef, splitNameAndExtension } = _test;
6+
const { ensureUniqueIdentifier, parseRef } = _test;
77

88
describe('parseRef', () => {
99
it('should parse simple ref without properties', () => {

packages/openapi-ts/src/generate/file/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ const ensureUniqueIdentifier = ({
647647
};
648648
};
649649

650-
const splitNameAndExtension = (fileName: string) => {
650+
export const splitNameAndExtension = (fileName: string) => {
651651
const match = fileName.match(/\.[0-9a-z]+$/i);
652652
const extension = match ? match[0].slice(1) : '';
653653
const name = fileName.slice(
@@ -660,5 +660,4 @@ const splitNameAndExtension = (fileName: string) => {
660660
export const _test = {
661661
ensureUniqueIdentifier,
662662
parseRef,
663-
splitNameAndExtension,
664663
};

0 commit comments

Comments
 (0)