@teambit/validator 0.0.330 → 0.0.331
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/validate.cmd.d.ts
CHANGED
|
@@ -17,8 +17,9 @@ export declare class ValidateCmd implements Command {
|
|
|
17
17
|
group: string;
|
|
18
18
|
options: CommandOptions;
|
|
19
19
|
constructor(validator: ValidatorMain, workspace: Workspace, logger: Logger);
|
|
20
|
-
report([pattern]: [string], { all, failFast, continueOnError, skipTasks, }: {
|
|
20
|
+
report([pattern]: [string], { all, unmodified, failFast, continueOnError, skipTasks, }: {
|
|
21
21
|
all: boolean;
|
|
22
|
+
unmodified: boolean;
|
|
22
23
|
failFast: boolean;
|
|
23
24
|
continueOnError: boolean;
|
|
24
25
|
skipTasks?: string;
|
package/dist/validate.cmd.js
CHANGED
|
@@ -39,28 +39,33 @@ class ValidateCmd {
|
|
|
39
39
|
_defineProperty(this, "extendedDescription", `validates components by running check-types, lint, and test commands in sequence.
|
|
40
40
|
by default runs all checks even when errors are found.
|
|
41
41
|
use --fail-fast to stop at the first failure.
|
|
42
|
-
by default validates only new and modified components. use --
|
|
42
|
+
by default validates only new and modified components. use --unmodified to validate all components.`);
|
|
43
43
|
_defineProperty(this, "arguments", [{
|
|
44
44
|
name: 'component-pattern',
|
|
45
45
|
description: _legacy().COMPONENT_PATTERN_HELP
|
|
46
46
|
}]);
|
|
47
47
|
_defineProperty(this, "alias", '');
|
|
48
48
|
_defineProperty(this, "group", 'testing');
|
|
49
|
-
_defineProperty(this, "options", [['a', 'all', 'validate all components, not only modified and new'], ['', 'fail-fast', 'stop at the first failure instead of running all checks'], ['c', 'continue-on-error', 'DEPRECATED: this is now the default behavior'], ['', 'skip-tasks <string>', 'skip the given tasks. for multiple tasks, separate by a comma and wrap with quotes. available tasks: "check-types", "lint", "test"']]);
|
|
49
|
+
_defineProperty(this, "options", [['a', 'all', 'DEPRECATED. (use --unmodified)'], ['u', 'unmodified', 'validate all components, not only modified and new'], ['', 'fail-fast', 'stop at the first failure instead of running all checks'], ['c', 'continue-on-error', 'DEPRECATED: this is now the default behavior'], ['', 'skip-tasks <string>', 'skip the given tasks. for multiple tasks, separate by a comma and wrap with quotes. available tasks: "check-types", "lint", "test"']]);
|
|
50
50
|
}
|
|
51
51
|
async report([pattern], {
|
|
52
52
|
all = false,
|
|
53
|
+
unmodified = false,
|
|
53
54
|
failFast = false,
|
|
54
55
|
continueOnError = false,
|
|
55
56
|
skipTasks
|
|
56
57
|
}) {
|
|
57
58
|
if (!this.workspace) throw new (_workspace().OutsideWorkspaceError)();
|
|
59
|
+
if (all) {
|
|
60
|
+
unmodified = all;
|
|
61
|
+
this.logger.consoleWarning(`--all is deprecated, use --unmodified instead`);
|
|
62
|
+
}
|
|
58
63
|
if (continueOnError) {
|
|
59
64
|
this.logger.consoleWarning('--continue-on-error is deprecated and will be removed in a future version. This is now the default behavior.');
|
|
60
65
|
}
|
|
61
66
|
this.logger.console(`\n${(0, _cli().formatTitle)('Running validation checks...')}\n`);
|
|
62
67
|
const startTime = Date.now();
|
|
63
|
-
const components = await this.workspace.getComponentsByUserInput(pattern ? false :
|
|
68
|
+
const components = await this.workspace.getComponentsByUserInput(pattern ? false : unmodified, pattern, true);
|
|
64
69
|
if (components.length === 0) {
|
|
65
70
|
this.logger.console((0, _cli().formatHint)('No components found to validate'));
|
|
66
71
|
return {
|
package/dist/validate.cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_cli","data","require","_workspace","_legacy","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","VALID_TASKS","ValidateCmd","constructor","validator","workspace","logger","name","description","COMPONENT_PATTERN_HELP","report","pattern","all","failFast","continueOnError","skipTasks","OutsideWorkspaceError","consoleWarning","console","formatTitle","startTime","Date","now","components","getComponentsByUserInput","length","formatHint","code","skipTasksParsed","split","map","trim","filter","Boolean","invalidTasks","includes","Error","join","result","validate","totalTime","toFixed","errorSymbol","skippedAll","formatWarningSummary","formatSuccessSummary","exports"],"sources":["validate.cmd.ts"],"sourcesContent":["import type { Command, CommandOptions } from '@teambit/cli';\nimport { formatTitle, formatSuccessSummary, formatHint, formatWarningSummary, errorSymbol } from '@teambit/cli';\nimport type { Logger } from '@teambit/logger';\nimport type { Workspace } from '@teambit/workspace';\nimport { OutsideWorkspaceError } from '@teambit/workspace';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport type { ValidatorMain } from './validator.main.runtime';\n\nconst VALID_TASKS = ['check-types', 'lint', 'test'] as const;\n\nexport class ValidateCmd implements Command {\n name = 'validate [component-pattern]';\n description = 'run type-checking, linting, and testing in sequence';\n extendedDescription = `validates components by running check-types, lint, and test commands in sequence.\nby default runs all checks even when errors are found.\nuse --fail-fast to stop at the first failure.\nby default validates only new and modified components. use --
|
|
1
|
+
{"version":3,"names":["_cli","data","require","_workspace","_legacy","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","VALID_TASKS","ValidateCmd","constructor","validator","workspace","logger","name","description","COMPONENT_PATTERN_HELP","report","pattern","all","unmodified","failFast","continueOnError","skipTasks","OutsideWorkspaceError","consoleWarning","console","formatTitle","startTime","Date","now","components","getComponentsByUserInput","length","formatHint","code","skipTasksParsed","split","map","trim","filter","Boolean","invalidTasks","includes","Error","join","result","validate","totalTime","toFixed","errorSymbol","skippedAll","formatWarningSummary","formatSuccessSummary","exports"],"sources":["validate.cmd.ts"],"sourcesContent":["import type { Command, CommandOptions } from '@teambit/cli';\nimport { formatTitle, formatSuccessSummary, formatHint, formatWarningSummary, errorSymbol } from '@teambit/cli';\nimport type { Logger } from '@teambit/logger';\nimport type { Workspace } from '@teambit/workspace';\nimport { OutsideWorkspaceError } from '@teambit/workspace';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport type { ValidatorMain } from './validator.main.runtime';\n\nconst VALID_TASKS = ['check-types', 'lint', 'test'] as const;\n\nexport class ValidateCmd implements Command {\n name = 'validate [component-pattern]';\n description = 'run type-checking, linting, and testing in sequence';\n extendedDescription = `validates components by running check-types, lint, and test commands in sequence.\nby default runs all checks even when errors are found.\nuse --fail-fast to stop at the first failure.\nby default validates only new and modified components. use --unmodified to validate all components.`;\n arguments = [{ name: 'component-pattern', description: COMPONENT_PATTERN_HELP }];\n alias = '';\n group = 'testing';\n options = [\n ['a', 'all', 'DEPRECATED. (use --unmodified)'],\n ['u', 'unmodified', 'validate all components, not only modified and new'],\n ['', 'fail-fast', 'stop at the first failure instead of running all checks'],\n ['c', 'continue-on-error', 'DEPRECATED: this is now the default behavior'],\n [\n '',\n 'skip-tasks <string>',\n 'skip the given tasks. for multiple tasks, separate by a comma and wrap with quotes. available tasks: \"check-types\", \"lint\", \"test\"',\n ],\n ] as CommandOptions;\n\n constructor(\n private validator: ValidatorMain,\n private workspace: Workspace,\n private logger: Logger\n ) {}\n\n async report(\n [pattern]: [string],\n {\n all = false,\n unmodified = false,\n failFast = false,\n continueOnError = false,\n skipTasks,\n }: { all: boolean; unmodified: boolean; failFast: boolean; continueOnError: boolean; skipTasks?: string }\n ) {\n if (!this.workspace) throw new OutsideWorkspaceError();\n\n if (all) {\n unmodified = all;\n this.logger.consoleWarning(`--all is deprecated, use --unmodified instead`);\n }\n\n if (continueOnError) {\n this.logger.consoleWarning(\n '--continue-on-error is deprecated and will be removed in a future version. This is now the default behavior.'\n );\n }\n\n this.logger.console(`\\n${formatTitle('Running validation checks...')}\\n`);\n\n const startTime = Date.now();\n const components = await this.workspace.getComponentsByUserInput(pattern ? false : unmodified, pattern, true);\n\n if (components.length === 0) {\n this.logger.console(formatHint('No components found to validate'));\n return { code: 0, data: 'No components found to validate' };\n }\n\n this.logger.console(`Validating ${components.length} component(s)\\n`);\n\n const skipTasksParsed = skipTasks\n ? skipTasks\n .split(',')\n .map((t) => t.trim())\n .filter(Boolean)\n : [];\n const invalidTasks = skipTasksParsed.filter((t) => !VALID_TASKS.includes(t as any));\n if (invalidTasks.length > 0) {\n throw new Error(`unknown skip-tasks: ${invalidTasks.join(', ')}. available tasks: ${VALID_TASKS.join(', ')}`);\n }\n const result = await this.validator.validate(components, failFast, skipTasksParsed);\n const totalTime = ((Date.now() - startTime) / 1000).toFixed(2);\n\n if (result.code !== 0) {\n this.logger.console(`\\n${errorSymbol} Validation failed\\n`);\n return { code: result.code, data: `Validation failed after ${totalTime} seconds` };\n }\n\n if (result.skippedAll) {\n this.logger.console(`\\n${formatWarningSummary('All validation tasks were skipped')}\\n`);\n return { code: 0, data: 'All validation tasks were skipped' };\n }\n\n this.logger.console(`\\n${formatSuccessSummary(`All validation checks passed in ${totalTime} seconds`)}\\n`);\n return { code: 0, data: `Validation completed successfully in ${totalTime} seconds` };\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAmE,SAAAI,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,E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A,GAAAA,WAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/validator",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.331",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/defender/validator",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.defender",
|
|
8
8
|
"name": "validator",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.331"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "4.1.2",
|
|
13
|
-
"@teambit/legacy.constants": "0.0.39",
|
|
14
|
-
"@teambit/harmony": "0.4.12",
|
|
15
13
|
"@teambit/cli": "0.0.1362",
|
|
14
|
+
"@teambit/legacy.constants": "0.0.39",
|
|
16
15
|
"@teambit/logger": "0.0.1455",
|
|
17
16
|
"@teambit/workspace": "1.0.1094",
|
|
17
|
+
"@teambit/harmony": "0.4.12",
|
|
18
18
|
"@teambit/component": "1.0.1094",
|
|
19
19
|
"@teambit/linter": "1.0.1094",
|
|
20
20
|
"@teambit/tester": "1.0.1094",
|
|
File without changes
|