Move plugins to "sonar/desktop/plugins"

Summary:
Plugins moved from "sonar/desktop/src/plugins" to "sonar/desktop/plugins".

Fixed all the paths after moving.

New "desktop" folder structure:
- `src` - Flipper desktop app JS code executing in Electron Renderer (Chrome) process.
- `static` - Flipper desktop app JS code executing in Electron Main (Node.js) process.
- `plugins` - Flipper desktop JS plugins.
- `pkg` - Flipper packaging lib and CLI tool.
- `doctor` - Flipper diagnostics lib and CLI tool.
- `scripts` - Build scripts for Flipper desktop app.
- `headless` - Headless version of Flipper desktop app.
- `headless-tests` - Integration tests running agains Flipper headless version.

Reviewed By: mweststrate

Differential Revision: D20344186

fbshipit-source-id: d020da970b2ea1e001f9061a8782bfeb54e31ba0
This commit is contained in:
Anton Nikolaev
2020-03-14 14:26:07 -07:00
committed by Facebook GitHub Bot
parent beb5c85e69
commit 10d990c32c
133 changed files with 106 additions and 77 deletions

View File

@@ -1,16 +1,18 @@
[ignore]
.*/scripts/.*
.*/coverage/.*
.*/build/.*
.*/pkg/.*
.*/dist/.*
.*/static/.*
<PROJECT_ROOT>/desktop/src/fb/plugins/relaydevtools/relay-devtools/DevtoolsUI.js$
.*/website/.*
<PROJECT_ROOT>/desktop/src/plugins/sections/d3/d3.js$
.*\.tsx
.*\.ts
.*/node_modules/.*
<PROJECT_ROOT>/scripts/.*
<PROJECT_ROOT>/desktop/scripts/.*
<PROJECT_ROOT>/desktop/static/.*
<PROJECT_ROOT>/desktop/pkg/.*
<PROJECT_ROOT>/desktop/doctor/.*
<PROJECT_ROOT>/desktop/plugins/fb/relaydevtools/relay-devtools/DevtoolsUI.js$
<PROJECT_ROOT>/website/.*
<PROJECT_ROOT>/desktop/plugins/sections/d3/d3.js$
<PROJECT_ROOT>/react-native/ReactNativeFlipperExample/.*
[libs]

View File

@@ -43,9 +43,9 @@ This repository includes all parts of Flipper. This includes:
* native Flipper SDKs for Android (`/android`)
* Plugins:
* Logs (`/desktop/src/device-plugins/logs`)
* Layout inspector (`/desktop/src/plugins/layout`)
* Network inspector (`/desktop/src/plugins/network`)
* Shared Preferences/NSUserDefaults inspector (`/desktop/src/plugins/shared_preferences`)
* Layout inspector (`/desktop/plugins/layout`)
* Network inspector (`/desktop/plugins/network`)
* Shared Preferences/NSUserDefaults inspector (`/desktop/plugins/shared_preferences`)
* website and documentation (`/website` / `/docs`)
# Getting started

View File

@@ -1,5 +1,5 @@
*.bundle.js
src/fb/plugins/relaydevtools/relay-devtools/*
plugins/fb/relaydevtools/relay-devtools/*
latest
resources
templates

View File

@@ -237,10 +237,10 @@
"scripts": {
"preinstall": "node scripts/prepare-watchman-config.js && yarn config set ignore-engines",
"postinstall": "cross-env TS_NODE_FILES=true node --require ts-node/register scripts/yarn-install.ts && patch-package",
"rm-dist": "rimraf dist",
"rm-modules": "rimraf node_modules static/node_modules",
"rm-dist": "rimraf ../dist",
"rm-modules": "rimraf plugins/**/node_modules pkg/node_modules doctor/node_modules static/node_modules node_modules",
"rm-temp": "rimraf $TMPDIR/jest* $TMPDIR/react-native-packager*",
"rm-bundle": "rimraf static/main.bundle.*",
"rm-bundle": "rimraf static/main.bundle.* pkg/lib doctor/lib",
"reset": "yarn rm-dist && yarn rm-temp && yarn cache clean && yarn rm-bundle && yarn rm-modules",
"start": "cross-env NODE_ENV=development TS_NODE_FILES=true node --require ts-node/register scripts/start-dev-server.ts --inspect=9229",
"start:break": "cross-env NODE_ENV=development TS_NODE_FILES=true node --require ts-node/register scripts/start-dev-server.ts --inspect-brk=9229",
@@ -252,10 +252,10 @@
"test:debug": "node --inspect node_modules/.bin/jest --runInBand",
"test-electron": "jest --testPathPattern=\"electron\\.(js|tsx)$\" --testEnvironment=@jest-runner/electron/environment --runner=@jest-runner/electron --no-cache",
"test-with-device": "USE_ELECTRON_STUBS=1 jest --testPathPattern=\"device\\.(js|tsx)$\" --detectOpenHandles --no-cache",
"tsc": "tsc --noemit",
"eslint": "eslint . --ext .js,.ts,.tsx",
"flow": "flow check",
"lint": "yarn eslint && yarn flow && yarn tsc",
"lint:tsc": "tsc --noemit",
"lint:eslint": "eslint . --ext .js,.ts,.tsx",
"lint:flow": "flow check",
"lint": "yarn lint:eslint && yarn lint:flow && yarn lint:tsc",
"everything": "yarn reset && yarn install && yarn lint && yarn test && yarn test-electron && yarn build --mac --win --linux && yarn build-headless --mac --linux && yarn start"
},
"optionalDependencies": {

View File

@@ -12,6 +12,7 @@ const path = require('path');
const replaceFBStubs = fs.existsSync(
path.join(__dirname, '..', '..', 'src', 'fb'),
);
const isFBFile = filePath => filePath.includes(`${path.sep}fb${path.sep}`);
const requireFromFolder = (folder, path) =>
new RegExp(folder + '/[A-Za-z0-9.-_]+(.js)?$', 'g').test(path);
@@ -20,7 +21,7 @@ module.exports = function(babel) {
return {
name: 'replace-dynamic-requires',
visitor: {
CallExpression(path) {
CallExpression(path, state) {
if (
replaceFBStubs &&
path.node.type === 'CallExpression' &&
@@ -28,9 +29,12 @@ module.exports = function(babel) {
path.node.callee.name === 'require' &&
path.node.arguments.length > 0
) {
if (requireFromFolder('fb', path.node.arguments[0].value)) {
if (
requireFromFolder('fb', path.node.arguments[0].value) &&
!isFBFile(state.file.opts.filename)
) {
throw new Error(
'Do not require directly from fb/, but rather from fb-stubs/ to not break flow-typing and make sure stubs are up-to-date.',
'For files which are not under fb/ do not require directly from fb/, but rather from fb-stubs/ to not break flow-typing and make sure stubs are up-to-date.',
);
} else if (
requireFromFolder('fb-stubs', path.node.arguments[0].value)

View File

@@ -7,7 +7,7 @@
* @format
*/
import BaseDevice from '../../../devices/BaseDevice.tsx';
import BaseDevice from '../../../src/devices/BaseDevice.tsx';
import CrashReporterPlugin from '../../crash_reporter';
import type {PersistedState, Crash} from '../../crash_reporter';
import {
@@ -16,7 +16,10 @@ import {
parsePath,
shouldShowCrashNotification,
} from '../../crash_reporter';
import {getPluginKey, getPersistedState} from '../../../utils/pluginUtils.tsx';
import {
getPluginKey,
getPersistedState,
} from '../../../src/utils/pluginUtils.tsx';
function setDefaultPersistedState(defaultState: PersistedState) {
CrashReporterPlugin.defaultPersistedState = defaultState;

View File

@@ -35,7 +35,7 @@ import os from 'os';
import util from 'util';
import path from 'path';
import {promisify} from 'util';
import type {Notification} from '../../plugin.tsx';
import type {Notification} from '../../src/plugin.tsx';
import type {Store, DeviceLogEntry, OS, Props} from 'flipper';
import {Component} from 'react';

View File

@@ -10,8 +10,7 @@
import FrescoPlugin from '../index';
import {PersistedState, ImageEventWithId} from '../index';
import {AndroidCloseableReferenceLeakEvent} from '../api';
import {MetricType} from 'flipper';
import {Notification} from '../../../plugin';
import {MetricType, Notification} from 'flipper';
import {ImagesMap} from '../ImagePool';
type ScanDisplayTime = {[scan_number: number]: number};

View File

@@ -30,10 +30,11 @@ import {
colors,
styled,
isProduction,
Notification,
BaseAction,
} from 'flipper';
import ImagesSidebar from './ImagesSidebar';
import ImagePool from './ImagePool';
import {Notification, BaseAction} from '../../plugin';
export type ImageEventWithId = ImageEvent & {eventId: number};

View File

@@ -16,9 +16,9 @@ import {
PluginClient,
SidebarExtensions,
Element,
Client,
Logger,
} from 'flipper';
import Client from '../../Client';
import {Logger} from '../../fb-interfaces/Logger';
import {Component} from 'react';
import deepEqual from 'deep-equal';
import React from 'react';

View File

@@ -12,10 +12,11 @@ import {
TableColumnOrder,
TableColumnSizes,
TableColumns,
Props as PluginProps,
BaseAction,
DeviceLogEntry,
} from 'flipper';
import {Counter} from './LogWatcher';
import {Props as PluginProps, BaseAction} from '../../plugin';
import {DeviceLogEntry} from '../../devices/BaseDevice';
import {
Text,

Some files were not shown because too many files have changed in this diff Show More