Summary:
Upgrading to TypeScript 3.9 so that we can use `// ts-expect-error`, that allows us to basically write unit tests for typings.
Fixed the typescript path in `settings.json`, because otherwise VSCode kept picking the built-in version (3.8.3 atm) of ts when opening the `sonar` folder as workspace.
Reviewed By: passy
Differential Revision: D22255818
fbshipit-source-id: ae54aedb237445f32f1797b4290656dbfb0e528f
Summary: Changelog: Added command `flipper-pkg checksum` for computing the total checksum of all the files included into plugin package.
Reviewed By: passy
Differential Revision: D22255125
fbshipit-source-id: a4f91370b4ab16ea4ce4a60e29f9d20fdd5f4331
Summary: After some testing I found file source map does not work as expected when prod version of Flipper is used to debug plugin. So returning back inline source maps. Note that this only affects debug builds, for production builds no source maps will be produced anyway.
Reviewed By: passy
Differential Revision: D22161927
fbshipit-source-id: 068b9da09da4dcb6c31aff4e5a15bd6438f686b3
Summary: Disabled producing inline source maps for debug builds. Source maps are already writte to "map" files, so this does not make sense to also inline them to the js bundle. Passing "sourceMapUrl" parameter to Metro fixed this.
Reviewed By: mweststrate
Differential Revision: D22159501
fbshipit-source-id: f06225cd43f44a7f93afcc32bb0501323b35d0c3
Summary: Use default Metro implementation of source module ID mappings for "flipper-pkg bundle". The problem with the custom implementation we used before is that it is not deterministic, i.e. produced bundles are different on different machines. We need deterministic bundles to reliably detect if the version changed from the last deployment to Marketplace.
Reviewed By: mweststrate
Differential Revision: D22158794
fbshipit-source-id: ae4b4b05e020489c0900423107a938a5b670e7d8
Summary: Our external typings were only effective for the main "app" package. In this diff I've made them effective for all other workspaces too, and also cleaned up typescript configs.
Reviewed By: passy
Differential Revision: D21927361
fbshipit-source-id: ceb8009255583d969d79cc11b20dfe8b686f2fb3
Summary: This is required for the new release of promisify-child-process.
Reviewed By: mweststrate
Differential Revision: D21543812
fbshipit-source-id: dc254ea51381696b9927f7c62dd36e10ef00fcac
Summary: "migrate" command for easy migration of existing Flipper plugins to the specification version 2.
Reviewed By: passy
Differential Revision: D21253913
fbshipit-source-id: 9edb170fbaa10e9c3f670d5d68e69f4f6106c151
Summary:
Implemented json schema for flipper plugin package.json and used it for validation in "flipper-pkg lint" command.
Nice thing about json schema is that it not only allows to validate json, but also can be referenced using "$schema" property in json so IDEs like VSCode can find it and use for code completion, validation and to show properties documentation. I'm going to deploy the schema as a part of documentation website so it can be referenced as https://fbflipper.com/schemas/plugin-package/v2.json.
Also the "$schema" field can be used instead of "specVersion" to determine the specification according to which the plugin is defined. E.g., if specification version 3 would be created, it will be described in schema https://fbflipper.com/schemas/plugin-package/v3.json, etc.
Reviewed By: passy
Differential Revision: D21228294
fbshipit-source-id: f21351e584ef936a7d6b314436448489691f83a6
Summary: Added eslint rule "no-extraneous-imports" which disallow using modules which are not listed as dependencies in the corresponding package.json. Fixed a bunch of reported errors after the rule applied.
Reviewed By: passy
Differential Revision: D21186848
fbshipit-source-id: 0af9ac4b3fffdfd0ab7c23ae4ff12a3f5989d5e9
Summary: Fixed plugin compilation in release build. One dependency was missing from the final package.
Reviewed By: jknoxville, passy
Differential Revision: D21174687
fbshipit-source-id: 311e04b3ab782093bdbb8f1b81191380320e94d0
Summary: This shaves another ~6MB of the zipped build. Less than I would have thought, but I haven't looked at the alternative options so far at all.
Reviewed By: nikoant
Differential Revision: D21131772
fbshipit-source-id: 641515d6f36fdeeffa5be81d64c2c1043a9e4e34
Summary:
Added "id" field to Flipper plugin manifest which is used to match native and desktop plugin parts. Before that, "name" field was used both as npm package name and as plugin id.
The problem is that currently there are a lot of plugins which has invalid values in "name", e.g. not starting with "flipper-package-", or containing upper cased letters.
Simple renaming of "name" field can be very problematic, so we need a new field to avoid any breaking changes and keep historical analytics data which is also bound to plugin id.
Reviewed By: mweststrate
Differential Revision: D21129689
fbshipit-source-id: efd143c82a6a802cc0b5438fd3f509bd99aded0e
Summary: Re-use the same function for plugin building both at publishing time by "flipper-pkg" and in runtime by Flipper itself.
Reviewed By: jknoxville
Differential Revision: D21129685
fbshipit-source-id: b7bff6737310352d28a14223128f127ac4d2eebf
Summary:
Added versioning for plugin format.
The first version is where "main" points to source code entry and plugins are bundled by Flipper in run-time on loading them.
The second version is where "main" points to the already existing bundle and Flipper just loads it without bundling. The plugins of version 2 must be bundled using "flipper-pkg" tool before publishing.
Changelog: Support new packaging format for plugins.
Reviewed By: mweststrate
Differential Revision: D21074173
fbshipit-source-id: 7b70250e48e5bd5d359c96149fb5b14e67783c4d
Summary: Set typings as devDependencies for pkg and pkg-lib packages
Reviewed By: passy
Differential Revision: D21092027
fbshipit-source-id: 7750f1796458bd88ea9ff620f3bb2e3e14ea7ca0
Summary: "flipper-pkg" added ~2MB to Flipper disttributive size, because of heavy dependencies which are only required for CLI functionality. See size warning in diff D21068373 in this stack where I added pkg as dependency to flipper. Here I'm splitting it into library and CLI packages, so Flipper app will only reference the library.
Reviewed By: passy
Differential Revision: D21087336
fbshipit-source-id: d9d62f1e75a835d1c0fa78ff1addb0d9a761a9c7