Skip to content

Commit

Permalink
feat(types): export CurrentsConfig for typed config files
Browse files Browse the repository at this point in the history
chore: release v1.12.1
  • Loading branch information
ynahmany committed Dec 12, 2024
2 parents 93f574e + e93aa7b commit 567d9d6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": false
}
1 change: 1 addition & 0 deletions packages/cypress-cloud/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import "source-map-support/register.js";

import { run as internalRun } from "./lib/run";
export type { CurrentsConfig } from "./lib/config/config";
import { CurrentsRunAPI } from "./types";
export type { CurrentsRunAPI } from "./types";
/**
Expand Down
12 changes: 10 additions & 2 deletions packages/cypress-cloud/lib/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ export type ComponentConfig = {
type RetryConfig = {
hardFailureMaxRetries: number;
};

/**
* This is the type for `currents.config.*s`. If you are not officially using TypeScript,
* you can still type the exported config in your IDE by adding the following as a block comment
* above `module.exports` / `export default`:
*
* `@type {import('cypress-cloud').CurrentsConfig}`
*/
export type CurrentsConfig = {
projectId?: string;
recordKey?: string;
Expand All @@ -43,7 +51,7 @@ const defaultConfig: CurrentsConfig = {

export async function getCurrentsConfig(
projectRoot?: string,
explicitConfigFilePath?: string
explicitConfigFilePath?: string,
): Promise<CurrentsConfig> {
if (_config) {
return _config;
Expand All @@ -70,7 +78,7 @@ export async function getCurrentsConfig(

warn(
"Failed to load config file, falling back to the default config. Attempted locations: %s",
configFilePath
configFilePath,
);
_config = defaultConfig;
return _config;
Expand Down
2 changes: 1 addition & 1 deletion packages/cypress-cloud/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cypress-cloud",
"version": "1.12.0",
"version": "1.12.1",
"main": "./dist/index.js",
"author": "Currents Software Inc",
"homepage": "https://github.com/currents-dev/cypress-cloud",
Expand Down

0 comments on commit 567d9d6

Please sign in to comment.