@faable/faable 1.12.0 → 1.12.1
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/dist/lib/git_remote.js +14 -3
- package/package.json +1 -1
package/dist/lib/git_remote.js
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { spawn } from 'promisify-child-process';
|
|
2
2
|
import { log } from '../log.js';
|
|
3
3
|
|
|
4
4
|
// Returns the "org/repo" slug of the git origin remote (the format the API
|
|
5
5
|
// stores in `app.repository`), the raw URL for non-GitHub remotes, or
|
|
6
6
|
// undefined when there is no usable remote.
|
|
7
|
+
//
|
|
8
|
+
// This is a best-effort auto-detection: running outside a git repository (or
|
|
9
|
+
// without an `origin` remote) is an expected, benign case, so failures are
|
|
10
|
+
// swallowed at debug level — never surfaced as errors/warnings. It does NOT
|
|
11
|
+
// go through `cmd()` on purpose: that helper loudly logs stderr and the exit
|
|
12
|
+
// code, which is right for user-invoked build steps but pure noise here.
|
|
7
13
|
const getGitRemoteUrl = async (workdir) => {
|
|
8
14
|
try {
|
|
9
|
-
const
|
|
15
|
+
const child = spawn('git', ['remote', 'get-url', 'origin'], {
|
|
16
|
+
encoding: 'utf8',
|
|
17
|
+
stdio: 'pipe',
|
|
18
|
+
cwd: workdir
|
|
19
|
+
});
|
|
20
|
+
const { stdout } = await child;
|
|
10
21
|
const url = stdout?.toString().trim();
|
|
11
22
|
if (!url)
|
|
12
23
|
return undefined;
|
|
@@ -18,7 +29,7 @@ const getGitRemoteUrl = async (workdir) => {
|
|
|
18
29
|
return url;
|
|
19
30
|
}
|
|
20
31
|
catch {
|
|
21
|
-
log.
|
|
32
|
+
log.debug('No git origin remote detected; skipping repo-based app lookup.');
|
|
22
33
|
return undefined;
|
|
23
34
|
}
|
|
24
35
|
};
|