Commit Graph

12 Commits

Author SHA1 Message Date
Anton Nikolaev
a4eb2a56d6 Option for "yarn start" and "yarn build" scripts to pre-install default plugin packages instead of bundling them
Summary:
Sorry for long diff! I can try to split it if necessary, but many changes here are 1-1 replacements / renames.

**Preambule**
Currently we bundle default plugins into the Flipper main bundle. This helps us to reduce bundle size, because of plugin dependencies re-use. E.g. if multiple plugins use "lodash" when they are bundled together, only one copy of "lodash" added. When they are bundled separately, the same dependency might be added to each of them. However as we're not going to include most of plugins into Flipper distributive anymore and going to rely on Marketplace instead, this bundling doesn't provide significant size benefits anymore. In addition to that, bundling makes it impossible to differentiate whether thrown errors are originated from Flipper core or one of its plugins.

Why don't we remove plugin bundling at all? Because for "dev mode" it actually quite useful. It makes dev build start much faster and also enables using of Fast Refresh for plugin development (fast refresh won't work for plugins loaded from disk).

**Changes**
This diff introduces new option "no-bundled-plugins" for "yarn start" and "yarn build" commands. For now, by default, we will continue bundling default plugins into the Flipper main bundle, but if this option provided then we will build each default plugin separately and include their packages into the Flipper distributive as "pre-installed" to be able to load them from disk even without access to Marketplace.

For "yarn start", we're adding symlinks to plugin folders in "static/defaultPlugins" and then they are loaded by Flipper. For "yarn build" we are dereferencing these symlinks to include physical files of plugins into folder "defaultPlugins" of the produced distributive. Folder "defaultPlugins" is excluded from asar, because loading of plugins from asar archive might introduce some unexpected issues depending on their implementation.

Reviewed By: mweststrate

Differential Revision: D28431838

fbshipit-source-id: f7757e9f5ba9183ed918d70252de3ce0e823177d
2021-05-18 08:08:30 -07:00
Anton Nikolaev
b3274a8450 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
2021-04-09 05:22:00 -07:00
Anton Nikolaev
228d09d572 Script for resolving plugin directory by its package name
Summary:
Changed "build-plugin" script to allow triggering release by plugin name (required to enable triggering releases by button in Marketplace):
1) Added new script to resolve plugin dir by name
2) Allow passing either plugin dir or name to "build-plugin" script

Reviewed By: passy

Differential Revision: D22354643

fbshipit-source-id: b7aca57acefc81ca0b6d9c7f359f63d8f0599e39
2020-07-02 02:48:19 -07:00
Anton Nikolaev
dcd909779b Script to list all plugins included into Flipper desktop workspaces
Summary: Script to list all plugins included into Flipper desktop workspaces.

Reviewed By: passy

Differential Revision: D22256917

fbshipit-source-id: a3d8a0f9faea6e462a2f22be155d99eb22eb59d8
2020-06-26 09:07:12 -07:00
Anton Nikolaev
696ca8e604 Bump script updated to also bump plugin versions
Summary:
Updated "bump-versions" script to also bump version of all plugins when we're releasing Flipper.

Changelog: Versions of bundled plugins will be matching Flipper core version.

Reviewed By: mweststrate

Differential Revision: D22042960

fbshipit-source-id: b2d361ce9cbfc8022e12aecbbf7c6101029844e5
2020-06-15 09:28:23 -07:00
Anton Nikolaev
8473bc9ecf Fix npm publishing script
Summary: Npm publishing script should not attempt to publish plugin packages

Reviewed By: mweststrate

Differential Revision: D21721175

fbshipit-source-id: 0bf9808339c1177bc9d263ac34d40aa30df08d11
2020-05-26 06:44:25 -07:00
Anton Nikolaev
6005d039f7 Dry-run for version bumping and npm publishing scripts
Summary: To make testing easier, I've implemented dry-run for version bumping and npm publishing scripts

Reviewed By: mweststrate

Differential Revision: D21721142

fbshipit-source-id: 72fc5a78bfc102a8fca9087decfbed6ebbda5e51
2020-05-26 06:44:25 -07:00
Anton Nikolaev
fc18bafb71 Fix workspace version bumping script to also bump peerDependencies
Summary: Fixed bumping of local peer dependencies and manually bumped the version which was not bumped automatically during the latest release.

Reviewed By: passy

Differential Revision: D21308701

fbshipit-source-id: 936a04b432ad3c9313644c1bf96966c52e022d7e
2020-04-30 04:32:36 -07:00
Anton Nikolaev
fe09dae237 Update tutorial to reflect changes in plugin packaging format
Summary: Tutorial updated to reflect changes in plugin packaging format

Reviewed By: passy

Differential Revision: D21161268

fbshipit-source-id: b7c6d272be8dd56b76a0af87acdc347df4216f6c
2020-04-23 05:58:39 -07:00
Anton Nikolaev
75fb681eb8 Fixed version bumping for devDependencies
Summary: Fixed bumping versions for local packages added as devDependencies

Reviewed By: passy

Differential Revision: D21154758

fbshipit-source-id: 234fdf073b9bc166eb9deb78a879bc1380d0d1bc
2020-04-21 07:05:07 -07:00
Anton Nikolaev
2690894ad0 Fix npm publishing
Summary:
Fixed npm packaging/publishing scripts for "flipper-doctor", "flipper-pkg" and "flipper-babel-transformer".

Also removed scripts for testing and linting, because these packages are tested and linted by root level package.json.

Reviewed By: jknoxville

Differential Revision: D20839959

fbshipit-source-id: 4d9d037d4921fc97356c849054c389dfece05652
2020-04-06 02:35:51 -07:00
Anton Nikolaev
bf32297ad9 Publish all packages to npm on release
Summary: Publish all the public packages (excluding those with "private=true") included as workspaces to "desktop" project.

Reviewed By: jknoxville

Differential Revision: D20765097

fbshipit-source-id: 444541e9a682a90eba02cb3da85ada9bd00d93d0
2020-03-31 06:34:39 -07:00