@statoscope/cli
Advanced tools
Comparing version 5.2.0 to 5.3.0-alpha.1
import { Argv } from 'yargs'; | ||
import { NormalizedFile } from '@statoscope/webpack-model/dist/normalize'; | ||
export declare type TestEntryType = 'error' | 'warn' | 'info'; | ||
export declare type TestEntry = { | ||
type?: 'error' | 'warn' | 'info'; | ||
type?: TestEntryType; | ||
assert?: boolean; | ||
@@ -6,0 +7,0 @@ message: string; |
@@ -30,3 +30,3 @@ "use strict"; | ||
else if (type === 'info') { | ||
api.warn(message, filename); | ||
api.info(message, filename); | ||
} | ||
@@ -41,4 +41,8 @@ else { | ||
for (const item of result) { | ||
let type = item.type; | ||
if (!item.assert) { | ||
callAPI(api, { type: item.type, message: item.message, filename: item.filename }); | ||
if (type === undefined && !Object.prototype.hasOwnProperty.call(item, 'assert')) { | ||
type = 'info'; | ||
} | ||
callAPI(api, { type, message: item.message, filename: item.filename }); | ||
} | ||
@@ -142,3 +146,3 @@ } | ||
if (infos) { | ||
console.log(`Infos: ${infos}`); | ||
console.log(`Info: ${infos}`); | ||
} | ||
@@ -148,3 +152,3 @@ console.log('Done'); | ||
// eslint-disable-next-line no-process-exit | ||
process.exit(1); | ||
process.exitCode = 1; | ||
} | ||
@@ -151,0 +155,0 @@ }); |
@@ -16,3 +16,3 @@ "use strict"; | ||
const htmlWriter = new report_writer_1.default({ | ||
scripts: [require.resolve('@statoscope/webpack-ui')], | ||
scripts: [{ type: 'path', path: require.resolve('@statoscope/webpack-ui') }], | ||
init: function (data) { | ||
@@ -19,0 +19,0 @@ // @ts-ignore |
{ | ||
"name": "@statoscope/cli", | ||
"version": "5.2.0", | ||
"version": "5.3.0-alpha.1", | ||
"description": "Statoscope CLI tools", | ||
@@ -28,6 +28,6 @@ "scripts": { | ||
"@discoveryjs/json-ext": "^0.5.3", | ||
"@statoscope/helpers": "^5.2.0", | ||
"@statoscope/report-writer": "^5.2.0", | ||
"@statoscope/webpack-model": "^5.2.0", | ||
"@statoscope/webpack-ui": "^5.2.0", | ||
"@statoscope/helpers": "^5.3.0-alpha.1", | ||
"@statoscope/report-writer": "^5.3.0-alpha.1", | ||
"@statoscope/webpack-model": "^5.3.0-alpha.1", | ||
"@statoscope/webpack-ui": "^5.3.0-alpha.1", | ||
"open": "^8.0.4", | ||
@@ -39,3 +39,3 @@ "yargs": "^17.0.1" | ||
}, | ||
"gitHead": "f2414604bd60930e3352448e49bbb27af926df35" | ||
"gitHead": "f0f59cd81f6f3e8d2161000c386fe17bbee1a872" | ||
} |
@@ -44,6 +44,6 @@ # Statoscope CLI | ||
type TestEntry = { | ||
type?: 'error' | 'warn' | 'info'; // 'error' by default | ||
assert?: boolean; // false by default | ||
messsage: string; | ||
filename?: string | ||
type?: 'error' | 'warn' | 'info'; // 'error' by default | ||
assert?: boolean; // false by default | ||
messsage: string; | ||
filename?: string; | ||
}; | ||
@@ -158,3 +158,3 @@ ``` | ||
error: Initial assets size increased at 249.57 kb (9.16%)" | ||
Errors: 1 | ||
@@ -169,13 +169,13 @@ ``` | ||
type Data = { | ||
files: Object[]; | ||
compilations: Object[]; | ||
query: (query: string, data?: any) => any; // query-parameter is jora-syntax query | ||
} | ||
files: Object[]; | ||
compilations: Object[]; | ||
query: (query: string, data?: any) => any; // query-parameter is jora-syntax query | ||
}; | ||
type API = { | ||
error(message: string, filename?: string): void; | ||
warn(message: string, filename?: string): void; | ||
info(message: string, filename?: string): void; | ||
} | ||
type ValidatorFn = (data: Data, api: API) => Promise<string | void> | ||
error(message: string, filename?: string): void; | ||
warn(message: string, filename?: string): void; | ||
info(message: string, filename?: string): void; | ||
}; | ||
type ValidatorFn = (data: Data, api: API) => Promise<string | void>; | ||
``` | ||
@@ -187,8 +187,11 @@ | ||
module.exports = (data, api) => { | ||
const lodash = data.query('compilations.nodeModules.[name="lodash"]'); | ||
const lodash = data.query('compilations.nodeModules.[name="lodash"]'); | ||
if (lodash.length) { | ||
api.error('Lodash usage detected. Please do not use lodash in this project', data.files[0].name); | ||
} | ||
} | ||
if (lodash.length) { | ||
api.error( | ||
'Lodash usage detected. Please do not use lodash in this project', | ||
data.files[0].name | ||
); | ||
} | ||
}; | ||
``` | ||
@@ -241,3 +244,3 @@ | ||
```sh | ||
statoscope serve path/to/stats.json path/to/report.html -o | ||
statoscope generate path/to/stats.json path/to/report.html -o | ||
``` | ||
@@ -244,0 +247,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
28292
323
249
1