Skip to content

Commit bd82fb7

Browse files
committed
fix: use unix slash for index file paths and names
1 parent 21bcddc commit bd82fb7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/code_transformer/main.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
*/
99

1010
import { fileURLToPath } from 'node:url'
11-
import { basename, dirname, join, relative } from 'node:path'
1211
import string from '@poppinss/utils/string'
1312
import { isScriptFile } from '@poppinss/utils'
1413
import { fsReadAll } from '@poppinss/utils/fs'
1514
import { mkdir, writeFile } from 'node:fs/promises'
1615
import { type OneOrMore } from '@poppinss/utils/types'
1716
import StringBuilder from '@poppinss/utils/string_builder'
17+
import { basename, dirname, join, relative } from 'node:path'
1818
import { installPackage, detectPackageManager } from '@antfu/install-pkg'
1919
import {
2020
Node,
@@ -26,13 +26,13 @@ import {
2626
type FormatCodeSettings,
2727
} from 'ts-morph'
2828

29+
import debug from '../debug.ts'
2930
import { RcFileTransformer } from './rc_file_transformer.ts'
3031
import type {
3132
MiddlewareNode,
3233
EnvValidationNode,
3334
BouncerPolicyNode,
3435
} from '../types/code_transformer.ts'
35-
import debug from '../debug.ts'
3636

3737
/**
3838
* This class is responsible for updating
@@ -511,14 +511,14 @@ export class CodeTransformer {
511511
})
512512

513513
return filesList.map((filePath) => {
514-
const name = new StringBuilder(relative(sourcePath, filePath))
514+
const name = new StringBuilder(string.toUnixSlash(relative(sourcePath, filePath)))
515515
.removeExtension()
516516
.pascalCase()
517517
.toString()
518518

519519
const importPath = importAlias
520-
? `${importAlias}/${new StringBuilder(relative(sourcePath, filePath)).removeExtension().toString()}`
521-
: relative(outputDir, filePath)
520+
? `${importAlias}/${new StringBuilder(string.toUnixSlash(relative(sourcePath, filePath))).removeExtension().toString()}`
521+
: string.toUnixSlash(relative(outputDir, filePath))
522522

523523
return {
524524
name: output.transformName?.(name) ?? name,

0 commit comments

Comments
 (0)