MetaMask / MetaMask/template-sync

Crashes if `metamask-module-template` already exists in temp directory but is not a Git repo

Aperta
#19 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug team-wallet-framework wf-bugs
Lingua principale
TypeScript
Stelle
7
Fork
3
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I've tried using both `npx @metamask/template-sync` and `yarn dlx @metamask/template-sync` on a project and get the same error:

```
⠋ Fetching module template.Error: Command failed with exit code 128: git pull
fatal: not a git repository (or any of the parent directories): .git
at makeError (/private/var/folders/gz/d8jvtc0n0rncp1xz80k0x62m0000gn/T/xfs-cd883ffe/dlx-65796/node_modules/execa/lib/error.js:60:11)
at handlePromise (/private/var/folders/gz/d8jvtc0n0rncp1xz80k0x62m0000gn/T/xfs-cd883ffe/dlx-65796/node_modules/execa/index.js:118:26)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async task (/private/var/folders/gz/d8jvtc0n0rncp1xz80k0x62m0000gn/T/xfs-cd883ffe/dlx-65796/node_modules/@metamask/template-sync/dist/cli.js:36:21)
at async main (/private/var/folders/gz/d8jvtc0n0rncp1xz80k0x62m0000gn/T/xfs-cd883ffe/dlx-65796/node_modules/@metamask/template-sync/dist/cli.js:114:9) {
shortMessage: 'Command failed with exit code 128: git pull',
command: 'git pull',
escapedCommand: 'git pull',
exitCode: 128,
signal: undefined,
signalDescription: undefined,
stdout: '',
stderr: 'fatal: not a git repository (or any of the parent directories): .git',
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
⠼ Fetching module template.
```

It looks like [this line](https://github.com/MetaMask/template-sync/blob/b55310063ffce42ebacf0aafecb22292c2ce8c75/src/cli.ts#L47) is failing. This happens if a `metamask-module-template` directory already exists in the temporary directory root but is not a Git repository for some reason.

(Also, for some reason, the tool doesn't exit, but the spinner next to "Fetching module template" keeps spinning, but that seems like a separate issue.)

It seems like we ought to check that a `.git` directory exists in the `metamask-module-template` directory instead.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia in src/cli.ts, nella logica di recupero del template attorno alla chiamata git pull che fallisce. Riproduci il caso con una directory metamask-module-template esistente a cui manca .git, quindi verifica che lo strumento gestisca correttamente quella directory e non rimanga più bloccato sullo spinner di recupero.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
git, typescript
Ambito
cli, tooling
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.