Merge pull request #13217 from meteor/fix/error-cloning-skel

[Meteor 3] Fix git clone error when running `meteor create`
This commit is contained in:
Denilson
2024-07-05 13:32:20 -04:00
committed by GitHub

View File

@@ -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();