zarro 1.170.12 โ 1.170.16
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/gulp-tasks/modules/dotnet-cli.js +75 -3
- package/package.json +1 -1
- package/types.d.ts +33 -7
|
@@ -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
|
-
|
|
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,76 @@ 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
|
+
}
|
|
808
|
+
async function installPackage(opts) {
|
|
809
|
+
if (!opts) {
|
|
810
|
+
throw new Error(`no options passed to 'installPackage' - target project and package name not specified`);
|
|
811
|
+
}
|
|
812
|
+
if (!`${opts.projectFile}`.trim()) {
|
|
813
|
+
throw new Error(`projectFile not specified`);
|
|
814
|
+
}
|
|
815
|
+
if (!`${opts.id}`.trim()) {
|
|
816
|
+
throw new Error(`package id not specified`);
|
|
817
|
+
}
|
|
818
|
+
const args = ["add", "package", opts.projectFile, opts.id];
|
|
819
|
+
pushIfSet(args, opts.version, "--version");
|
|
820
|
+
pushIfSet(args, opts.framework, "--framework");
|
|
821
|
+
pushFlag(args, opts.noRestore, "--no-restore");
|
|
822
|
+
pushIfSet(args, opts.source, "--source");
|
|
823
|
+
pushIfSet(args, opts.packageDirectory, "--package-directory");
|
|
824
|
+
pushFlag(args, opts.preRelease, "--prerelease");
|
|
825
|
+
await runDotNetWith(args, opts);
|
|
826
|
+
}
|
|
757
827
|
module.exports = {
|
|
758
828
|
test,
|
|
759
829
|
build,
|
|
@@ -769,6 +839,8 @@ WARNING: 'dotnet pack' ignores --version-suffix when a nuspec file is provided.
|
|
|
769
839
|
disableNugetSource,
|
|
770
840
|
enableNugetSource,
|
|
771
841
|
tryFindConfiguredNugetSource,
|
|
772
|
-
incrementTempDbPortHintIfFound
|
|
842
|
+
incrementTempDbPortHintIfFound,
|
|
843
|
+
searchPackages,
|
|
844
|
+
installPackage
|
|
773
845
|
};
|
|
774
846
|
})();
|
package/package.json
CHANGED
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
|
|
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
|
-
|
|
835
|
+
encoding?: string | null;
|
|
835
836
|
|
|
836
837
|
// merge stdout & stderr into one output
|
|
837
838
|
mergeIo?: boolean;
|
|
838
839
|
|
|
839
|
-
|
|
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,27 @@ 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
|
+
|
|
1515
|
+
interface DotNetInstallNugetPackageOption extends DotNetBaseOptions {
|
|
1516
|
+
id: string;
|
|
1517
|
+
projectFile: string;
|
|
1518
|
+
version?: string;
|
|
1519
|
+
framework?: string;
|
|
1520
|
+
noRestore?: boolean;
|
|
1521
|
+
source?: string;
|
|
1522
|
+
packageDirectory?: string;
|
|
1523
|
+
preRelease?: boolean;
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1504
1526
|
interface IoConsumers {
|
|
1505
1527
|
stdout?: IoConsumer;
|
|
1506
1528
|
stderr?: IoConsumer;
|
|
@@ -1561,6 +1583,8 @@ declare global {
|
|
|
1561
1583
|
type DotNetEnableNugetSourceFunction = (source: string | NugetSource) => Promise<void>;
|
|
1562
1584
|
type DotNetDisableNugetSourceFunction = (source: string | NugetSource) => Promise<void>;
|
|
1563
1585
|
type DotNetTryMatchNugetSourceFunction = (nameOrUrlOrHostOrSpec: string | Partial<NugetSource> | RegExp) => Promise<Optional<NugetSource>>;
|
|
1586
|
+
type DotNetSearchNugetPackagesFunction = (opts: DotNetSearchPackagesOptions | string) => Promise<PackageInfo[]>;
|
|
1587
|
+
type DotNetInstallNugetPackageFunction = (opts: DotNetInstallNugetPackageOption | string) => Promise<void>;
|
|
1564
1588
|
|
|
1565
1589
|
interface DotNetCli {
|
|
1566
1590
|
clean: DotNetCleanFunction;
|
|
@@ -1578,6 +1602,8 @@ declare global {
|
|
|
1578
1602
|
disableNugetSource: DotNetDisableNugetSourceFunction;
|
|
1579
1603
|
tryFindConfiguredNugetSource: DotNetTryMatchNugetSourceFunction;
|
|
1580
1604
|
incrementTempDbPortHintIfFound: (env: Dictionary<string>) => void;
|
|
1605
|
+
searchPackages: DotNetSearchNugetPackagesFunction;
|
|
1606
|
+
installPackage: DotNetInstallNugetPackageFunction;
|
|
1581
1607
|
}
|
|
1582
1608
|
|
|
1583
1609
|
type ReadCsProjNode = (csproj: string) => Promise<string>;
|
|
@@ -1715,7 +1741,7 @@ declare global {
|
|
|
1715
1741
|
"bzip2-1.0.5" |
|
|
1716
1742
|
"bzip2-1.0.6" |
|
|
1717
1743
|
"Caldera" |
|
|
1718
|
-
"
|
|
1744
|
+
"CATO-1.1" |
|
|
1719
1745
|
"CC-BY-1.0" |
|
|
1720
1746
|
"CC-BY-2.0" |
|
|
1721
1747
|
"CC-BY-2.5" |
|