版博士V2.0程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1 год назад
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/usr/bin/env node
  2. 'use strict';
  3. const node_path = require('node:path');
  4. const mri = require('mri');
  5. const colorette = require('colorette');
  6. const giget = require('./shared/giget.a16f8b31.cjs');
  7. require('node:fs/promises');
  8. require('node:fs');
  9. require('tar');
  10. require('pathe');
  11. require('defu');
  12. require('node:stream');
  13. require('node:child_process');
  14. require('node:os');
  15. require('node:util');
  16. require('node-fetch-native');
  17. require('https-proxy-agent');
  18. async function main() {
  19. const arguments_ = mri(process.argv.slice(2), {
  20. boolean: [
  21. "help",
  22. "force",
  23. "force-clean",
  24. "offline",
  25. "prefer-offline",
  26. "shell",
  27. "verbose"
  28. ],
  29. string: ["registry", "cwd", "auth"]
  30. });
  31. const input = arguments_._[0];
  32. const dir = arguments_._[1];
  33. if (!input || arguments_.help || arguments_.h) {
  34. console.error(
  35. "Usage: npx giget@latest <input> [<dir>] [--force] [--force-clean] [--offline] [--prefer-offline] [--shell] [--registry] [--no-registry] [--verbose] [--cwd] [--auth]"
  36. );
  37. process.exit(1);
  38. }
  39. if (arguments_.verbose) {
  40. process.env.DEBUG = process.env.DEBUG || "true";
  41. }
  42. const r = await giget.downloadTemplate(input, {
  43. dir,
  44. force: arguments_.force,
  45. forceClean: arguments_["force-clean"],
  46. offline: arguments_.offline,
  47. registry: arguments_.registry,
  48. cwd: arguments_.cwd,
  49. auth: arguments_.auth
  50. });
  51. console.log(
  52. `\u2728 Successfully cloned ${colorette.cyan(r.name || r.url)} to ${colorette.cyan(
  53. node_path.relative(process.cwd(), r.dir)
  54. )}
  55. `
  56. );
  57. if (arguments_.shell) {
  58. giget.startShell(r.dir);
  59. }
  60. process.exit(0);
  61. }
  62. main().catch((error) => {
  63. console.error(error);
  64. process.exit(1);
  65. });