Skip to content

Commit 05ece3e

Browse files
committed
fix: use path.sep for better windows compatibility
1 parent 7ec4317 commit 05ece3e

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

packages/create-react-native-library/src/input.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ export async function createQuestions({
206206
name: 'directory',
207207
message: `Where do you want to create the library?`,
208208
initial: (_, answers) => {
209-
if ((answers.local ?? local) && name && !name?.includes('/')) {
210-
return `modules/${name}`;
209+
if ((answers.local ?? local) && name && !name?.includes(path.sep)) {
210+
return path.join('modules', name);
211211
}
212212

213213
return name ?? '';

packages/create-react-native-library/src/template.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export function generateTemplateConfiguration({
129129
.replace(/[^a-z0-9](\w)/g, (_, $1: string) => $1.toUpperCase())
130130
.slice(1)}`,
131131
package: pack,
132-
package_dir: pack.replace(/\./g, '/'),
132+
package_dir: pack.replace(/\./g, path.sep),
133133
package_cpp: pack.replace(/\./g, '_'),
134134
identifier: slug.replace(/[^a-z0-9]+/g, '-').replace(/^-/, ''),
135135
native: languages !== 'js',

packages/react-native-builder-bob/src/targets/codegen/patches/patchCodegenAndroidPackage.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ export async function patchCodegenAndroidPackage(
7676

7777
const newPackagePath = path.resolve(
7878
codegenAndroidPath,
79-
`java/${codegenJavaPackageName.replace(/\./g, '/')}`
79+
'java',
80+
codegenJavaPackageName.replace(/\./g, path.sep)
8081
);
8182

8283
if (!(await fs.pathExists(newPackagePath))) {

packages/react-native-builder-bob/src/targets/typescript.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ export default async function build({
105105
}
106106
} else {
107107
const execpath = process.env.npm_execpath;
108-
const cli = execpath?.split('/').pop()?.includes('yarn') ? 'yarn' : 'npm';
108+
const cli = execpath?.split(path.sep).pop()?.includes('yarn')
109+
? 'yarn'
110+
: 'npm';
109111

110112
if (cli === 'yarn') {
111113
const result = await spawn('yarn', ['bin', 'tsc'], {

0 commit comments

Comments
 (0)