Skip to content

Commit

Permalink
the real fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ecraig12345 committed Nov 20, 2020
1 parent db82635 commit f98f998
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 0 additions & 1 deletion packages/fluentui/projects-test/assets/cra/App.tsx
@@ -1,4 +1,3 @@
/** @jsxRuntime classic */
import {
Accordion,
Animation,
Expand Down
12 changes: 12 additions & 0 deletions packages/fluentui/projects-test/src/createReactApp.ts
Expand Up @@ -33,6 +33,16 @@ async function prepareApp(tmpDirectory: string, appName: string): Promise<string
return appProjectPath;
}

async function fixTypescript(testAppPath: string) {
// TS 4.1 emits an import of `react/jsx-runtime` which doesn't exist in the types as of writing.
// Temporary workaround is to downgrade to 4.0.
await sh('yarn add typescript@~4.0.0', testAppPath);
// Also revert the change to the "jsx" tsconfig setting
const tsconfigPath = path.join(testAppPath, 'tsconfig.json');
const tsconfigContent = fs.readFileSync(tsconfigPath, 'utf8');
fs.writeFileSync(tsconfigPath, tsconfigContent.replace('react-jsx', 'react'));
}

/**
* Tests the following scenario:
* - Create a new react test app
Expand All @@ -49,7 +59,9 @@ export async function createReactApp() {
logger('STEP 1. Create test React project with TSX scripts..');

const testAppPath = config.paths.withRootAt(await prepareApp(tmpDirectory, 'test-app'));
await fixTypescript(testAppPath());
logger(`Test React project is successfully created: ${testAppPath()}`);

logger('STEP 2. Add Fluent UI dependency to test project..');

const packedPackages = await packProjectPackages(logger);
Expand Down

0 comments on commit f98f998

Please sign in to comment.