-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: ensure only files in package directories are considered
- Loading branch information
Showing
3 changed files
with
54 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
/* eslint-disable no-await-in-loop */ | ||
|
||
import { existsSync } from 'node:fs'; | ||
import { readFile } from 'node:fs/promises'; | ||
import { resolve } from 'node:path'; | ||
|
||
import { SfdxProject } from './types.js'; | ||
import { getRepoRoot } from './getRepoRoot.js'; | ||
|
||
export async function getPackageDirectories(): Promise<{ repoRoot: string; packageDirectories: string[] }> { | ||
const repoRoot = await getRepoRoot(); | ||
const dxConfigFilePath = resolve(repoRoot, 'sfdx-project.json'); | ||
if (!existsSync(dxConfigFilePath)) { | ||
throw Error(`Cannot find sfdx-project.json in the root folder: ${repoRoot}`); | ||
} | ||
|
||
const sfdxProjectRaw: string = await readFile(dxConfigFilePath, 'utf-8'); | ||
const sfdxProject: SfdxProject = JSON.parse(sfdxProjectRaw) as SfdxProject; | ||
const packageDirectories = sfdxProject.packageDirectories.map((directory) => directory.path); | ||
return { repoRoot, packageDirectories }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters