Fix issue where TypeScript errors in scripts/ folder weren't picked up
Summary: This diff fixes an issue where the `scripts` folder wasn't automatically type checked by TypeScript, and as a result `yarn flipper-server` was broken atm. Reviewed By: nikoant Differential Revision: D33348825 fbshipit-source-id: 059a834cacb881d45ae4b0933af3f1feabb90182
This commit is contained in:
committed by
Facebook GitHub Bot
parent
863727cbd8
commit
dda68de445
@@ -36,7 +36,6 @@ import {
|
|||||||
serverDir,
|
serverDir,
|
||||||
rootDir,
|
rootDir,
|
||||||
browserUiDir,
|
browserUiDir,
|
||||||
serverStaticDir,
|
|
||||||
} from './paths';
|
} from './paths';
|
||||||
import pFilter from 'p-filter';
|
import pFilter from 'p-filter';
|
||||||
import child from 'child_process';
|
import child from 'child_process';
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {cleanup} from '@testing-library/react';
|
|||||||
import {resolve} from 'path';
|
import {resolve} from 'path';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
|
||||||
(window as any).FlipperRenderHostInstance = createStubRenderHost();
|
(global as any).FlipperRenderHostInstance = createStubRenderHost();
|
||||||
|
|
||||||
import {TestUtils} from 'flipper-plugin';
|
import {TestUtils} from 'flipper-plugin';
|
||||||
import {
|
import {
|
||||||
@@ -53,7 +53,7 @@ if (!test) {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
// Fresh mock flipperServer for every test
|
// Fresh mock flipperServer for every test
|
||||||
(window as any).FlipperRenderHostInstance = createStubRenderHost();
|
(global as any).FlipperRenderHostInstance = createStubRenderHost();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(cleanup);
|
afterEach(cleanup);
|
||||||
@@ -77,10 +77,10 @@ Object.defineProperty(global, 'performance', {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
global.PerformanceObserver = PerformanceObserver;
|
(global as any).PerformanceObserver = PerformanceObserver;
|
||||||
|
|
||||||
// https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
|
// https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
|
||||||
Object.defineProperty(window, 'matchMedia', {
|
Object.defineProperty(global, 'matchMedia', {
|
||||||
writable: true,
|
writable: true,
|
||||||
value: jest.fn().mockImplementation((query) => ({
|
value: jest.fn().mockImplementation((query) => ({
|
||||||
matches: false,
|
matches: false,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
// import/no-unresolved complains, although it is a perfectly fine import
|
// import/no-unresolved complains, although it is a perfectly fine import
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
global.fetch = require('jest-fetch-mock');
|
(global as any).fetch = require('jest-fetch-mock');
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
global.electronRequire = require;
|
global.electronRequire = require;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import fs from 'fs-extra';
|
|||||||
import {hostname} from 'os';
|
import {hostname} from 'os';
|
||||||
import {compileMain, prepareDefaultPlugins} from './build-utils';
|
import {compileMain, prepareDefaultPlugins} from './build-utils';
|
||||||
import Watchman from './watchman';
|
import Watchman from './watchman';
|
||||||
|
// @ts-ignore no typings for metro
|
||||||
import Metro from 'metro';
|
import Metro from 'metro';
|
||||||
import {staticDir, babelTransformationsDir, rootDir} from './paths';
|
import {staticDir, babelTransformationsDir, rootDir} from './paths';
|
||||||
import isFB from './isFB';
|
import isFB from './isFB';
|
||||||
|
|||||||
@@ -16,11 +16,9 @@ import {
|
|||||||
prepareDefaultPlugins,
|
prepareDefaultPlugins,
|
||||||
} from './build-utils';
|
} from './build-utils';
|
||||||
import Watchman from './watchman';
|
import Watchman from './watchman';
|
||||||
import {serverStaticDir} from './paths';
|
|
||||||
import isFB from './isFB';
|
import isFB from './isFB';
|
||||||
import yargs from 'yargs';
|
import yargs from 'yargs';
|
||||||
import ensurePluginFoldersWatchable from './ensurePluginFoldersWatchable';
|
import ensurePluginFoldersWatchable from './ensurePluginFoldersWatchable';
|
||||||
import {remove} from 'fs-extra';
|
|
||||||
|
|
||||||
const argv = yargs
|
const argv = yargs
|
||||||
.usage('yarn flipper-server [args]')
|
.usage('yarn flipper-server [args]')
|
||||||
@@ -179,8 +177,6 @@ async function startWatchChanges() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
await remove(serverStaticDir);
|
|
||||||
|
|
||||||
if (dotenv && dotenv.parsed) {
|
if (dotenv && dotenv.parsed) {
|
||||||
console.log('✅ Loaded env vars from .env file: ', dotenv.parsed);
|
console.log('✅ Loaded env vars from .env file: ', dotenv.parsed);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
"rootDir": ".",
|
"rootDir": ".",
|
||||||
"lib": ["ES2019"],
|
"lib": ["ES2019"],
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"esModuleInterop": true
|
"esModuleInterop": true,
|
||||||
|
"types": ["jest"]
|
||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,6 +41,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "../test-utils"
|
"path": "../test-utils"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../scripts"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user