zarro 1.170.10 โ†’ 1.170.14

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.
@@ -16,6 +16,7 @@
16
16
  const readNuspecVersion = requireModule("read-nuspec-version");
17
17
  const log = requireModule("log");
18
18
  const env = requireModule("env");
19
+ const Version = requireModule("version");
19
20
  const emojiLabels = {
20
21
  testing: `๐Ÿงช Testing`,
21
22
  packing: `๐Ÿ“ฆ Packing`,
@@ -669,14 +670,13 @@ WARNING: 'dotnet pack' ignores --version-suffix when a nuspec file is provided.
669
670
  }
670
671
  async function runDotNetWith(args, opts) {
671
672
  try {
672
- const result = await system("dotnet", args, {
673
+ return await system("dotnet", args, {
673
674
  stdout: opts.stdout,
674
675
  stderr: opts.stderr,
675
676
  suppressOutput: opts.suppressOutput,
676
677
  suppressStdIoInErrors: opts.suppressStdIoInErrors,
677
678
  env: opts.env
678
679
  });
679
- return result;
680
680
  }
681
681
  catch (e) {
682
682
  if (opts.suppressErrors) {
@@ -754,6 +754,57 @@ WARNING: 'dotnet pack' ignores --version-suffix when a nuspec file is provided.
754
754
  usingFallback
755
755
  });
756
756
  }
757
+ async function searchPackages(options) {
758
+ if (!options) {
759
+ throw new Error(`No options or search string provided`);
760
+ }
761
+ const opts = typeof options === "string"
762
+ ? { search: options }
763
+ : options;
764
+ const args = ["package", "search"];
765
+ pushIfSet(args, opts.source, "--source");
766
+ pushFlag(args, opts.exactMatch, "--exact-match");
767
+ pushFlag(args, opts.preRelease, "--prerelease");
768
+ pushIfSet(args, opts.configFile, "--configfile");
769
+ args.push("--format", "json");
770
+ if (opts.search) {
771
+ args.push(opts.search);
772
+ }
773
+ const stdout = [];
774
+ opts.stdout = (s) => stdout.push(s);
775
+ opts.suppressOutput = true;
776
+ const rawResult = await runDotNetWith(args, opts);
777
+ if (system.isError(rawResult)) {
778
+ throw rawResult;
779
+ }
780
+ const allText = stdout.join(" "), parsed = JSON.parse(allText);
781
+ const finalResult = [];
782
+ const limit = opts.take || Number.MAX_VALUE;
783
+ for (const sourceResult of parsed.searchResult) {
784
+ for (const pkg of sourceResult.packages) {
785
+ finalResult.push({
786
+ id: pkg.id,
787
+ version: new Version(pkg.latestVersion),
788
+ source: sourceResult.sourceName
789
+ });
790
+ }
791
+ }
792
+ // dotnet package search takes in skip and take parameters,
793
+ // but there are some potential issues:
794
+ // 1. when searching for an exact match, it dotnet doesn't apply skip/take
795
+ // - so we'd have to do it ourselves anyway
796
+ // 2. dotnet returns results in ascending version order
797
+ // - where the most useful, especially for paging, is reverse-ordered
798
+ finalResult.sort((a, b) => a.version.compareWith(b.version)).reverse();
799
+ const skip = opts.skip || 0;
800
+ if (skip > 0) {
801
+ finalResult.splice(0, skip);
802
+ }
803
+ if (finalResult.length > limit) {
804
+ finalResult.splice(limit);
805
+ }
806
+ return finalResult;
807
+ }
757
808
  module.exports = {
758
809
  test,
759
810
  build,
@@ -769,6 +820,7 @@ WARNING: 'dotnet pack' ignores --version-suffix when a nuspec file is provided.
769
820
  disableNugetSource,
770
821
  enableNugetSource,
771
822
  tryFindConfiguredNugetSource,
772
- incrementTempDbPortHintIfFound
823
+ incrementTempDbPortHintIfFound,
824
+ searchPackages
773
825
  };
774
826
  })();
@@ -139,10 +139,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
139
139
  if (process.env[parallelVar] === undefined) {
140
140
  // automatically test in parallel if possible
141
141
  testInParallel = allProjectsReferenceQuackers;
142
- if (testInParallel) {
143
- }
144
- else {
145
- }
146
142
  }
147
143
  else if (parallelFlag && !allProjectsReferenceQuackers) {
148
144
  testInParallel = false;
@@ -388,7 +384,7 @@ Test Run Summary
388
384
  }
389
385
  if (state.inSummary) {
390
386
  /* actual summary log example, using settings
391
-
387
+
392
388
  QUACKERS_LOG_PREFIX = "::",
393
389
  QUACKERS_SUMMARY_START_MARKER = `::SS::`,
394
390
  QUACKERS_SUMMARY_COMPLETE_MARKER = `::SC::`,
@@ -399,7 +395,7 @@ Test Run Summary
399
395
  QUACKERS_SLOW_SUMMARY_COMPLETE_MARKER = "::SSC::",
400
396
  QUACKERS_VERBOSE_SUMMARY = "true",
401
397
  QUACKERS_OUTPUT_FAILURES_INLINE = "true",
402
-
398
+
403
399
  ::::SS::
404
400
  ::::SSS::
405
401
  :: {some slow summary data}
@@ -411,14 +407,14 @@ Test Run Summary
411
407
  ::Failed: 2
412
408
  ::Skipped: 1
413
409
  ::Total: 11
414
-
410
+
415
411
  ::Failures:
416
-
412
+
417
413
  ::[1] QuackersTestHost.SomeTests.ShouldBeLessThan50(75)
418
414
  :: NExpect.Exceptions.UnmetExpectationException : Expected 75 to be less than 50
419
415
  :: at QuackersTestHost.SomeTests.ShouldBeLessThan50(Int32 value) in C:\code\opensource\quackers\src\Demo\SomeTests.cs:line 66
420
416
  ::
421
-
417
+
422
418
  ::[2] QuackersTestHost.SomeTests.ShouldFail
423
419
  :: NExpect.Exceptions.UnmetExpectationException : Expected false but got true
424
420
  :: at QuackersTestHost.SomeTests.ShouldFail() in C:\code\opensource\quackers\src\Demo\SomeTests.cs:line 28
@@ -477,8 +473,7 @@ Test Run Summary
477
473
  }
478
474
  }
479
475
  catch (e) {
480
- const err = e;
481
- const err2 = err;
476
+ debug(`quackersStdOutHandler errors:\n${e}`);
482
477
  }
483
478
  }
484
479
  function incrementTestResultCount(testResults, line) {
@@ -496,7 +491,10 @@ Test Run Summary
496
491
  }
497
492
  }
498
493
  function stripQuackersLogPrefix(line) {
499
- return line.substring(quackersLogPrefixLength);
494
+ while (line.startsWith(QUACKERS_LOG_PREFIX)) {
495
+ line = line.substring(QUACKERS_LOG_PREFIX.length);
496
+ }
497
+ return line;
500
498
  }
501
499
  const quackersRefCache = {};
502
500
  async function projectReferencesQuackers(csproj) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zarro",
3
- "version": "1.170.10",
3
+ "version": "1.170.14",
4
4
  "description": "Some glue to make gulp easier, perhaps even zero- or close-to-zero-conf",
5
5
  "bin": {
6
6
  "zarro": "./index.js"
package/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // noinspection JSUnusedGlobalSymbols
1
+ // noinspection JSUnusedGlobalSymbols,JSUnusedLocalSymbols
2
2
 
3
3
  import * as fs from "fs";
4
4
  import { StatsBase } from "fs";
@@ -802,6 +802,7 @@ declare global {
802
802
  interface PackageInfo {
803
803
  id: string;
804
804
  version: Version;
805
+ source?: string;
805
806
  }
806
807
 
807
808
  interface PathUtils {
@@ -827,16 +828,16 @@ declare global {
827
828
  // @ts-ignore
828
829
  export interface ExecOpts
829
830
  extends ExecFileOptionsWithBufferEncoding {
830
- // force usage of execfile
831
+ // force usage of execFile
831
832
  _useExecFile?: boolean;
832
833
  // exec normally mirrors output (and returns it)
833
834
  // -> set this to true to only return the output
834
- suppressOutput?: boolean;
835
+ encoding?: string | null;
835
836
 
836
837
  // merge stdout & stderr into one output
837
838
  mergeIo?: boolean;
838
839
 
839
- encoding?: string | null;
840
+ suppressOutput?: boolean;
840
841
  }
841
842
 
842
843
  export interface NugetPushOpts {
@@ -1063,7 +1064,7 @@ declare global {
1063
1064
 
1064
1065
  /**
1065
1066
  * when set true, output will not be echoed back on the
1066
- * console but you will be able to get it from a custom
1067
+ * console, but you will be able to get it from a custom
1067
1068
  * io writer or the result from after spawn completes
1068
1069
  */
1069
1070
  suppressOutput?: boolean;
@@ -1095,7 +1096,7 @@ declare global {
1095
1096
 
1096
1097
  /**
1097
1098
  * when set true, output will not be echoed back on the
1098
- * console but you will be able to get it from a custom
1099
+ * console, but you will be able to get it from a custom
1099
1100
  * io writer or the result from after spawn completes
1100
1101
  */
1101
1102
  suppressOutput?: boolean;
@@ -1501,6 +1502,16 @@ declare global {
1501
1502
  timeout?: number;
1502
1503
  }
1503
1504
 
1505
+ interface DotNetSearchPackagesOptions extends DotNetBaseOptions {
1506
+ source?: string;
1507
+ search?: string;
1508
+ take?: number;
1509
+ skip?: number;
1510
+ exactMatch?: boolean;
1511
+ preRelease?: boolean;
1512
+ configFile?: string;
1513
+ }
1514
+
1504
1515
  interface IoConsumers {
1505
1516
  stdout?: IoConsumer;
1506
1517
  stderr?: IoConsumer;
@@ -1561,6 +1572,7 @@ declare global {
1561
1572
  type DotNetEnableNugetSourceFunction = (source: string | NugetSource) => Promise<void>;
1562
1573
  type DotNetDisableNugetSourceFunction = (source: string | NugetSource) => Promise<void>;
1563
1574
  type DotNetTryMatchNugetSourceFunction = (nameOrUrlOrHostOrSpec: string | Partial<NugetSource> | RegExp) => Promise<Optional<NugetSource>>;
1575
+ type DotNetSearchNugetPackagesFunction = (opts: DotNetSearchPackagesOptions | string) => Promise<PackageInfo[]>;
1564
1576
 
1565
1577
  interface DotNetCli {
1566
1578
  clean: DotNetCleanFunction;
@@ -1578,6 +1590,7 @@ declare global {
1578
1590
  disableNugetSource: DotNetDisableNugetSourceFunction;
1579
1591
  tryFindConfiguredNugetSource: DotNetTryMatchNugetSourceFunction;
1580
1592
  incrementTempDbPortHintIfFound: (env: Dictionary<string>) => void;
1593
+ searchPackages: DotNetSearchNugetPackagesFunction;
1581
1594
  }
1582
1595
 
1583
1596
  type ReadCsProjNode = (csproj: string) => Promise<string>;
@@ -1715,7 +1728,7 @@ declare global {
1715
1728
  "bzip2-1.0.5" |
1716
1729
  "bzip2-1.0.6" |
1717
1730
  "Caldera" |
1718
- "CATOSL-1.1" |
1731
+ "CATO-1.1" |
1719
1732
  "CC-BY-1.0" |
1720
1733
  "CC-BY-2.0" |
1721
1734
  "CC-BY-2.5" |