From 3c3a1345aa67db06503f782819cefc2fb824b910 Mon Sep 17 00:00:00 2001 From: denihs Date: Thu, 4 Jul 2024 15:06:36 -0400 Subject: [PATCH] - removing premature skel cloning - avoid getting stuck in prompting when trying to clone repository --- tools/cli/commands.js | 39 ++++++--------------------------------- 1 file changed, 6 insertions(+), 33 deletions(-) diff --git a/tools/cli/commands.js b/tools/cli/commands.js index 471a8baaae..83ad2cda4c 100644 --- a/tools/cli/commands.js +++ b/tools/cli/commands.js @@ -944,38 +944,6 @@ main.registerCommand({ }) ); } - await files.cp_r(files.pathJoin(__dirnameConverted, '..', 'static-assets', - `skel-${skeleton}`), appPath, { - transformFilename: function (f) { - return transform(f); - }, - transformContents: function (contents, f) { - - // check if this app is just for prototyping if it is then we need to add autopublish and insecure in the packages file - if ((/packages/).test(f)) { - - const prototypePackages = - () => - 'autopublish # Publish all data to the clients (for prototyping)\n' + - 'insecure # Allow all DB writes from clients (for prototyping)'; - - // XXX: if there is the need to add more options maybe we should have a better abstraction for this if-else - if (options.prototype) { - return Buffer.from(contents.toString().replace(/~prototype~/g, prototypePackages())) - } else { - return Buffer.from(contents.toString().replace(/~prototype~/g, '')) - } - } - if ((/(\.html|\.[jt]sx?|\.css)/).test(f)) { - return Buffer.from(transform(contents.toString())); - } else { - return contents; - } - }, - ignore: toIgnore, - preserveSymlinks: true, - }); - // Setup fn, which is called after the app is created, to print a message // about how to run the app. async function setupMessages() { @@ -1089,7 +1057,12 @@ main.registerCommand({ const setupExampleByURL = async (url) => { const [ok, err] = await bash`git -v`; if (err) throw new Error("git is not installed"); - await bash`git clone --progress ${url} ${appPath} `; + // Set GIT_TERMINAL_PROMPT=0 to disable prompting + const [okClone, errClone] = + await bash`GIT_TERMINAL_PROMPT=0 git clone --progress ${url} ${appPath}`; + if (errClone && !errClone.includes("Cloning into")) { + throw new Error("error cloning skeleton"); + } // remove .git folder from the example await files.rm_recursive_async(files.pathJoin(appPath, ".git")); await setupMessages();