Plugin folders re-structuring
Summary: Here I'm changing plugin repository structure to allow re-using of shared packages between both public and fb-internal plugins, and to ensure that public plugins has their own yarn.lock as this will be required to implement reproducible jobs checking plugin compatibility with released flipper versions. Please note that there are a lot of moved files in this diff, make sure to click "Expand all" to see all that actually changed (there are not much of them actually). New proposed structure for plugin packages: ``` - root - node_modules - modules included into Flipper: flipper, flipper-plugin, react, antd, emotion -- plugins --- node_modules - modules used by both public and fb-internal plugins (shared libs will be linked here, see D27034936) --- public ---- node_modules - modules used by public plugins ---- pluginA ----- node_modules - modules used by plugin A exclusively ---- pluginB ----- node_modules - modules used by plugin B exclusively --- fb ---- node_modules - modules used by fb-internal plugins ---- pluginC ----- node_modules - modules used by plugin C exclusively ---- pluginD ----- node_modules - modules used by plugin D exclusively ``` I've moved all public plugins under dir "plugins/public" and excluded them from root yarn workspaces. Instead, they will have their own yarn workspaces config and yarn.lock and they will use flipper modules as peer dependencies. Reviewed By: mweststrate Differential Revision: D27034108 fbshipit-source-id: c2310e3c5bfe7526033f51b46c0ae40199fd7586
This commit is contained in:
committed by
Facebook GitHub Bot
parent
32bf4c32c2
commit
b3274a8450
@@ -320,7 +320,7 @@ test('errors end up as notifications if crash reporter is active', async () => {
|
||||
});
|
||||
|
||||
// eslint-disable-next-line
|
||||
const CrashReporterImpl = require('../../../../plugins/crash_reporter/index');
|
||||
const CrashReporterImpl = require('../../../../plugins/public/crash_reporter/index');
|
||||
const CrashPlugin = TestUtils.createTestDevicePlugin(CrashReporterImpl, {
|
||||
id: 'CrashReporter',
|
||||
});
|
||||
@@ -365,7 +365,7 @@ test('errors end NOT up as notifications if crash reporter is active but suppres
|
||||
});
|
||||
|
||||
// eslint-disable-next-line
|
||||
const CrashReporterImpl = require('../../../../plugins/crash_reporter/index');
|
||||
const CrashReporterImpl = require('../../../../plugins/public/crash_reporter/index');
|
||||
const CrashPlugin = TestUtils.createTestDevicePlugin(CrashReporterImpl, {
|
||||
id: 'CrashReporter',
|
||||
});
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
import {State} from '../../reducers';
|
||||
|
||||
// eslint-disable-next-line flipper/no-relative-imports-across-packages
|
||||
import type {NavigationPlugin} from '../../../../plugins/navigation/index';
|
||||
import type {NavigationPlugin} from '../../../../plugins/public/navigation/index';
|
||||
import {useMemoize} from 'flipper-plugin';
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
import {switchPlugin} from '../../../reducers/pluginManager';
|
||||
|
||||
// eslint-disable-next-line
|
||||
import * as LogsPluginModule from '../../../../../plugins/logs/index';
|
||||
import * as LogsPluginModule from '../../../../../plugins/public/logs/index';
|
||||
import {createMockDownloadablePluginDetails} from '../../../utils/testUtils';
|
||||
import {computePluginLists} from '../../../utils/pluginUtils';
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
"path": "../test-utils"
|
||||
},
|
||||
{
|
||||
"path": "../plugins/navigation"
|
||||
"path": "../plugins/public/navigation"
|
||||
}
|
||||
],
|
||||
"exclude": [
|
||||
|
||||
@@ -106,6 +106,7 @@
|
||||
"@types/react-virtualized": "^9.21.11",
|
||||
"@types/react-virtualized-auto-sizer": "^1.0.0",
|
||||
"@types/react-window": "^1.8.1",
|
||||
"@types/recharts": "^1.8.19",
|
||||
"@types/recursive-readdir": "^2.2.0",
|
||||
"@types/redux-devtools-extension": "^2.13.2",
|
||||
"@types/redux-mock-store": "^1.0.1",
|
||||
@@ -168,6 +169,7 @@
|
||||
"node-fetch": "^2.6.1",
|
||||
"p-filter": "^2.1.0",
|
||||
"p-map": "^4.0.0",
|
||||
"patch-package": "^6.4.7",
|
||||
"prettier": "^2.2.1",
|
||||
"pretty-format": "^26.1.0",
|
||||
"promisify-child-process": "^4.1.0",
|
||||
@@ -230,7 +232,7 @@
|
||||
"lint:tsc": "tsc --noemit",
|
||||
"list-plugins": "./ts-node scripts/list-plugins.ts",
|
||||
"open-dist": "open ../dist/mac/Flipper.app --args --launcher=false --inspect=9229",
|
||||
"postinstall": "patch-package && ./ts-node scripts/gen-type-index.ts &&./ts-node scripts/yarn-install-fb-plugins.ts && yarn build:tsc && ./ts-node scripts/generate-plugin-entry-points.ts && yarn build:themes",
|
||||
"postinstall": "patch-package && ./ts-node scripts/gen-type-index.ts && yarn --cwd plugins install --mutex network:30331 && yarn build:tsc && ./ts-node scripts/generate-plugin-entry-points.ts && yarn build:themes",
|
||||
"prebuild": "yarn build:tsc && yarn rm-dist && yarn build:themes",
|
||||
"predev-server": "yarn build:tsc",
|
||||
"preinstall": "node scripts/prepare-watchman-config.js && yarn config set ignore-engines",
|
||||
@@ -257,9 +259,6 @@
|
||||
},
|
||||
"version": "0.84.0",
|
||||
"workspaces": {
|
||||
"nohoist": [
|
||||
"flipper-plugin-kaios-big-allocations/firefox-client"
|
||||
],
|
||||
"packages": [
|
||||
"app",
|
||||
"app/src/fb/*",
|
||||
@@ -269,7 +268,6 @@
|
||||
"pkg-lib",
|
||||
"flipper-plugin",
|
||||
"static",
|
||||
"plugins/*",
|
||||
"e2e",
|
||||
"plugin-lib",
|
||||
"test-utils",
|
||||
|
||||
@@ -41,7 +41,7 @@ export async function getPluginSourceFolders(): Promise<string[]> {
|
||||
pluginFolders.push(...config.pluginPaths);
|
||||
}
|
||||
}
|
||||
pluginFolders.push(path.resolve(__dirname, '..', '..', 'plugins'));
|
||||
pluginFolders.push(path.resolve(__dirname, '..', '..', 'plugins', 'public'));
|
||||
pluginFolders.push(path.resolve(__dirname, '..', '..', 'plugins', 'fb'));
|
||||
return pluginFolders.map(expandTilde).filter(fs.existsSync);
|
||||
}
|
||||
|
||||
15
desktop/plugins/package.json
Normal file
15
desktop/plugins/package.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "flipper-plugins",
|
||||
"private": true,
|
||||
"title": "Flipper Plugins",
|
||||
"bugs": {
|
||||
"email": "oncall+flipper@xmail.facebook.com",
|
||||
"url": "https://fb.workplace.com/groups/flippersupport/"
|
||||
},
|
||||
"devDependencies": {
|
||||
"fs-extra": "^9.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "../ts-node ./postinstall.ts"
|
||||
}
|
||||
}
|
||||
36
desktop/plugins/postinstall.ts
Normal file
36
desktop/plugins/postinstall.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {execSync} from 'child_process';
|
||||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
|
||||
async function postinstall() {
|
||||
const publicPluginsDir = path.join(__dirname, 'public');
|
||||
execSync('yarn install --mutex network:30330', {
|
||||
cwd: publicPluginsDir,
|
||||
stdio: 'inherit',
|
||||
});
|
||||
const fbPluginsDir = path.join(__dirname, 'fb');
|
||||
if (await fs.pathExists(fbPluginsDir)) {
|
||||
execSync('yarn install --mutex network:30330', {
|
||||
cwd: fbPluginsDir,
|
||||
stdio: 'inherit',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
postinstall()
|
||||
.then(() => {
|
||||
process.exit(0);
|
||||
})
|
||||
.catch((err: any) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -11,7 +11,7 @@ import {render, fireEvent} from '@testing-library/react';
|
||||
import React from 'react';
|
||||
// TODO T71355623
|
||||
// eslint-disable-next-line flipper/no-relative-imports-across-packages
|
||||
import reducers, {Store} from '../../../app/src/reducers';
|
||||
import reducers, {Store} from '../../../../app/src/reducers';
|
||||
import configureStore from 'redux-mock-store';
|
||||
import {Provider} from 'react-redux';
|
||||
|
||||
@@ -22,10 +22,7 @@
|
||||
"prepack": "flipper-pkg lint && flipper-pkg bundle --production"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"flipper": "0.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"flipper": "0.0.0",
|
||||
"flipper-pkg": "0.0.0"
|
||||
"flipper": "*",
|
||||
"flipper-pkg": "*"
|
||||
}
|
||||
}
|
||||
@@ -22,10 +22,7 @@
|
||||
"prepack": "flipper-pkg lint && flipper-pkg bundle --production"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"flipper": "0.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"flipper": "0.0.0",
|
||||
"flipper-pkg": "0.0.0"
|
||||
"flipper": "*",
|
||||
"flipper-pkg": "*"
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@
|
||||
],
|
||||
"dependencies": {},
|
||||
"peerDependencies": {
|
||||
"flipper-plugin": "0.0.0"
|
||||
"flipper-plugin": "*"
|
||||
},
|
||||
"title": "Logs",
|
||||
"icon": "arrow-right",
|
||||
@@ -15,7 +15,7 @@
|
||||
"email": "beneloca@fb.com"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"flipper-plugin": "0.0.0",
|
||||
"flipper-plugin": "*",
|
||||
"antd": "*"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"extends": "../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"rootDir": ".",
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user