@expo/xcpretty
Advanced tools
Comparing version 2.0.2 to 3.0.0
@@ -34,3 +34,4 @@ import { Failure, Parser } from './Parser'; | ||
static getAppRoot: typeof getAppRoot; | ||
parser: Parser; | ||
_parser: Parser | undefined; | ||
get parser(): Parser; | ||
errors: string[]; | ||
@@ -46,2 +47,3 @@ warnings: string[]; | ||
formatCopy({ from, to }: CopyFileProps): string; | ||
getFileOperationTitle(type: FileOperation['type']): string; | ||
formatFileOperation(props: FileOperation): string; | ||
@@ -131,3 +133,4 @@ formatPhaseSuccess(phaseName: string, duration?: string): string; | ||
optionalNewline(): string; | ||
getBuildSummary(): string; | ||
} | ||
export {}; |
@@ -34,2 +34,3 @@ "use strict"; | ||
const switchRegex_1 = require("./switchRegex"); | ||
const symbols_1 = require("./utils/symbols"); | ||
var Status; | ||
@@ -44,12 +45,2 @@ (function (Status) { | ||
})(Status || (Status = {})); | ||
const USE_ASCII = false; | ||
const PASS = '✓'; | ||
const FAIL = '✗'; | ||
const PENDING = '⧖'; | ||
const COMPLETION = '\u203A'; //'▸'; | ||
const MEASURE = '◷'; | ||
const ERROR = USE_ASCII ? '[x]' : '❌ '; | ||
const WARNING = USE_ASCII ? '[!]' : '⚠️ '; | ||
const INDENT = ' '; | ||
const BREADCRUMB = '»'; | ||
function format(command, argumentText = '', success = true) { | ||
@@ -68,13 +59,13 @@ const symbol = statusSymbol(success ? Status.Completion : Status.Fail); | ||
case Status.Pass: | ||
return chalk_1.default.green(PASS); | ||
return chalk_1.default.green(symbols_1.PASS); | ||
case Status.Fail: | ||
return chalk_1.default.red(FAIL); | ||
return chalk_1.default.red(symbols_1.FAIL); | ||
case Status.Pending: | ||
return chalk_1.default.cyan(PENDING); | ||
return chalk_1.default.cyan(symbols_1.PENDING); | ||
case Status.Error: | ||
return chalk_1.default.red(ERROR); | ||
return chalk_1.default.red(symbols_1.ERROR); | ||
case Status.Completion: | ||
return chalk_1.default.white(COMPLETION); | ||
return chalk_1.default.white(symbols_1.COMPLETION); | ||
case Status.Measure: | ||
return chalk_1.default.magenta(MEASURE); | ||
return chalk_1.default.magenta(symbols_1.MEASURE); | ||
default: | ||
@@ -104,3 +95,3 @@ return ''; | ||
.filter(Boolean) | ||
.join(` ${BREADCRUMB} `); | ||
.join(` ${symbols_1.BREADCRUMB} `); | ||
} | ||
@@ -119,4 +110,10 @@ function getAppRoot(filePath) { | ||
this.warnings = []; | ||
this.parser = new Parser_1.Parser(this); | ||
} | ||
get parser() { | ||
if (this._parser) { | ||
return this._parser; | ||
} | ||
this._parser = new Parser_1.Parser(this); | ||
return this._parser; | ||
} | ||
pipe(data) { | ||
@@ -158,20 +155,49 @@ const lines = []; | ||
} | ||
getFileOperationTitle(type) { | ||
switch (type) { | ||
case 'Analyze': | ||
return 'Analyzing'; | ||
case 'GenerateDSYMFile': | ||
return `Generating debug`; | ||
case 'Ld': | ||
return 'Linking '; | ||
case 'Libtool': | ||
return 'Packaging'; | ||
case 'ProcessPCH': | ||
return 'Precompiling'; | ||
case 'ProcessInfoPlistFile': | ||
return 'Preparing'; | ||
case 'CodeSign': | ||
return 'Signing '; | ||
case 'Touch': | ||
return 'Creating '; | ||
case 'CompileC': | ||
case 'CompileSwift': | ||
case 'CompileXIB': | ||
case 'CompileStoryboard': | ||
return 'Compiling'; | ||
default: | ||
// Unknown file operation | ||
return ''; | ||
} | ||
} | ||
formatFileOperation(props) { | ||
const title = this.getFileOperationTitle(props.type); | ||
switch (props.type) { | ||
case 'Analyze': | ||
return format('Analyzing', formatBreadCrumb(props.fileName, props.target, props.project)); | ||
return format(title, formatBreadCrumb(props.fileName, props.target, props.project)); | ||
case 'GenerateDSYMFile': | ||
return format(`Generating debug`, formatBreadCrumb(`'${props.fileName}'`, props.target, props.project)); | ||
return format(title, formatBreadCrumb(`'${props.fileName}'`, props.target, props.project)); | ||
case 'Ld': | ||
return format('Linking ', formatBreadCrumb(props.fileName, props.target, props.project)); | ||
return format(title, formatBreadCrumb(props.fileName, props.target, props.project)); | ||
case 'Libtool': | ||
return format('Packaging', formatBreadCrumb(props.fileName, props.target, props.project)); | ||
return format(title, formatBreadCrumb(props.fileName, props.target, props.project)); | ||
case 'ProcessPCH': | ||
return format('Precompiling', formatBreadCrumb(props.fileName, props.target, props.project)); | ||
return format(title, formatBreadCrumb(props.fileName, props.target, props.project)); | ||
case 'ProcessInfoPlistFile': | ||
return format('Preparing', formatBreadCrumb(props.fileName, props.target, props.project)); | ||
return format(title, formatBreadCrumb(props.fileName, props.target, props.project)); | ||
case 'CodeSign': | ||
return format('Signing ', formatBreadCrumb(props.fileName, props.target, props.project)); | ||
return format(title, formatBreadCrumb(props.fileName, props.target, props.project)); | ||
case 'Touch': | ||
return format('Creating ', props.fileName); | ||
return format(title, props.fileName); | ||
case 'CompileC': | ||
@@ -181,3 +207,3 @@ case 'CompileSwift': | ||
case 'CompileStoryboard': | ||
return format('Compiling', formatBreadCrumb(props.fileName, props.target, props.project)); | ||
return format(title, formatBreadCrumb(props.fileName, props.target, props.project)); | ||
default: | ||
@@ -228,3 +254,3 @@ // Unknown file operation | ||
formatWillNotBeCodeSigned(message) { | ||
const results = `${chalk_1.default.yellow(WARNING + ' ' + message)}`; | ||
const results = `${chalk_1.default.yellow(symbols_1.WARNING + ' ' + message)}`; | ||
this.warnings.push(results); | ||
@@ -258,3 +284,3 @@ return results; | ||
formatError(message) { | ||
const results = `\n${chalk_1.default.red(ERROR + ' ' + message)}\n\n`; | ||
const results = `\n${chalk_1.default.red(symbols_1.ERROR + ' ' + message)}\n\n`; | ||
this.errors.push(results); | ||
@@ -264,3 +290,3 @@ return results; | ||
formatFileMissingError(reason, filePath) { | ||
const results = `\n${chalk_1.default.red(ERROR + ' ' + reason)} ${filePath}\n\n`; | ||
const results = `\n${chalk_1.default.red(symbols_1.ERROR + ' ' + reason)} ${filePath}\n\n`; | ||
this.errors.push(results); | ||
@@ -270,3 +296,3 @@ return results; | ||
formatLdWarning(reason) { | ||
const results = `${chalk_1.default.yellow(WARNING + ' ' + reason)}`; | ||
const results = `${chalk_1.default.yellow(symbols_1.WARNING + ' ' + reason)}`; | ||
this.warnings.push(results); | ||
@@ -277,3 +303,3 @@ return results; | ||
const symbols = chalk_1.default.gray(`┌─ Symbol: ${symbol}\n└─ Referenced from: ${reference}`); | ||
const results = `${chalk_1.default.red(ERROR + ' ' + message)}\n${symbols}\n`; | ||
const results = `${chalk_1.default.red(symbols_1.ERROR + ' ' + message)}\n${symbols}\n`; | ||
this.errors.push(results); | ||
@@ -284,4 +310,4 @@ return results; | ||
const formattedMessage = isWarning | ||
? chalk_1.default.yellow(WARNING + ' ' + message) | ||
: chalk_1.default.red(ERROR + ' ' + message); | ||
? chalk_1.default.yellow(symbols_1.WARNING + ' ' + message) | ||
: chalk_1.default.red(symbols_1.ERROR + ' ' + message); | ||
const symbols = chalk_1.default.gray(filePaths | ||
@@ -319,3 +345,3 @@ .map((p, i) => { | ||
const expectedRange = `>= ${minVersion} <= ${maxVersion}`; | ||
return `${WARNING} ${platform} ${packageNameWithVersion} deployment version mismatch, expected ${expectedRange}`; | ||
return `${symbols_1.WARNING} ${platform} ${packageNameWithVersion} deployment version mismatch, expected ${expectedRange}`; | ||
} | ||
@@ -337,4 +363,4 @@ /** | ||
const crumbs = chalk_1.default.gray('Remove: ' + | ||
['Xcode', `${project}/${target}`, 'Build Phases', buildPhase, fileName].join(` ${BREADCRUMB} `)); | ||
return `${WARNING} ${message}\n ${crumbs}\n`; | ||
['Xcode', `${project}/${target}`, 'Build Phases', buildPhase, fileName].join(` ${symbols_1.BREADCRUMB} `)); | ||
return `${symbols_1.WARNING} ${message}\n ${crumbs}\n`; | ||
} | ||
@@ -356,10 +382,10 @@ /** | ||
const crumbs = chalk_1.default.gray('Remove: ' + | ||
['Xcode', `${project}/${target}`, 'Build Phases', 'Copy Bundle Resources', fileName].join(` ${BREADCRUMB} `)); | ||
return `${WARNING} ${message}\n ${crumbs}\n`; | ||
['Xcode', `${project}/${target}`, 'Build Phases', 'Copy Bundle Resources', fileName].join(` ${symbols_1.BREADCRUMB} `)); | ||
return `${symbols_1.WARNING} ${message}\n ${crumbs}\n`; | ||
} | ||
formatMissingFileCompilerWarning(filePath) { | ||
return `${WARNING} ${chalk_1.default.yellow `No such file or directory:`} ${filePath}`; | ||
return `${symbols_1.WARNING} ${chalk_1.default.yellow `No such file or directory:`} ${filePath}`; | ||
} | ||
formatGenericWarning(message) { | ||
return INDENT + chalk_1.default.yellow(message); | ||
return symbols_1.INDENT + chalk_1.default.yellow(message); | ||
} | ||
@@ -421,12 +447,12 @@ formatWarning(message) { | ||
formatPendingTest(suite, test) { | ||
return INDENT + formatTest(`${test} [PENDING]`, Status.Pending); | ||
return symbols_1.INDENT + formatTest(`${test} [PENDING]`, Status.Pending); | ||
} | ||
formatPassingTest(suite, test, time) { | ||
return INDENT + formatTest(`${test} (${coloredTime(time)} seconds)`, Status.Pass); | ||
return symbols_1.INDENT + formatTest(`${test} (${coloredTime(time)} seconds)`, Status.Pass); | ||
} | ||
formatMeasuringTest(suite, test, time) { | ||
return INDENT + formatTest(`${test} measured (${coloredTime(time)} seconds)`, Status.Measure); | ||
return symbols_1.INDENT + formatTest(`${test} measured (${coloredTime(time)} seconds)`, Status.Measure); | ||
} | ||
formatFailingTest(suite, test, reason, filePath) { | ||
return INDENT + formatTest(`${test}, ${reason}`, Status.Fail); | ||
return symbols_1.INDENT + formatTest(`${test}, ${reason}`, Status.Fail); | ||
} | ||
@@ -485,2 +511,5 @@ formatTestRunStarted(name) { | ||
} | ||
getBuildSummary() { | ||
return `\n\u203A ${this.errors.length} error(s), and ${this.warnings.length} warning(s)\n`; | ||
} | ||
} | ||
@@ -525,3 +554,3 @@ exports.Formatter = Formatter; | ||
const color = isError ? chalk_1.default.red : chalk_1.default.yellow; | ||
const icon = color(isError ? ERROR : WARNING); | ||
const icon = color(isError ? symbols_1.ERROR : symbols_1.WARNING); | ||
try { | ||
@@ -528,0 +557,0 @@ const raw = fs.readFileSync(filePath, 'utf8'); |
export { Parser } from './Parser'; | ||
export { MetroParser } from './MetroParser'; | ||
export { ExpoRunFormatter, ExpoRunFormatterProps } from './ExpoRunFormatter'; | ||
export * from './Formatter'; | ||
export { switchRegex } from './switchRegex'; |
@@ -13,5 +13,9 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.switchRegex = exports.Parser = void 0; | ||
exports.switchRegex = exports.ExpoRunFormatter = exports.MetroParser = exports.Parser = void 0; | ||
var Parser_1 = require("./Parser"); | ||
Object.defineProperty(exports, "Parser", { enumerable: true, get: function () { return Parser_1.Parser; } }); | ||
var MetroParser_1 = require("./MetroParser"); | ||
Object.defineProperty(exports, "MetroParser", { enumerable: true, get: function () { return MetroParser_1.MetroParser; } }); | ||
var ExpoRunFormatter_1 = require("./ExpoRunFormatter"); | ||
Object.defineProperty(exports, "ExpoRunFormatter", { enumerable: true, get: function () { return ExpoRunFormatter_1.ExpoRunFormatter; } }); | ||
__exportStar(require("./Formatter"), exports); | ||
@@ -18,0 +22,0 @@ var switchRegex_1 = require("./switchRegex"); |
{ | ||
"name": "@expo/xcpretty", | ||
"description": "Parse and format xcodebuild logs", | ||
"version": "2.0.2", | ||
"version": "3.0.0", | ||
"main": "build/index.js", | ||
@@ -13,3 +13,2 @@ "types": "build/index.d.ts", | ||
}, | ||
"scripts": { | ||
@@ -32,8 +31,12 @@ "watch": "tsc --watch", | ||
"dependencies": { | ||
"@babel/code-frame": "7.10.4", | ||
"chalk": "^4.1.0", | ||
"@babel/code-frame": "7.10.4" | ||
"find-up": "^5.0.0", | ||
"js-yaml": "^4.1.0" | ||
}, | ||
"devDependencies": { | ||
"@types/babel__code-frame": "^7.0.2" | ||
"@types/babel__code-frame": "^7.0.2", | ||
"@types/js-yaml": "^4.0.1", | ||
"ansi-regex": "^6.0.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
197571
35
2375
4
3
3
+ Addedfind-up@^5.0.0
+ Addedjs-yaml@^4.1.0
+ Addedargparse@2.0.1(transitive)
+ Addedfind-up@5.0.0(transitive)
+ Addedjs-yaml@4.1.0(transitive)
+ Addedlocate-path@6.0.0(transitive)
+ Addedp-limit@3.1.0(transitive)
+ Addedp-locate@5.0.0(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedyocto-queue@0.1.0(transitive)