Azure / Azure/static-web-apps-cli

Inconsistent path formation when using swaConfigLocation

Aperta
#986 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
668
Fork
156
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

**swaConfigLocation** doesn't seem to be building the path to the configuration file properly. I have placed both SWA and SWA CLI configuration files on the folder `my-folder`, and run
`swa deploy --config my-folder/swa-cli.config.json`
_swa-cli.config.json_ has a `deploy` section with the property `swaConfigLocation`.

If I set `"swaConfigLocation": "."` or `"swaConfigLocation": "./"` then I get the error `ENOENT: no such file or directory` because it tries to find the file at `\staticwebapp.config.json` instead of `\my-folder\staticwebapp.config.json`. That is, it is using the parent folder instead of `my-folder`. **This was not the case in earlier versions of SWA CLI**.

If I set `"swaConfigLocation": "my-folder"` or `"swaConfigLocation": "./my-folder"` then I get an `ENOENT: no such file or directory` error because it tries to find the file at `\my-folder\my-folder`. On this occasion, swaConfigLocation is appended to `my-folder` instead of the parent folder (as opposed to what happens in the previous example).

If I set `"swaConfigLocation": "staticwebapp.config.json"` or `"swaConfigLocation": "./staticwebapp.config.json"`, then the path seems right `\my-folder\staticwebapp.config.json`, but I get an `ENOTDIR: not a directory` error, because it is expecting a folder rather than a file.

So there seem to be an inconsistency regarding the use of the parent vs `my-folder` directory. I am using **Windows 11** and **Azure Static Web Apps CLI 2.0.8**. In earlier versions of SWA CLI I always used `"swaConfigLocation": "."` and never had this problem.
Could you please provide some advise?

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Riproduci il problema su Windows con `swa deploy --config my-folder/swa-cli.config.json` e ciascun valore `swaConfigLocation` segnalato. Traccia il modo in cui la CLI risolve la directory di configurazione e verifica che il percorso previsto `my-folder\staticwebapp.config.json` venga caricato correttamente senza errori ENOENT o ENOTDIR.

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

Valutazione

Stack tecnologico
typescript
Ambito
cli
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.