-
Notifications
You must be signed in to change notification settings - Fork 24.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove rnc/cli-tools version & errors deps (#45380)
Summary: Pull Request resolved: #45380 Removed the use of version checking and error code that is in react-native-community/cli-tools. Changelog: [Internal] [Changed] - Removed community-cli-plugin version & error dependencies Reviewed By: robhogan Differential Revision: D59378012
- Loading branch information
1 parent
fd40341
commit fa23de7
Showing
5 changed files
with
66 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* 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-local | ||
* @format | ||
* @oncall react_native | ||
*/ | ||
|
||
/** | ||
* A custom Error that creates a single-lined message to match current styling inside CLI. | ||
* Uses original stack trace when `originalError` is passed or erase the stack if it's not defined. | ||
*/ | ||
export class CLIError extends Error { | ||
constructor(msg: string, originalError?: Error | string) { | ||
super(inlineString(msg)); | ||
if (originalError != null) { | ||
this.stack = | ||
typeof originalError === 'string' | ||
? originalError | ||
: originalError.stack || ''.split('\n').slice(0, 2).join('\n'); | ||
} else { | ||
// When the "originalError" is not passed, it means that we know exactly | ||
// what went wrong and provide means to fix it. In such cases showing the | ||
// stack is an unnecessary clutter to the CLI output, hence removing it. | ||
this.stack = ''; | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Raised when we're unable to find a package.json | ||
*/ | ||
export class UnknownProjectError extends Error {} | ||
|
||
export const inlineString = (str: string = ''): string => | ||
str.replace(/(\s{2,})/gm, ' ').trim(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters