@mobileaidev/ai-app-bridge 0.2.14 → 0.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/artifact-paths.js +40 -3
- package/package.json +1 -1
package/bin/artifact-paths.js
CHANGED
|
@@ -11,9 +11,11 @@ function defaultArtifactDirectory(options = {}) {
|
|
|
11
11
|
return path.join(cwd, 'build', artifactDirectoryName);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
for (const
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
for (const projectRoot of projectRoots(cwd, gitRoot)) {
|
|
15
|
+
for (const directory of artifactDirectoryCandidates(projectRoot)) {
|
|
16
|
+
if (isGitIgnored(gitRoot, directory)) {
|
|
17
|
+
return directory;
|
|
18
|
+
}
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
|
|
@@ -32,6 +34,41 @@ function defaultArtifactPath(prefix, extension, options = {}) {
|
|
|
32
34
|
return path.join(directory, name);
|
|
33
35
|
}
|
|
34
36
|
|
|
37
|
+
function projectRoots(cwd, gitRoot) {
|
|
38
|
+
const roots = [];
|
|
39
|
+
const resolvedGitRoot = path.resolve(gitRoot);
|
|
40
|
+
let current = path.resolve(cwd);
|
|
41
|
+
|
|
42
|
+
while (current === resolvedGitRoot || current.startsWith(`${resolvedGitRoot}${path.sep}`)) {
|
|
43
|
+
if (isProjectRoot(current)) {
|
|
44
|
+
roots.push(current);
|
|
45
|
+
}
|
|
46
|
+
if (current === resolvedGitRoot) {
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
current = path.dirname(current);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!roots.includes(resolvedGitRoot)) {
|
|
53
|
+
roots.push(resolvedGitRoot);
|
|
54
|
+
}
|
|
55
|
+
return roots;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function isProjectRoot(directory) {
|
|
59
|
+
return hasAny(directory, [
|
|
60
|
+
'settings.gradle',
|
|
61
|
+
'settings.gradle.kts',
|
|
62
|
+
'build.gradle',
|
|
63
|
+
'build.gradle.kts',
|
|
64
|
+
'gradlew',
|
|
65
|
+
'pubspec.yaml',
|
|
66
|
+
'Package.swift',
|
|
67
|
+
'package.json',
|
|
68
|
+
'Cargo.toml',
|
|
69
|
+
]);
|
|
70
|
+
}
|
|
71
|
+
|
|
35
72
|
function artifactDirectoryCandidates(gitRoot) {
|
|
36
73
|
const root = path.resolve(gitRoot);
|
|
37
74
|
const candidates = [];
|
package/package.json
CHANGED