Azure / Azure/static-web-apps-cli

Inconsistent path formation when using swaConfigLocation

Abierto
#986 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
668
Forks
155
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

**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?

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Reproduce el problema en Windows con `swa deploy --config my-folder/swa-cli.config.json` y con cada valor de `swaConfigLocation` informado. Sigue cómo la CLI resuelve el directorio de configuración y verifica que la ruta esperada `my-folder\staticwebapp.config.json` se cargue correctamente sin errores ENOENT ni ENOTDIR.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript
Área
cli
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.