-
Notifications
You must be signed in to change notification settings - Fork 24.7k
Add shared monorepo build setup #38240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,202 @@ | ||
/** | ||
* @flow strict | ||
* @format | ||
*/ | ||
|
||
declare module 'chokidar' { | ||
import type {Stats} from 'fs'; | ||
|
||
declare export class FSWatcher extends events$EventEmitter { | ||
options: WatchOptions; | ||
|
||
/** | ||
* Constructs a new FSWatcher instance with optional WatchOptions parameter. | ||
*/ | ||
constructor(options?: WatchOptions): this; | ||
|
||
/** | ||
* Add files, directories, or glob patterns for tracking. Takes an array of strings or just one | ||
* string. | ||
*/ | ||
add(paths: string | $ReadOnlyArray<string>): this; | ||
|
||
/** | ||
* Stop watching files, directories, or glob patterns. Takes an array of strings or just one | ||
* string. | ||
*/ | ||
unwatch(paths: string | $ReadOnlyArray<string>): this; | ||
|
||
/** | ||
* Returns an object representing all the paths on the file system being watched by this | ||
* `FSWatcher` instance. The object's keys are all the directories (using absolute paths unless | ||
* the `cwd` option was used), and the values are arrays of the names of the items contained in | ||
* each directory. | ||
*/ | ||
getWatched(): { | ||
[directory: string]: string[], | ||
}; | ||
|
||
/** | ||
* Removes all listeners from watched files. | ||
*/ | ||
close(): Promise<void>; | ||
|
||
on( | ||
event: 'add' | 'addDir' | 'change', | ||
listener: (path: string, stats?: Stats) => void, | ||
): this; | ||
|
||
on( | ||
event: 'all', | ||
listener: ( | ||
eventName: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir', | ||
path: string, | ||
stats?: Stats, | ||
) => void, | ||
): this; | ||
|
||
/** | ||
* Error occurred | ||
*/ | ||
on(event: 'error', listener: (error: Error) => void): this; | ||
|
||
/** | ||
* Exposes the native Node `fs.FSWatcher events` | ||
*/ | ||
on( | ||
event: 'raw', | ||
listener: (eventName: string, path: string, details: any) => void, | ||
): this; | ||
|
||
/** | ||
* Fires when the initial scan is complete | ||
*/ | ||
on(event: 'ready', listener: () => void): this; | ||
|
||
on(event: 'unlink' | 'unlinkDir', listener: (path: string) => void): this; | ||
|
||
on(event: string, listener: (...args: any[]) => void): this; | ||
} | ||
|
||
declare export interface WatchOptions { | ||
/** | ||
* Indicates whether the process should continue to run as long as files are being watched. If | ||
* set to `false` when using `fsevents` to watch, no more events will be emitted after `ready`, | ||
* even if the process continues to run. | ||
*/ | ||
persistent?: boolean; | ||
|
||
/** | ||
* ([anymatch](https://github.com/micromatch/anymatch)-compatible definition) Defines files/paths to | ||
* be ignored. The whole relative or absolute path is tested, not just filename. If a function | ||
* with two arguments is provided, it gets called twice per path - once with a single argument | ||
* (the path), second time with two arguments (the path and the | ||
* [`Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object of that path). | ||
*/ | ||
ignored?: string | Array<string>; | ||
|
||
/** | ||
* If set to `false` then `add`/`addDir` events are also emitted for matching paths while | ||
* instantiating the watching as chokidar discovers these file paths (before the `ready` event). | ||
*/ | ||
ignoreInitial?: boolean; | ||
|
||
/** | ||
* When `false`, only the symlinks themselves will be watched for changes instead of following | ||
* the link references and bubbling events through the link's path. | ||
*/ | ||
followSymlinks?: boolean; | ||
|
||
/** | ||
* The base directory from which watch `paths` are to be derived. Paths emitted with events will | ||
* be relative to this. | ||
*/ | ||
cwd?: string; | ||
|
||
/** | ||
* If set to true then the strings passed to .watch() and .add() are treated as literal path | ||
* names, even if they look like globs. Default: false. | ||
*/ | ||
disableGlobbing?: boolean; | ||
|
||
/** | ||
* Whether to use fs.watchFile (backed by polling), or fs.watch. If polling leads to high CPU | ||
* utilization, consider setting this to `false`. It is typically necessary to **set this to | ||
* `true` to successfully watch files over a network**, and it may be necessary to successfully | ||
* watch files in other non-standard situations. Setting to `true` explicitly on OS X overrides | ||
* the `useFsEvents` default. | ||
*/ | ||
usePolling?: boolean; | ||
|
||
/** | ||
* Whether to use the `fsevents` watching interface if available. When set to `true` explicitly | ||
* and `fsevents` is available this supercedes the `usePolling` setting. When set to `false` on | ||
* OS X, `usePolling: true` becomes the default. | ||
*/ | ||
useFsEvents?: boolean; | ||
|
||
/** | ||
* If relying upon the [`Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object that | ||
* may get passed with `add`, `addDir`, and `change` events, set this to `true` to ensure it is | ||
* provided even in cases where it wasn't already available from the underlying watch events. | ||
*/ | ||
alwaysStat?: boolean; | ||
|
||
/** | ||
* If set, limits how many levels of subdirectories will be traversed. | ||
*/ | ||
depth?: number; | ||
|
||
/** | ||
* Interval of file system polling. | ||
*/ | ||
interval?: number; | ||
|
||
/** | ||
* Interval of file system polling for binary files. ([see list of binary extensions](https://gi | ||
* thub.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json)) | ||
*/ | ||
binaryInterval?: number; | ||
|
||
/** | ||
* Indicates whether to watch files that don't have read permissions if possible. If watching | ||
* fails due to `EPERM` or `EACCES` with this set to `true`, the errors will be suppressed | ||
* silently. | ||
*/ | ||
ignorePermissionErrors?: boolean; | ||
|
||
/** | ||
* `true` if `useFsEvents` and `usePolling` are `false`). Automatically filters out artifacts | ||
* that occur when using editors that use "atomic writes" instead of writing directly to the | ||
* source file. If a file is re-added within 100 ms of being deleted, Chokidar emits a `change` | ||
* event rather than `unlink` then `add`. If the default of 100 ms does not work well for you, | ||
* you can override it by setting `atomic` to a custom value, in milliseconds. | ||
*/ | ||
atomic?: boolean | number; | ||
|
||
/** | ||
* can be set to an object in order to adjust timing params: | ||
*/ | ||
awaitWriteFinish?: AwaitWriteFinishOptions | boolean; | ||
} | ||
|
||
declare export interface AwaitWriteFinishOptions { | ||
/** | ||
* Amount of time in milliseconds for a file size to remain constant before emitting its event. | ||
*/ | ||
stabilityThreshold?: number; | ||
|
||
/** | ||
* File size polling interval. | ||
*/ | ||
pollInterval?: number; | ||
} | ||
|
||
/** | ||
* produces an instance of `FSWatcher`. | ||
*/ | ||
declare export function watch( | ||
paths: string | $ReadOnlyArray<string>, | ||
options?: WatchOptions, | ||
): FSWatcher; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow strict | ||
* @format | ||
* @oncall react_native | ||
*/ | ||
|
||
declare module '@pkgjs/parseargs' { | ||
declare type ParseArgsOptionConfig = { | ||
type: 'string' | 'boolean', | ||
short?: string, | ||
multiple?: boolean, | ||
}; | ||
|
||
declare type ParseArgsOptionsConfig = { | ||
[longOption: string]: ParseArgsOptionConfig, | ||
}; | ||
|
||
declare export type ParseArgsConfig = { | ||
strict?: boolean, | ||
allowPositionals?: boolean, | ||
tokens?: boolean, | ||
options?: ParseArgsOptionsConfig, | ||
args?: string[], | ||
}; | ||
|
||
declare type ParsedResults = { | ||
values: { | ||
[longOption: string]: void | string | boolean | Array<string | boolean>, | ||
}, | ||
positionals: string[], | ||
... | ||
}; | ||
|
||
declare export function parseArgs(config: ParseArgsConfig): ParsedResults; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,12 @@ | |
"outputName": "js-test-results.xml" | ||
}, | ||
"scripts": { | ||
"start": "cd packages/rn-tester && npm run start", | ||
"postinstall": "yarn build", | ||
"start": "yarn build && cd packages/rn-tester && npm run start", | ||
"android": "cd packages/rn-tester && npm run android", | ||
"build": "node ./scripts/build/build.js", | ||
"clean": "node ./scripts/build/clean.js", | ||
"watch": "yarn build && node ./scripts/build/watch.js", | ||
Comment on lines
+17
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there's no need for an extra |
||
"test": "jest", | ||
"test-ci": "jest --maxWorkers=2 --ci --reporters=\"default\" --reporters=\"jest-junit\"", | ||
"flow": "flow", | ||
|
@@ -57,11 +61,14 @@ | |
"@babel/plugin-transform-regenerator": "^7.20.0", | ||
"@definitelytyped/dtslint": "^0.0.127", | ||
"@jest/create-cache-key-function": "^29.2.1", | ||
"@pkgjs/parseargs": "^0.11.0", | ||
"@react-native/metro-config": "^0.73.0", | ||
"@types/react": "^18.0.18", | ||
"@typescript-eslint/parser": "^5.57.1", | ||
"async": "^3.2.2", | ||
"babel-plugin-transform-flow-enums": "^0.0.2", | ||
"chalk": "^4.0.0", | ||
"chokidar": "^3.5.3", | ||
"clang-format": "^1.8.0", | ||
"connect": "^3.6.5", | ||
"eslint": "^8.19.0", | ||
|
@@ -79,6 +86,7 @@ | |
"eslint-plugin-redundant-undefined": "^0.4.0", | ||
"eslint-plugin-relay": "^1.8.3", | ||
"flow-bin": "^0.212.0", | ||
"glob": "^7.1.1", | ||
"hermes-eslint": "0.14.0", | ||
"inquirer": "^7.1.0", | ||
"jest": "^29.2.1", | ||
|
@@ -87,6 +95,7 @@ | |
"metro-babel-register": "0.76.2", | ||
"metro-memory-fs": "0.76.2", | ||
"metro-react-native-babel-transformer": "0.76.2", | ||
"micromatch": "^4.0.4", | ||
"mkdirp": "^0.5.1", | ||
"mock-fs": "^5.1.4", | ||
"prettier": "2.8.8", | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,25 +18,12 @@ | |
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "yarn clean && babel src --out-dir dist", | ||
"dev": "babel src --out-dir dist --source-maps --watch", | ||
"clean": "rimraf dist", | ||
"prepare": "yarn build" | ||
}, | ||
Comment on lines
-21
to
-26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are we going to publish this package? If yes, how do we want to provide these scripts and devDeps. to consumer. Context: There's no There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes this package will be published (and depended on in upcoming changes). These There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good to know. 👍 |
||
"dependencies": { | ||
"chrome-launcher": "^0.15.2", | ||
"connect": "^3.6.5", | ||
"node-fetch": "^2.2.0", | ||
"temp-dir": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.20.0", | ||
"@babel/core": "^7.20.0", | ||
"@babel/preset-env": "^7.20.0", | ||
"@babel/preset-flow": "^7.20.0", | ||
"rimraf": "^3.0.2" | ||
}, | ||
"engines": { | ||
"node": ">=18" | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will u pls explain how this is going to help ?