@atlaskit/ads-cli 0.8.0 → 0.8.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/ads-cli
2
2
 
3
+ ## 0.8.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d4d571ff39f04`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d4d571ff39f04) -
8
+ Document that `ads-cli search` returns up to two matches per term, per result type by default and
9
+ that `--limit` overrides the default.
10
+
11
+ ## 0.8.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [`d26c33453c778`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d26c33453c778) -
16
+ Refactor grouped search rendering to avoid compacting human-readable results twice.
17
+
3
18
  ## 0.8.0
4
19
 
5
20
  ### Minor Changes
package/dist/cjs/cli.js CHANGED
@@ -648,15 +648,15 @@ var renderGroupedResult = function renderGroupedResult(_ref12) {
648
648
  }
649
649
  return _types.ExitCode.NotFound;
650
650
  }
651
- var compactGrouped = Object.fromEntries(['components', 'tokens', 'icons', 'docs'].map(function (kind) {
652
- var _compactResults2, _grouped$kind;
653
- return [kind, (_compactResults2 = (0, _compactResults3.compactResults)({
654
- kind: kind,
655
- data: (_grouped$kind = grouped[kind]) !== null && _grouped$kind !== void 0 ? _grouped$kind : [],
656
- showFollowUp: true
657
- })) !== null && _compactResults2 !== void 0 ? _compactResults2 : []];
658
- }));
659
651
  if (json) {
652
+ var compactGrouped = Object.fromEntries(['components', 'tokens', 'icons', 'docs'].map(function (kind) {
653
+ var _compactResults2, _grouped$kind;
654
+ return [kind, (_compactResults2 = (0, _compactResults3.compactResults)({
655
+ kind: kind,
656
+ data: (_grouped$kind = grouped[kind]) !== null && _grouped$kind !== void 0 ? _grouped$kind : [],
657
+ showFollowUp: true
658
+ })) !== null && _compactResults2 !== void 0 ? _compactResults2 : []];
659
+ }));
660
660
  (0, _writeJsonEnvelope.writeJsonEnvelope)({
661
661
  envelope: (0, _createSuccessEnvelope.createSuccessEnvelope)({
662
662
  envelopeType: command.envelopeType(input),
@@ -673,7 +673,7 @@ var renderGroupedResult = function renderGroupedResult(_ref12) {
673
673
  return _types.ExitCode.Ok;
674
674
  }
675
675
  writer.out((0, _formatGroupedResults.formatGroupedResults)({
676
- groups: compactGrouped,
676
+ groups: grouped,
677
677
  totalCount: totalCount,
678
678
  invocation: invocation
679
679
  }));
@@ -52,6 +52,10 @@ var limitFlag = {
52
52
  alias: 'l',
53
53
  description: 'Maximum matches per term.'
54
54
  };
55
+ var searchLimitFlag = _objectSpread(_objectSpread({}, limitFlag), {}, {
56
+ default: 2,
57
+ description: 'Maximum matches per term, per result type (default: 2).'
58
+ });
55
59
 
56
60
  /**
57
61
  * Parse and validate the `--limit` flag.
@@ -572,7 +576,7 @@ var resolveBatch = function resolveBatch(input) {
572
576
  */
573
577
  var commands = exports.commands = [{
574
578
  name: 'search',
575
- description: 'Fuzzy-search ADS components, tokens, icons, and docs together (or narrow results with --type).',
579
+ description: 'Fuzzy-search ADS components, tokens, icons, and docs together (or narrow results with --type). Returns up to 2 matches per term, per result type by default; override with --limit.',
576
580
  usage: "search <query...> [--type ".concat(Object.keys(SEARCH_TYPE_VALUES).join('|'), "] [--limit N]"),
577
581
  arguments: [{
578
582
  name: 'query',
@@ -587,7 +591,7 @@ var commands = exports.commands = [{
587
591
  alias: 't',
588
592
  choices: Object.keys(SEARCH_TYPE_VALUES),
589
593
  description: "Narrow the search to a single kind: ".concat(Object.keys(SEARCH_TYPE_VALUES).join(', '), ".")
590
- }, limitFlag],
594
+ }, searchLimitFlag],
591
595
  examples: ['search button', 'search space color --type token', 'search add --type icon --limit 5', 'search contrast --type docs'],
592
596
  responseTypes: ['ads-cli/search'].concat((0, _toConsumableArray2.default)(Object.values(searchKindTools).map(function (tool) {
593
597
  return "ads-cli/".concat(tool.envelopeType);
@@ -544,15 +544,15 @@ const renderGroupedResult = ({
544
544
  }
545
545
  return ExitCode.NotFound;
546
546
  }
547
- const compactGrouped = Object.fromEntries(['components', 'tokens', 'icons', 'docs'].map(kind => {
548
- var _compactResults2, _grouped$kind;
549
- return [kind, (_compactResults2 = compactResults({
550
- kind,
551
- data: (_grouped$kind = grouped[kind]) !== null && _grouped$kind !== void 0 ? _grouped$kind : [],
552
- showFollowUp: true
553
- })) !== null && _compactResults2 !== void 0 ? _compactResults2 : []];
554
- }));
555
547
  if (json) {
548
+ const compactGrouped = Object.fromEntries(['components', 'tokens', 'icons', 'docs'].map(kind => {
549
+ var _compactResults2, _grouped$kind;
550
+ return [kind, (_compactResults2 = compactResults({
551
+ kind,
552
+ data: (_grouped$kind = grouped[kind]) !== null && _grouped$kind !== void 0 ? _grouped$kind : [],
553
+ showFollowUp: true
554
+ })) !== null && _compactResults2 !== void 0 ? _compactResults2 : []];
555
+ }));
556
556
  writeJsonEnvelope({
557
557
  envelope: createSuccessEnvelope({
558
558
  envelopeType: command.envelopeType(input),
@@ -570,7 +570,7 @@ const renderGroupedResult = ({
570
570
  return ExitCode.Ok;
571
571
  }
572
572
  writer.out(formatGroupedResults({
573
- groups: compactGrouped,
573
+ groups: grouped,
574
574
  totalCount,
575
575
  invocation
576
576
  }));
@@ -38,6 +38,11 @@ const limitFlag = {
38
38
  alias: 'l',
39
39
  description: 'Maximum matches per term.'
40
40
  };
41
+ const searchLimitFlag = {
42
+ ...limitFlag,
43
+ default: 2,
44
+ description: 'Maximum matches per term, per result type (default: 2).'
45
+ };
41
46
 
42
47
  /**
43
48
  * Parse and validate the `--limit` flag.
@@ -538,7 +543,7 @@ const resolveBatch = input => {
538
543
  */
539
544
  export const commands = [{
540
545
  name: 'search',
541
- description: 'Fuzzy-search ADS components, tokens, icons, and docs together (or narrow results with --type).',
546
+ description: 'Fuzzy-search ADS components, tokens, icons, and docs together (or narrow results with --type). Returns up to 2 matches per term, per result type by default; override with --limit.',
542
547
  usage: `search <query...> [--type ${Object.keys(SEARCH_TYPE_VALUES).join('|')}] [--limit N]`,
543
548
  arguments: [{
544
549
  name: 'query',
@@ -553,7 +558,7 @@ export const commands = [{
553
558
  alias: 't',
554
559
  choices: Object.keys(SEARCH_TYPE_VALUES),
555
560
  description: `Narrow the search to a single kind: ${Object.keys(SEARCH_TYPE_VALUES).join(', ')}.`
556
- }, limitFlag],
561
+ }, searchLimitFlag],
557
562
  examples: ['search button', 'search space color --type token', 'search add --type icon --limit 5', 'search contrast --type docs'],
558
563
  responseTypes: ['ads-cli/search', ...Object.values(searchKindTools).map(tool => `ads-cli/${tool.envelopeType}`)],
559
564
  // With `--type`, the result is a single kind (compact per-row rendering). Without it, the
package/dist/esm/cli.js CHANGED
@@ -644,15 +644,15 @@ var renderGroupedResult = function renderGroupedResult(_ref12) {
644
644
  }
645
645
  return ExitCode.NotFound;
646
646
  }
647
- var compactGrouped = Object.fromEntries(['components', 'tokens', 'icons', 'docs'].map(function (kind) {
648
- var _compactResults2, _grouped$kind;
649
- return [kind, (_compactResults2 = compactResults({
650
- kind: kind,
651
- data: (_grouped$kind = grouped[kind]) !== null && _grouped$kind !== void 0 ? _grouped$kind : [],
652
- showFollowUp: true
653
- })) !== null && _compactResults2 !== void 0 ? _compactResults2 : []];
654
- }));
655
647
  if (json) {
648
+ var compactGrouped = Object.fromEntries(['components', 'tokens', 'icons', 'docs'].map(function (kind) {
649
+ var _compactResults2, _grouped$kind;
650
+ return [kind, (_compactResults2 = compactResults({
651
+ kind: kind,
652
+ data: (_grouped$kind = grouped[kind]) !== null && _grouped$kind !== void 0 ? _grouped$kind : [],
653
+ showFollowUp: true
654
+ })) !== null && _compactResults2 !== void 0 ? _compactResults2 : []];
655
+ }));
656
656
  writeJsonEnvelope({
657
657
  envelope: createSuccessEnvelope({
658
658
  envelopeType: command.envelopeType(input),
@@ -669,7 +669,7 @@ var renderGroupedResult = function renderGroupedResult(_ref12) {
669
669
  return ExitCode.Ok;
670
670
  }
671
671
  writer.out(formatGroupedResults({
672
- groups: compactGrouped,
672
+ groups: grouped,
673
673
  totalCount: totalCount,
674
674
  invocation: invocation
675
675
  }));
@@ -47,6 +47,10 @@ var limitFlag = {
47
47
  alias: 'l',
48
48
  description: 'Maximum matches per term.'
49
49
  };
50
+ var searchLimitFlag = _objectSpread(_objectSpread({}, limitFlag), {}, {
51
+ default: 2,
52
+ description: 'Maximum matches per term, per result type (default: 2).'
53
+ });
50
54
 
51
55
  /**
52
56
  * Parse and validate the `--limit` flag.
@@ -567,7 +571,7 @@ var resolveBatch = function resolveBatch(input) {
567
571
  */
568
572
  export var commands = [{
569
573
  name: 'search',
570
- description: 'Fuzzy-search ADS components, tokens, icons, and docs together (or narrow results with --type).',
574
+ description: 'Fuzzy-search ADS components, tokens, icons, and docs together (or narrow results with --type). Returns up to 2 matches per term, per result type by default; override with --limit.',
571
575
  usage: "search <query...> [--type ".concat(Object.keys(SEARCH_TYPE_VALUES).join('|'), "] [--limit N]"),
572
576
  arguments: [{
573
577
  name: 'query',
@@ -582,7 +586,7 @@ export var commands = [{
582
586
  alias: 't',
583
587
  choices: Object.keys(SEARCH_TYPE_VALUES),
584
588
  description: "Narrow the search to a single kind: ".concat(Object.keys(SEARCH_TYPE_VALUES).join(', '), ".")
585
- }, limitFlag],
589
+ }, searchLimitFlag],
586
590
  examples: ['search button', 'search space color --type token', 'search add --type icon --limit 5', 'search contrast --type docs'],
587
591
  responseTypes: ['ads-cli/search'].concat(_toConsumableArray(Object.values(searchKindTools).map(function (tool) {
588
592
  return "ads-cli/".concat(tool.envelopeType);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/ads-cli",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "An npx-runnable command-line tool to query Atlassian Design System (ADS) structured content — components, tokens, icons, and guidelines — from the terminal.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",