relativeTypesPath returns a path to the generated TS file relative to the specified basepath. It fallbacks to the full path if generating the relative path fails.
(basepath string)
| 472 | // |
| 473 | // It fallbacks to the full path if generating the relative path fails. |
| 474 | func (p *plugin) relativeTypesPath(basepath string) string { |
| 475 | fullPath := p.fullTypesPath() |
| 476 | |
| 477 | rel, err := filepath.Rel(basepath, fullPath) |
| 478 | if err != nil { |
| 479 | // fallback to the full path |
| 480 | rel = fullPath |
| 481 | } |
| 482 | |
| 483 | return rel |
| 484 | } |
| 485 | |
| 486 | // refreshTypesFile saves the embedded TS declarations as a file on the disk. |
| 487 | func (p *plugin) refreshTypesFile() error { |
no test coverage detected