Skip to content

Commit 0e87239

Browse files
authored
feat(types): export CurrentsConfig for typed config files
2 parents 93f574e + e93aa7b commit 0e87239

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

.prettierrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": false
3+
}

packages/cypress-cloud/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import "source-map-support/register.js";
33

44
import { run as internalRun } from "./lib/run";
5+
export type { CurrentsConfig } from "./lib/config/config";
56
import { CurrentsRunAPI } from "./types";
67
export type { CurrentsRunAPI } from "./types";
78
/**

packages/cypress-cloud/lib/config/config.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ export type ComponentConfig = {
1818
type RetryConfig = {
1919
hardFailureMaxRetries: number;
2020
};
21+
22+
/**
23+
* This is the type for `currents.config.*s`. If you are not officially using TypeScript,
24+
* you can still type the exported config in your IDE by adding the following as a block comment
25+
* above `module.exports` / `export default`:
26+
*
27+
* `@type {import('cypress-cloud').CurrentsConfig}`
28+
*/
2129
export type CurrentsConfig = {
2230
projectId?: string;
2331
recordKey?: string;
@@ -43,7 +51,7 @@ const defaultConfig: CurrentsConfig = {
4351

4452
export async function getCurrentsConfig(
4553
projectRoot?: string,
46-
explicitConfigFilePath?: string
54+
explicitConfigFilePath?: string,
4755
): Promise<CurrentsConfig> {
4856
if (_config) {
4957
return _config;
@@ -70,7 +78,7 @@ export async function getCurrentsConfig(
7078

7179
warn(
7280
"Failed to load config file, falling back to the default config. Attempted locations: %s",
73-
configFilePath
81+
configFilePath,
7482
);
7583
_config = defaultConfig;
7684
return _config;

0 commit comments

Comments
 (0)