Skip to content

Commit

Permalink
fix types and access
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskalmar committed Nov 18, 2023
1 parent 24d5713 commit 5f238f8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,10 @@ export const FlexibleConfigSchema = z.union([
}).partial(),
]);

type PlatformModeConfig = z.infer<typeof PlatformModeConfigSchema>;
type GenerateOnlyModeConfig = z.infer<typeof GenerateOnlyModeConfigSchema>;
export type PlatformModeConfig = z.infer<typeof PlatformModeConfigSchema>;
export type GenerateOnlyModeConfig = z.infer<
typeof GenerateOnlyModeConfigSchema
>;

export type Config = z.infer<typeof ConfigSchema>;
export type CustomProjectConfig = z.infer<typeof FlexibleConfigSchema>;
Expand Down
2 changes: 1 addition & 1 deletion src/crawler/ladleScreenshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import axios from 'axios';
import { config, isPlatformModeConfig, type Mask } from '../config';
import type { ShotItem } from '../types';
import { selectBreakpoints, generateSizeLabel } from '../shots/utils';
import type { Story } from './storybook';
import { notSupported } from '../constants';
import type { Story } from './storybook';

export const generateLadleShotItems = (
baseUrl: string,
Expand Down
4 changes: 2 additions & 2 deletions src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
parseHrtimeToSeconds,
removeFilesInFolder,
} from './utils';
import type { FullConfig, PlatformModeConfig } from './config';
import type { GenerateOnlyModeConfig, PlatformModeConfig } from './config';
import {
type ShotConfig,
getApiToken,
Expand All @@ -23,7 +23,7 @@ import { log } from './log';
import type { ExtendedShotItem } from './types';
import { uploadRequiredShots } from './upload';

export const runner = async (config: FullConfig) => {
export const runner = async (config: GenerateOnlyModeConfig) => {
const executionStart = process.hrtime();

try {
Expand Down
9 changes: 7 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { hideBin } from 'yargs/helpers';
import { config, isPlatformModeConfig } from './config';
import { log } from './log';
import type { ShotItem } from './types';
import { notSupported } from './constants';

export type ParsedYargs = {
_: ['update', 'meta', 'docker', 'local'];
Expand Down Expand Up @@ -217,9 +218,13 @@ export const readDirIntoShotItems = (path: string): ShotItem[] => {
id: fileName,
shotName: fileName,
shotMode: 'custom',
filePathBaseline: join(config.imagePathBaseline, fileNameWithExt),
filePathBaseline: isPlatformModeConfig(config)
? notSupported
: join(config.imagePathBaseline, fileNameWithExt),
filePathCurrent: join(path, fileNameWithExt),
filePathDifference: join(config.imagePathDifference, fileNameWithExt),
filePathDifference: isPlatformModeConfig(config)
? notSupported
: join(config.imagePathDifference, fileNameWithExt),
url: fileName,
// TODO: custom shots take thresholds only from config - not possible to source configs from individual story
threshold: config.threshold,
Expand Down

0 comments on commit 5f238f8

Please sign in to comment.