refactor: remove degit

This commit is contained in:
EvolutionX
2022-06-14 08:43:14 +05:30
parent b2e6236dde
commit f650171030
3 changed files with 6 additions and 32 deletions

17
package-lock.json generated
View File

@@ -11,7 +11,6 @@
"dependencies": {
"colorette": "^2.0.16",
"commander": "^9.3.0",
"degit": "^2.8.4",
"execa": "^6.1.0",
"find-up": "6.3.0",
"ora": "^6.1.0",
@@ -1215,17 +1214,6 @@
"clone": "^1.0.2"
}
},
"node_modules/degit": {
"version": "2.8.4",
"resolved": "https://registry.npmjs.org/degit/-/degit-2.8.4.tgz",
"integrity": "sha512-vqYuzmSA5I50J882jd+AbAhQtgK6bdKUJIex1JNfEUPENCgYsxugzKVZlFyMwV4i06MmnV47/Iqi5Io86zf3Ng==",
"bin": {
"degit": "degit"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/detect-indent": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.0.0.tgz",
@@ -5015,11 +5003,6 @@
"clone": "^1.0.2"
}
},
"degit": {
"version": "2.8.4",
"resolved": "https://registry.npmjs.org/degit/-/degit-2.8.4.tgz",
"integrity": "sha512-vqYuzmSA5I50J882jd+AbAhQtgK6bdKUJIex1JNfEUPENCgYsxugzKVZlFyMwV4i06MmnV47/Iqi5Io86zf3Ng=="
},
"detect-indent": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.0.0.tgz",

View File

@@ -35,7 +35,6 @@
"dependencies": {
"colorette": "^2.0.16",
"commander": "^9.3.0",
"degit": "^2.8.4",
"execa": "^6.1.0",
"find-up": "6.3.0",
"ora": "^6.1.0",

View File

@@ -1,12 +1,10 @@
import { execa } from 'execa';
import { redBright } from 'colorette';
import fs from 'fs';
import os from 'os';
import path from 'path';
import { readFile } from 'fs/promises';
import { findUp } from 'find-up';
import ora from 'ora';
import degit from 'degit';
/**
* It installs dependencies from a package.json file
@@ -52,18 +50,12 @@ export async function installDeps(choice, name) {
* @param {string} subDirs - path of sub-directory of location, if any
*/
export async function cloneRepo(lang, name) {
const isCached = fs.existsSync( //! @deprecated will be removed in future versions
path.join(os.homedir(), '.degit/github/sern-handler/templates')
);
const emitter = degit('sern-handler/templates/templates', {
cache: false,
force: true,
});
await emitter.clone('templates');
copyRecursiveSync(`templates/${lang}`, name);
fs.rmSync('templates', { recursive: true, force: true });
await execa('git', [
'clone',
`https://github.com/sern-handler/templates.git`,
]);
copyRecursiveSync(`templates/templates/${lang}`, name);
fs.rmSync(`templates/`, { recursive: true, force: true });
}
/**