Skip to content

Commit 9e36d8e

Browse files
committed
Remove regex and adjust path
1 parent c612aab commit 9e36d8e

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

packages/cli/src/command-helpers/network.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import yaml from 'yaml';
66
import { initNetworksConfig, updateSubgraphNetwork } from './network.js';
77

88
const SUBGRAPH_PATH_BASE = path.join(
9-
`${process.platform === 'win32' ? '' : '/'}${/file:\/{2,3}(.+)\/[^/]/.exec(fileURLToPath(import.meta.url))![1]}`,
9+
`${process.platform === 'win32' ? '' : '/'}${fileURLToPath(import.meta.url)}`,
10+
'..',
1011
'..',
1112
'..',
1213
'..',

packages/cli/src/commands/local.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,8 @@ export default class LocalCommand extends Command {
9494
const composeFile =
9595
composeFileFlag ||
9696
path.join(
97-
`${process.platform === 'win32' ? '' : '/'}${
98-
/file:\/{2,3}(.+)\/[^/]/.exec(fileURLToPath(import.meta.url))![1]
99-
}`,
97+
`${process.platform === 'win32' ? '' : '/'}${fileURLToPath(import.meta.url)}`,
98+
'..',
10099
'..',
101100
'..',
102101
'resources',

packages/cli/src/subgraph.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ export default class Subgraph {
5454
const schema = graphql.parse(
5555
await fs.readFile(
5656
path.join(
57-
`${process.platform === 'win32' ? '' : '/'}${/file:\/{2,3}(.+)\/[^/]/.exec(fileURLToPath(import.meta.url))![1]}`,
57+
`${process.platform === 'win32' ? '' : '/'}${fileURLToPath(import.meta.url)}`,
58+
'..',
5859
'protocols',
5960
// TODO: substreams/triggers is a special case, should be handled better
6061
protocol.name === 'substreams/triggers' ? 'substreams' : protocol.name,

packages/cli/src/version.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ const packageJson = JSON.parse(
77
.readFileSync(
88
// works even when bundled/built because the path to package.json is the same
99
path.join(
10-
`${process.platform === 'win32' ? '' : '/'}${/file:\/{2,3}(.+)\/[^/]/.exec(fileURLToPath(import.meta.url))![1]}`,
10+
`${process.platform === 'win32' ? '' : '/'}${fileURLToPath(import.meta.url)}`,
11+
'..',
1112
'..',
1213
'package.json',
1314
),

0 commit comments

Comments
 (0)