Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
fix(sticky-turbo): do not hard code path separator (#154)
Browse files Browse the repository at this point in the history
#### What this PR does / why we need it:

Do not hard code path separator and use `sep from node:path`.

#### Which issue(s) will this PR fix?:

Fixes #93
  • Loading branch information
fuxingloh authored Jun 4, 2023
1 parent df5cb38 commit 00cfafb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/sticky-turbo/src/Turbo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { spawnSync, SpawnSyncReturns, StdioOptions } from 'node:child_process';
import { existsSync, readFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { dirname, join, sep } from 'node:path';

import { PackageJson } from './PackageJson';

Expand Down Expand Up @@ -184,10 +184,10 @@ export class Turbo {
* @param depth {number} on how far up to search
*/
export function findRootTurboJsonPath(cwd: string, depth: number = 4): string | undefined {
const paths = cwd.split('/');
const paths = cwd.split(sep);

for (let i = 0; i < depth; i += 1) {
const path = `${paths.join('/')}/turbo.json`;
const path = `${paths.join(sep)}/turbo.json`;
if (existsSync(path)) {
const object = JSON.parse(readFileSync(path, { encoding: 'utf-8' }));
if (!object.extends?.includes('//')) {
Expand Down

0 comments on commit 00cfafb

Please sign in to comment.