-
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.
feat: remove dependency on git repos
- Loading branch information
Showing
6 changed files
with
72 additions
and
118 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
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
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 |
---|---|---|
@@ -1,12 +1,32 @@ | ||
'use strict'; | ||
import { promises as fsPromises, readFile, stat, readdir } from 'node:fs'; | ||
import git from 'isomorphic-git'; | ||
/* eslint-disable no-await-in-loop */ | ||
import { access } from 'node:fs/promises'; | ||
import { join, dirname } from 'node:path'; | ||
|
||
export async function getRepoRoot(): Promise<string> { | ||
const fs = { promises: fsPromises, readFile, stat, readdir }; | ||
const repoRoot = await git.findRoot({ | ||
fs, | ||
filepath: process.cwd(), | ||
}); | ||
return repoRoot; | ||
export async function getRepoRoot(): Promise<{ repoRoot: string | undefined; dxConfigFilePath: string | undefined }> { | ||
let currentDir = process.cwd(); | ||
let found = false; | ||
let dxConfigFilePath: string | undefined; | ||
let repoRoot: string | undefined; | ||
|
||
do { | ||
const filePath = join(currentDir, 'sfdx-project.json'); | ||
|
||
try { | ||
// Check if sfdx-project.json exists in the current directory | ||
await access(filePath); | ||
dxConfigFilePath = filePath; | ||
repoRoot = currentDir; | ||
found = true; | ||
} catch { | ||
// If file not found, move up one directory level | ||
const parentDir = dirname(currentDir); | ||
if (currentDir === parentDir) { | ||
// Reached the root without finding the file, throw an error | ||
throw new Error('sfdx-project.json not found in any parent directory.'); | ||
} | ||
currentDir = parentDir; | ||
} | ||
} while (!found); | ||
return { repoRoot, dxConfigFilePath }; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3180,11 +3180,6 @@ astral-regex@^2.0.0: | |
resolved "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz" | ||
integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== | ||
|
||
async-lock@^1.4.1: | ||
version "1.4.1" | ||
resolved "https://registry.yarnpkg.com/async-lock/-/async-lock-1.4.1.tgz#56b8718915a9b68b10fce2f2a9a3dddf765ef53f" | ||
integrity sha512-Az2ZTpuytrtqENulXwO3GGv1Bztugx6TT37NIo7imr/Qo0gsYiGtSdBa2B6fsXhTpVZDNfu1Qn3pk531e3q+nQ== | ||
|
||
async-retry@^1.3.3: | ||
version "1.3.3" | ||
resolved "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz" | ||
|
@@ -3603,11 +3598,6 @@ ci-info@^3.8.0: | |
resolved "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz" | ||
integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== | ||
|
||
clean-git-ref@^2.0.1: | ||
version "2.0.1" | ||
resolved "https://registry.yarnpkg.com/clean-git-ref/-/clean-git-ref-2.0.1.tgz#dcc0ca093b90e527e67adb5a5e55b1af6816dcd9" | ||
integrity sha512-bLSptAy2P0s6hU4PzuIMKmMJJSE6gLXGH1cntDu7bWJUksvuM+7ReOK61mozULErYvP6a15rnYl0zFDef+pyPw== | ||
|
||
clean-regexp@^1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.npmjs.org/clean-regexp/-/clean-regexp-1.0.0.tgz" | ||
|
@@ -3960,11 +3950,6 @@ cosmiconfig@^8.0.0, cosmiconfig@^8.3.6: | |
parse-json "^5.2.0" | ||
path-type "^4.0.0" | ||
|
||
crc-32@^1.2.0: | ||
version "1.2.2" | ||
resolved "https://registry.yarnpkg.com/crc-32/-/crc-32-1.2.2.tgz#3cad35a934b8bf71f25ca524b6da51fb7eace2ff" | ||
integrity sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ== | ||
|
||
create-require@^1.1.0: | ||
version "1.1.1" | ||
resolved "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz" | ||
|
@@ -4149,11 +4134,6 @@ dezalgo@^1.0.0: | |
asap "^2.0.0" | ||
wrappy "1" | ||
|
||
[email protected]: | ||
version "0.0.3" | ||
resolved "https://registry.yarnpkg.com/diff3/-/diff3-0.0.3.tgz#d4e5c3a4cdf4e5fe1211ab42e693fcb4321580fc" | ||
integrity sha512-iSq8ngPOt0K53A6eVr4d5Kn6GNrM2nQZtC740pzIriHtn4pOQ2lyzEXQMBeVcWERN0ye7fhBsk9PbLLQOnUx/g== | ||
|
||
[email protected], diff@^5.0.0: | ||
version "5.0.0" | ||
resolved "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz" | ||
|
@@ -5889,23 +5869,6 @@ isexe@^2.0.0: | |
resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" | ||
integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== | ||
|
||
isomorphic-git@^1.27.1: | ||
version "1.27.1" | ||
resolved "https://registry.yarnpkg.com/isomorphic-git/-/isomorphic-git-1.27.1.tgz#a2752fce23a09f04baa590c41cfaf61e973405b3" | ||
integrity sha512-X32ph5zIWfT75QAqW2l3JCIqnx9/GWd17bRRehmn3qmWc34OYbSXY6Cxv0o9bIIY+CWugoN4nQFHNA+2uYf2nA== | ||
dependencies: | ||
async-lock "^1.4.1" | ||
clean-git-ref "^2.0.1" | ||
crc-32 "^1.2.0" | ||
diff3 "0.0.3" | ||
ignore "^5.1.4" | ||
minimisted "^2.0.0" | ||
pako "^1.0.10" | ||
pify "^4.0.1" | ||
readable-stream "^3.4.0" | ||
sha.js "^2.4.9" | ||
simple-get "^4.0.1" | ||
|
||
istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: | ||
version "3.2.0" | ||
resolved "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz" | ||
|
@@ -6721,13 +6684,6 @@ minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.5, minimist@^1.2.6: | |
resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz" | ||
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== | ||
|
||
minimisted@^2.0.0: | ||
version "2.0.1" | ||
resolved "https://registry.yarnpkg.com/minimisted/-/minimisted-2.0.1.tgz#d059fb905beecf0774bc3b308468699709805cb1" | ||
integrity sha512-1oPjfuLQa2caorJUM8HV8lGgWCc0qqAO1MNv/k05G4qslmsndV/5WdNZrqCiyqiz3wohia2Ij2B7w2Dr7/IyrA== | ||
dependencies: | ||
minimist "^1.2.5" | ||
|
||
minipass-collect@^1.0.2: | ||
version "1.0.2" | ||
resolved "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz" | ||
|
@@ -7543,7 +7499,7 @@ pacote@^15.2.0: | |
ssri "^10.0.0" | ||
tar "^6.1.11" | ||
|
||
pako@^1.0.10, pako@~1.0.2: | ||
pako@~1.0.2: | ||
version "1.0.11" | ||
resolved "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz" | ||
integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== | ||
|
@@ -8391,14 +8347,6 @@ setimmediate@^1.0.5: | |
resolved "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz" | ||
integrity sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA== | ||
|
||
sha.js@^2.4.9: | ||
version "2.4.11" | ||
resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" | ||
integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== | ||
dependencies: | ||
inherits "^2.0.1" | ||
safe-buffer "^5.0.1" | ||
|
||
shebang-command@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz" | ||
|
@@ -8466,20 +8414,6 @@ sigstore@^1.3.0: | |
make-fetch-happen "^11.0.1" | ||
tuf-js "^1.1.3" | ||
|
||
simple-concat@^1.0.0: | ||
version "1.0.1" | ||
resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f" | ||
integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== | ||
|
||
simple-get@^4.0.1: | ||
version "4.0.1" | ||
resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-4.0.1.tgz#4a39db549287c979d352112fa03fd99fd6bc3543" | ||
integrity sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA== | ||
dependencies: | ||
decompress-response "^6.0.0" | ||
once "^1.3.1" | ||
simple-concat "^1.0.0" | ||
|
||
simple-swizzle@^0.2.2: | ||
version "0.2.2" | ||
resolved "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz" | ||
|
@@ -8684,16 +8618,7 @@ ssri@^9.0.0: | |
dependencies: | ||
minipass "^3.1.1" | ||
|
||
"string-width-cjs@npm:string-width@^4.2.0": | ||
version "4.2.3" | ||
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" | ||
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== | ||
dependencies: | ||
emoji-regex "^8.0.0" | ||
is-fullwidth-code-point "^3.0.0" | ||
strip-ansi "^6.0.1" | ||
|
||
"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: | ||
"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: | ||
version "4.2.3" | ||
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" | ||
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== | ||
|
@@ -8752,14 +8677,7 @@ string_decoder@^1.3.0: | |
dependencies: | ||
safe-buffer "~5.2.0" | ||
|
||
"strip-ansi-cjs@npm:strip-ansi@^6.0.1": | ||
version "6.0.1" | ||
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" | ||
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== | ||
dependencies: | ||
ansi-regex "^5.0.1" | ||
|
||
[email protected], strip-ansi@^6.0.0, strip-ansi@^6.0.1: | ||
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", [email protected], strip-ansi@^6.0.0, strip-ansi@^6.0.1: | ||
version "6.0.1" | ||
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" | ||
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== | ||
|
@@ -9490,7 +9408,7 @@ [email protected]: | |
resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz" | ||
integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw== | ||
|
||
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": | ||
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: | ||
version "7.0.0" | ||
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" | ||
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== | ||
|
@@ -9508,15 +9426,6 @@ wrap-ansi@^6.2.0: | |
string-width "^4.1.0" | ||
strip-ansi "^6.0.0" | ||
|
||
wrap-ansi@^7.0.0: | ||
version "7.0.0" | ||
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" | ||
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== | ||
dependencies: | ||
ansi-styles "^4.0.0" | ||
string-width "^4.1.0" | ||
strip-ansi "^6.0.0" | ||
|
||
wrap-ansi@^8.1.0: | ||
version "8.1.0" | ||
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz" | ||
|