@guchen_0521/create-temp 0.1.2 → 0.1.3
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/lib/scaffold.js +9 -8
- package/package.json +1 -1
package/lib/scaffold.js
CHANGED
|
@@ -21,7 +21,9 @@ const IGNORE_NAMES = new Set([
|
|
|
21
21
|
]);
|
|
22
22
|
|
|
23
23
|
const execFileAsync = promisify(execFile);
|
|
24
|
-
const
|
|
24
|
+
const TEMPLATE_REPO_URL =
|
|
25
|
+
process.env.TEMPLATE_REPO_URL ||
|
|
26
|
+
"https://github.com/GuChena/template.git";
|
|
25
27
|
const CLONE_RETRIES = 3;
|
|
26
28
|
const GIT_SSH_COMMAND =
|
|
27
29
|
"ssh -o ServerAliveInterval=30 -o ServerAliveCountMax=6";
|
|
@@ -33,15 +35,14 @@ async function cloneTemplateRepo() {
|
|
|
33
35
|
let lastError = null;
|
|
34
36
|
for (let attempt = 1; attempt <= CLONE_RETRIES; attempt += 1) {
|
|
35
37
|
try {
|
|
38
|
+
const env = { ...process.env };
|
|
39
|
+
if (TEMPLATE_REPO_URL.startsWith("ssh://")) {
|
|
40
|
+
env.GIT_SSH_COMMAND = GIT_SSH_COMMAND;
|
|
41
|
+
}
|
|
36
42
|
await execFileAsync(
|
|
37
43
|
"git",
|
|
38
|
-
["clone", "--depth", "1",
|
|
39
|
-
{
|
|
40
|
-
env: {
|
|
41
|
-
...process.env,
|
|
42
|
-
GIT_SSH_COMMAND,
|
|
43
|
-
},
|
|
44
|
-
}
|
|
44
|
+
["clone", "--depth", "1", TEMPLATE_REPO_URL, repoDir],
|
|
45
|
+
{ env }
|
|
45
46
|
);
|
|
46
47
|
return { repoDir, tempDir };
|
|
47
48
|
} catch (error) {
|