🎥 Make videos programmatically with React
fix: make code-shift test pass on Windows
Jonny Burgere2079107233c
diff --git a/packages/studio-server/src/codemods/update-sequence-props.ts b/packages/studio-server/src/codemods/update-sequence-props.tsindex 0f3556fb90..ec4247e8e9 100644--- a/packages/studio-server/src/codemods/update-sequence-props.ts+++ b/packages/studio-server/src/codemods/update-sequence-props.ts@@ -13,6 +13,7 @@ export const updateSequenceProps = async ({value,enumPaths,defaultValue,+ prettierConfigOverride,}: {input: string;nodePath: SequenceNodePath;@@ -20,6 +21,7 @@ export const updateSequenceProps = async ({value: unknown;enumPaths: EnumPath[];defaultValue: unknown | null;+ prettierConfigOverride?: Record<string, unknown> | null;}): Promise<{output: string;oldValueString: string;@@ -37,8 +39,7 @@ export const updateSequenceProps = async ({const parentKey = isNested ? key.slice(0, dotIndex) : key;const childKey = isNested ? key.slice(dotIndex + 1) : '';- // eslint-disable-next-line @typescript-eslint/no-explicit-any- const node = findJsxElementAtNodePath(ast, nodePath) as any;+ const node = findJsxElementAtNodePath(ast, nodePath);if (!node) {throw new Error('Could not find a JSX element at the specified line to update',@@ -129,16 +130,23 @@ export const updateSequenceProps = async ({const {format, resolveConfig, resolveConfigFile} = prettier as PrettierType;- const configFilePath = await resolveConfigFile();- if (!configFilePath) {- return {- output: finalFile,- oldValueString,- formatted: false,- };+ let prettierConfig: Record<string, unknown> | null;++ if (prettierConfigOverride !== undefined) {+ prettierConfig = prettierConfigOverride;+ } else {+ const configFilePath = await resolveConfigFile();+ if (!configFilePath) {+ return {+ output: finalFile,+ oldValueString,+ formatted: false,+ };+ }++ prettierConfig = await resolveConfig(configFilePath);}- const prettierConfig = await resolveConfig(configFilePath);if (!prettierConfig) {return {output: finalFile,@@ -151,7 +159,7 @@ export const updateSequenceProps = async ({...prettierConfig,filepath: 'test.tsx',plugins: [],- endOfLine: 'auto',+ endOfLine: 'lf',});return {diff --git a/packages/studio-server/src/test/code-shift.test.ts b/packages/studio-server/src/test/code-shift.test.tsindex 955f2fb336..99ea279438 100644--- a/packages/studio-server/src/test/code-shift.test.ts+++ b/packages/studio-server/src/test/code-shift.test.ts@@ -19,6 +19,11 @@ test('Should add style.scale to a Video component and format with prettier', asyvalue: 2,enumPaths: [],defaultValue: null,+ prettierConfigOverride: {+ singleQuote: true,+ bracketSpacing: false,+ useTabs: true,+ },});expect(oldValueString).toBe('');