Split package "flipper-pkg" into two: lib and cli
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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
4395b19140
commit
21b79af5f2
@@ -15,6 +15,7 @@
|
|||||||
"doctor",
|
"doctor",
|
||||||
"headless-tests",
|
"headless-tests",
|
||||||
"pkg",
|
"pkg",
|
||||||
|
"pkg-lib",
|
||||||
"static",
|
"static",
|
||||||
"plugins/*"
|
"plugins/*"
|
||||||
],
|
],
|
||||||
@@ -98,7 +99,8 @@
|
|||||||
"moduleNameMapper": {
|
"moduleNameMapper": {
|
||||||
"^flipper$": "<rootDir>/app/src",
|
"^flipper$": "<rootDir>/app/src",
|
||||||
"^flipper-doctor$": "<rootDir>/doctor/src",
|
"^flipper-doctor$": "<rootDir>/doctor/src",
|
||||||
"^flipper-pkg$": "<rootDir>/pkg/src"
|
"^flipper-pkg$": "<rootDir>/pkg/src",
|
||||||
|
"^flipper-pkg-lib$": "<rootDir>/pkg-lib/src"
|
||||||
},
|
},
|
||||||
"clearMocks": true
|
"clearMocks": true
|
||||||
},
|
},
|
||||||
@@ -168,7 +170,8 @@
|
|||||||
"eslint-plugin-prettier": "^3.1.2",
|
"eslint-plugin-prettier": "^3.1.2",
|
||||||
"eslint-plugin-react": "^7.16.0",
|
"eslint-plugin-react": "^7.16.0",
|
||||||
"eslint-plugin-relay": "^1.4.1",
|
"eslint-plugin-relay": "^1.4.1",
|
||||||
"flipper-pkg": "0.37.0",
|
"flipper-babel-transformer": "0.37.0",
|
||||||
|
"flipper-pkg-lib": "0.37.0",
|
||||||
"flow-bin": "^0.122.0",
|
"flow-bin": "^0.122.0",
|
||||||
"fs-extra": "^8.1.0",
|
"fs-extra": "^8.1.0",
|
||||||
"glob": "^7.1.2",
|
"glob": "^7.1.2",
|
||||||
|
|||||||
21
desktop/pkg-lib/LICENSE
Normal file
21
desktop/pkg-lib/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
4
desktop/pkg-lib/README.md
Normal file
4
desktop/pkg-lib/README.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# flipper-pkg
|
||||||
|
|
||||||
|
`flipper-pkg-lib` is a **work-in-progress** library for bundling and publishing
|
||||||
|
Flipper plugins.
|
||||||
8
desktop/pkg-lib/jestconfig.json
Normal file
8
desktop/pkg-lib/jestconfig.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"transform": {
|
||||||
|
"^.+\\.tsx?$": "ts-jest"
|
||||||
|
},
|
||||||
|
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
|
||||||
|
"testPathIgnorePatterns": ["/node_modules/", "/lib/"],
|
||||||
|
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"]
|
||||||
|
}
|
||||||
41
desktop/pkg-lib/package.json
Normal file
41
desktop/pkg-lib/package.json
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"name": "flipper-pkg-lib",
|
||||||
|
"version": "0.37.0",
|
||||||
|
"description": "Library for building and publishing Flipper plugins",
|
||||||
|
"repository": "facebook/flipper",
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"flipper:source": "src",
|
||||||
|
"types": "lib/index.d.ts",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": "https://github.com/facebook/flipper/issues",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/fs-extra": "^8.1.0",
|
||||||
|
"@types/node": "^13.7.5",
|
||||||
|
"fs-extra": "^8.1.0",
|
||||||
|
"flipper-babel-transformer": "0.37.0",
|
||||||
|
"metro": "^0.59.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/jest": "^25.1.0",
|
||||||
|
"globby": "^10",
|
||||||
|
"jest": "^25.1.0",
|
||||||
|
"prettier": "^2.0.0",
|
||||||
|
"rimraf": "^3.0.2",
|
||||||
|
"ts-jest": "^25.2.1",
|
||||||
|
"ts-node": "^8",
|
||||||
|
"typescript": "^3.7.2"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"reset": "rimraf lib *.tsbuildinfo",
|
||||||
|
"build": "tsc -b",
|
||||||
|
"prepack": "yarn reset && yarn build"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"lib/**/*"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/facebook/flipper",
|
||||||
|
"keywords": [
|
||||||
|
"Flipper"
|
||||||
|
],
|
||||||
|
"author": "Facebook, Inc"
|
||||||
|
}
|
||||||
12
desktop/pkg-lib/src/__tests__/index.node.ts
Normal file
12
desktop/pkg-lib/src/__tests__/index.node.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
test('tests are working', () => {
|
||||||
|
expect(true).toBeTruthy();
|
||||||
|
});
|
||||||
11
desktop/pkg-lib/src/index.ts
Normal file
11
desktop/pkg-lib/src/index.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
export {default as runBuild} from './runBuild';
|
||||||
|
export {default as getWatchFolders} from './getWatchFolders';
|
||||||
13
desktop/pkg-lib/tsconfig.json
Normal file
13
desktop/pkg-lib/tsconfig.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"extends": "../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "lib",
|
||||||
|
"rootDir": "src",
|
||||||
|
"allowJs": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"composite": true
|
||||||
|
},
|
||||||
|
"references": [{"path": "../babel-transformer"}],
|
||||||
|
"include": ["src"],
|
||||||
|
"exclude": ["node_modules", "**/__tests__/*"]
|
||||||
|
}
|
||||||
7
desktop/pkg-lib/tslint.json
Normal file
7
desktop/pkg-lib/tslint.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"extends": ["tslint:recommended", "tslint-config-prettier"],
|
||||||
|
"rules": {
|
||||||
|
"interface-name": false,
|
||||||
|
"variable-name": false
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,10 +20,8 @@
|
|||||||
"@types/node": "^13.7.5",
|
"@types/node": "^13.7.5",
|
||||||
"cli-ux": "^5.4.5",
|
"cli-ux": "^5.4.5",
|
||||||
"fs-extra": "^8.1.0",
|
"fs-extra": "^8.1.0",
|
||||||
"flipper-babel-transformer": "0.37.0",
|
"flipper-pkg-lib": "0.37.0",
|
||||||
"inquirer": "^7.0.5",
|
"inquirer": "^7.0.5"
|
||||||
"metro": "^0.59.0",
|
|
||||||
"tslib": "^1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@oclif/dev-cli": "^1",
|
"@oclif/dev-cli": "^1",
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import * as inquirer from 'inquirer';
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as yarn from '../utils/yarn';
|
import * as yarn from '../utils/yarn';
|
||||||
import cli from 'cli-ux';
|
import cli from 'cli-ux';
|
||||||
import runBuild from '../utils/runBuild';
|
import {runBuild} from 'flipper-pkg-lib';
|
||||||
|
|
||||||
async function deriveOutputFileName(inputDirectory: string): Promise<string> {
|
async function deriveOutputFileName(inputDirectory: string): Promise<string> {
|
||||||
const packageJson = await readJSON(path.join(inputDirectory, 'package.json'));
|
const packageJson = await readJSON(path.join(inputDirectory, 'package.json'));
|
||||||
|
|||||||
@@ -9,5 +9,3 @@
|
|||||||
|
|
||||||
export {run} from '@oclif/command';
|
export {run} from '@oclif/command';
|
||||||
export const PKG = 'flipper-pkg';
|
export const PKG = 'flipper-pkg';
|
||||||
export {default as runBuild} from './utils/runBuild';
|
|
||||||
export {default as getWatchFolders} from './utils/getWatchFolders';
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"esModuleInterop": true
|
"esModuleInterop": true
|
||||||
},
|
},
|
||||||
"references": [{"path": "../babel-transformer"}],
|
"references": [{"path": "../pkg-lib"}],
|
||||||
"include": ["src"],
|
"include": ["src"],
|
||||||
"exclude": ["node_modules", "**/__tests__/*"]
|
"exclude": ["node_modules", "**/__tests__/*"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import tmp from 'tmp';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import {spawn} from 'promisify-child-process';
|
import {spawn} from 'promisify-child-process';
|
||||||
import {getWatchFolders} from 'flipper-pkg';
|
import {getWatchFolders} from 'flipper-pkg-lib';
|
||||||
import getAppWatchFolders from './get-app-watch-folders';
|
import getAppWatchFolders from './get-app-watch-folders';
|
||||||
import getPlugins from '../static/getPlugins';
|
import getPlugins from '../static/getPlugins';
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import {getWatchFolders} from 'flipper-pkg';
|
import {getWatchFolders} from 'flipper-pkg-lib';
|
||||||
import {appDir, pluginsDir} from './paths';
|
import {appDir, pluginsDir} from './paths';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import util from 'util';
|
|||||||
import recursiveReaddir from 'recursive-readdir';
|
import recursiveReaddir from 'recursive-readdir';
|
||||||
import pMap from 'p-map';
|
import pMap from 'p-map';
|
||||||
import {homedir} from 'os';
|
import {homedir} from 'os';
|
||||||
import {getWatchFolders} from 'flipper-pkg';
|
import {getWatchFolders} from 'flipper-pkg-lib';
|
||||||
import {default as getPlugins, PluginManifest, PluginInfo} from './getPlugins';
|
import {default as getPlugins, PluginManifest, PluginInfo} from './getPlugins';
|
||||||
import startWatchPlugins from './startWatchPlugins';
|
import startWatchPlugins from './startWatchPlugins';
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"fix-path": "^3.0.0",
|
"fix-path": "^3.0.0",
|
||||||
"fs-extra": "^8.1.0",
|
"fs-extra": "^8.1.0",
|
||||||
"flipper-babel-transformer": "0.37.0",
|
"flipper-babel-transformer": "0.37.0",
|
||||||
"flipper-pkg": "0.37.0",
|
"flipper-pkg-lib": "0.37.0",
|
||||||
"mem": "^6.0.0",
|
"mem": "^6.0.0",
|
||||||
"metro": "^0.59.0",
|
"metro": "^0.59.0",
|
||||||
"mkdirp": "^1.0.0",
|
"mkdirp": "^1.0.0",
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
"flipper": ["./app/src"],
|
"flipper": ["./app/src"],
|
||||||
"flipper-doctor": ["./doctor/src"],
|
"flipper-doctor": ["./doctor/src"],
|
||||||
"flipper-pkg": ["./pkg/src"],
|
"flipper-pkg": ["./pkg/src"],
|
||||||
|
"flipper-pkg-lib": ["./pkg-lib/src"],
|
||||||
"live-plugin-manager": ["./types/live-plugin-manager.d.tsx"],
|
"live-plugin-manager": ["./types/live-plugin-manager.d.tsx"],
|
||||||
"flipper-babel-transformer": ["./babel-transformer/src"]
|
"flipper-babel-transformer": ["./babel-transformer/src"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user