zarro 1.172.2 → 1.173.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.
@@ -5,7 +5,7 @@
5
5
  const { isRegExp } = types;
6
6
  const ZarroError = requireModule("zarro-error");
7
7
  const path = require("path");
8
- const { fileExists, readTextFile } = require("yafs");
8
+ const { fileExists, readTextFile, ls, FsEntities } = require("yafs");
9
9
  const { yellow } = requireModule("ansi-colors");
10
10
  const q = requireModule("quote-if-required");
11
11
  const { pushIfSet, pushFlag } = requireModule("cli-support");
@@ -264,7 +264,7 @@
264
264
  async function enableNugetSource(source) {
265
265
  const toEnable = await tryFindConfiguredNugetSource(source);
266
266
  if (!toEnable) {
267
- throw new Error(`unable to find source matching: ${JSON.stringify(source)}`);
267
+ throw new ZarroError(`unable to find source matching: ${JSON.stringify(source)}`);
268
268
  }
269
269
  await runDotNetWith(["dotnet", "nuget", "enable", "source", toEnable.name], {
270
270
  suppressOutput: true
@@ -273,7 +273,7 @@
273
273
  async function disableNugetSource(source) {
274
274
  const toDisable = await tryFindConfiguredNugetSource(source);
275
275
  if (!toDisable) {
276
- throw new Error(`unable to find source matching: ${JSON.stringify(source)}`);
276
+ throw new ZarroError(`unable to find source matching: ${JSON.stringify(source)}`);
277
277
  }
278
278
  await runDotNetWith(["dotnet", "nuget", "disable", "source", toDisable.name], {
279
279
  suppressOutput: true
@@ -334,7 +334,7 @@
334
334
  }
335
335
  function single(results) {
336
336
  if (results.length > 1) {
337
- throw new Error(`multiple matches for nuget source by name / url / host: ${JSON.stringify(find)}\nfound:\n${JSON.stringify(allSources, null, 2)}`);
337
+ throw new ZarroError(`multiple matches for nuget source by name / url / host: ${JSON.stringify(find)}\nfound:\n${JSON.stringify(allSources, null, 2)}`);
338
338
  }
339
339
  return results[0];
340
340
  }
@@ -356,7 +356,7 @@
356
356
  async function removeNugetSourceByName(find) {
357
357
  const source = await tryFindConfiguredNugetSource(find);
358
358
  if (!source) {
359
- throw new Error(`Can't find source with '${find}'`);
359
+ throw new ZarroError(`Can't find source with '${find}'`);
360
360
  }
361
361
  const result = await runDotNetWith(["nuget", "remove", "source", source.name], { suppressOutput: true });
362
362
  if (system.isError(result)) {
@@ -469,7 +469,7 @@ WARNING: 'dotnet pack' ignores --version-suffix when a nuspec file is provided.
469
469
  if (await fileExists(test)) {
470
470
  return test;
471
471
  }
472
- throw new Error(`Unable to resolve '${resolvedPath}' relative to '${containerDir}'`);
472
+ throw new ZarroError(`Unable to resolve '${resolvedPath}' relative to '${containerDir}'`);
473
473
  }
474
474
  }
475
475
  async function shouldIncludeNuspec(opts) {
@@ -495,7 +495,7 @@ WARNING: 'dotnet pack' ignores --version-suffix when a nuspec file is provided.
495
495
  async function nugetPush(opts) {
496
496
  validateCommonBuildOptions(opts);
497
497
  if (!opts.apiKey) {
498
- throw new Error("apiKey was not specified");
498
+ throw new ZarroError("apiKey was not specified");
499
499
  }
500
500
  const args = [
501
501
  "nuget",
@@ -554,7 +554,7 @@ WARNING: 'dotnet pack' ignores --version-suffix when a nuspec file is provided.
554
554
  // for simplicity: return the last system result (at least for now, until there's a reason to get clever)
555
555
  if (lastResult === undefined) {
556
556
  // this is really here for TS
557
- throw new Error(`No build configurations could be determined, which is odd, because there's even a fallback.`);
557
+ throw new ZarroError(`No build configurations could be determined, which is odd, because there's even a fallback.`);
558
558
  }
559
559
  return lastResult;
560
560
  }
@@ -601,7 +601,7 @@ WARNING: 'dotnet pack' ignores --version-suffix when a nuspec file is provided.
601
601
  });
602
602
  const result = enabledSources[0];
603
603
  if (!result) {
604
- throw new Error(`Unable to determine default nuget source. Please specify 'source' on your options.`);
604
+ throw new ZarroError(`Unable to determine default nuget source. Please specify 'source' on your options.`);
605
605
  }
606
606
  return result;
607
607
  }
@@ -670,6 +670,10 @@ WARNING: 'dotnet pack' ignores --version-suffix when a nuspec file is provided.
670
670
  }
671
671
  }
672
672
  async function runDotNetWith(args, opts) {
673
+ opts = opts || {};
674
+ if (opts.suppressOutput === undefined) {
675
+ opts.suppressOutput = true;
676
+ }
673
677
  let result;
674
678
  try {
675
679
  result = await system("dotnet", args, {
@@ -677,7 +681,8 @@ WARNING: 'dotnet pack' ignores --version-suffix when a nuspec file is provided.
677
681
  stderr: opts.stderr,
678
682
  suppressOutput: opts.suppressOutput,
679
683
  suppressStdIoInErrors: opts.suppressStdIoInErrors,
680
- env: opts.env
684
+ env: opts.env,
685
+ cwd: opts.cwd
681
686
  });
682
687
  }
683
688
  catch (e) {
@@ -761,9 +766,23 @@ WARNING: 'dotnet pack' ignores --version-suffix when a nuspec file is provided.
761
766
  usingFallback
762
767
  });
763
768
  }
769
+ function parsePackageSearchResult(stdout) {
770
+ const allText = stdout.join(" ");
771
+ let parsed;
772
+ try {
773
+ parsed = JSON.parse(allText);
774
+ }
775
+ catch (e) {
776
+ throw new ZarroError(`Unable to parse json from:\n${allText}`);
777
+ }
778
+ if (parsed.problems && parsed.problems.length) {
779
+ throw new ZarroError(`unable to perform package search (check your access token):\n${parsed.problems.join("\n")}`);
780
+ }
781
+ return parsed;
782
+ }
764
783
  async function searchPackages(options) {
765
784
  if (!options) {
766
- throw new Error(`No options or search string provided`);
785
+ throw new ZarroError(`No options or search string provided`);
767
786
  }
768
787
  const opts = typeof options === "string"
769
788
  ? { search: options }
@@ -798,7 +817,7 @@ WARNING: 'dotnet pack' ignores --version-suffix when a nuspec file is provided.
798
817
  const systemError = rawResult;
799
818
  throw wrapSearchError(systemError);
800
819
  }
801
- const allText = stdout.join(" "), parsed = JSON.parse(allText);
820
+ const parsed = parsePackageSearchResult(stdout);
802
821
  const finalResult = [];
803
822
  for (const sourceResult of parsed.searchResult) {
804
823
  for (const pkg of sourceResult.packages) {
@@ -828,35 +847,21 @@ WARNING: 'dotnet pack' ignores --version-suffix when a nuspec file is provided.
828
847
  function wrapSearchError(e) {
829
848
  return new Error(`Unable to perform package search (check your access token if necessary): ${e}`);
830
849
  }
831
- function parsePackageSearchResult(stdout) {
832
- const allText = stdout.join(" ");
833
- let parsed;
834
- try {
835
- parsed = JSON.parse(allText);
836
- }
837
- catch (e) {
838
- throw new Error(`Unable to parse json from:\n${allText}`);
839
- }
840
- if (parsed.problems && parsed.problems.length) {
841
- throw new Error(`unable to perform package search (check your access token):\n${parsed.problems.join("\n")}`);
842
- }
843
- return parsed;
844
- }
845
850
  async function installPackage(opts) {
846
851
  if (!opts) {
847
- throw new Error(`no options passed to 'installPackage' - target project and package name not specified`);
852
+ throw new ZarroError(`no options passed to 'installPackage' - target project and package name not specified`);
848
853
  }
849
854
  if (!`${opts.projectFile}`.trim()) {
850
- throw new Error(`projectFile not specified`);
855
+ throw new ZarroError(`projectFile not specified`);
851
856
  }
852
857
  if (!`${opts.id}`.trim()) {
853
- throw new Error(`package id not specified`);
858
+ throw new ZarroError(`package id not specified`);
854
859
  }
855
860
  const args = ["add", opts.projectFile, "package", opts.id];
856
861
  pushIfSet(args, opts.version, "--version");
857
862
  pushIfSet(args, opts.framework, "--framework");
858
863
  pushFlag(args, opts.noRestore, "--no-restore");
859
- pushIfSet(args, opts.source, "--source");
864
+ pushIfSet(args, await resolveSourceUrlFor(opts.source), "--source");
860
865
  pushIfSet(args, opts.packageDirectory, "--package-directory");
861
866
  pushFlag(args, opts.preRelease, "--prerelease");
862
867
  if (opts.suppressOutput === undefined) {
@@ -864,6 +869,165 @@ WARNING: 'dotnet pack' ignores --version-suffix when a nuspec file is provided.
864
869
  }
865
870
  await runDotNetWith(args, opts);
866
871
  }
872
+ const defaultCreateOptions = {
873
+ skipTemplateUpdateCheck: true
874
+ };
875
+ const solutionRegex = /.*\.sln$/i;
876
+ function isSolution(filePath) {
877
+ return solutionRegex.test(filePath);
878
+ }
879
+ const projectRegex = /.*\.csproj$/i;
880
+ function isProject(filePath) {
881
+ return projectRegex.test(filePath);
882
+ }
883
+ async function create(opts) {
884
+ verifyExists(opts, `no options passed to create`);
885
+ opts = Object.assign(Object.assign({}, defaultCreateOptions), opts);
886
+ verifyNonEmptyString(opts.template, `template was not specified and is required`);
887
+ const args = ["new", opts.template];
888
+ pushIfSet(args, opts.output, "--output");
889
+ pushIfSet(args, opts.name, "--name");
890
+ pushFlag(args, opts.skipTemplateUpdateCheck, "--no-update-check");
891
+ pushIfSet(args, opts.projectFile, "--project");
892
+ pushIfSet(args, opts.verbosity, "--verbosity");
893
+ pushFlag(args, opts.enableDiagnostics, "--diagnostics");
894
+ if (opts.suppressOutput === undefined) {
895
+ opts.suppressOutput = true;
896
+ }
897
+ const newFiles = await runAndReportNewFiles(opts.cwd, () => runDotNetWith(args, opts));
898
+ return newFiles.find(isSolution)
899
+ || newFiles.find(isProject)
900
+ || newFiles[0];
901
+ }
902
+ async function runAndReportNewFiles(where, toRun) {
903
+ const before = new Set(await listDotNetFilesUnder(where));
904
+ await toRun();
905
+ const after = await listDotNetFilesUnder(where);
906
+ const added = [];
907
+ for (const item of after) {
908
+ if (!before.has(item)) {
909
+ added.push(item);
910
+ }
911
+ }
912
+ return added;
913
+ }
914
+ async function listDotNetFilesUnder(folder) {
915
+ return await ls(folder || ".", {
916
+ entities: FsEntities.files,
917
+ fullPaths: true,
918
+ recurse: true,
919
+ doNotTraverse: [
920
+ /node_modules/,
921
+ /[\\/]obj[\\/]/,
922
+ /[\\/]bin[\\/]/
923
+ ]
924
+ });
925
+ }
926
+ async function addProjectToSolution(opts) {
927
+ verifyExists(opts, "no options were passed to 'addProjectToSolution'");
928
+ verifyNonEmptyString(opts.projectFile, "path to project file is required");
929
+ verifyNonEmptyString(opts.solutionFile, "path to solution file is required");
930
+ if (!await fileExists(opts.solutionFile)) {
931
+ throw new ZarroError(`file not found: ${opts.solutionFile}`);
932
+ }
933
+ if (!await fileExists(opts.projectFile)) {
934
+ throw new ZarroError(`file not found: ${opts.projectFile}`);
935
+ }
936
+ const args = ["sln", opts.solutionFile, "add", opts.projectFile];
937
+ await runDotNetWith(args, opts);
938
+ }
939
+ async function listProjects(solutionFile) {
940
+ const args = ["sln", solutionFile, "list"], basePath = path.dirname(solutionFile), rawResult = await runDotNetWith(args), result = [];
941
+ for (const line of rawResult.stdout) {
942
+ const trimmed = line.trim(), test = path.join(basePath, trimmed);
943
+ if (await fileExists(test)) {
944
+ result.push(test);
945
+ }
946
+ }
947
+ return result;
948
+ }
949
+ async function resolveSourceUrlFor(source) {
950
+ if (!source) {
951
+ return undefined;
952
+ }
953
+ const lowered = source.toLowerCase();
954
+ const sources = await listNugetSources();
955
+ for (const source of sources) {
956
+ if (source.name.toLowerCase() == lowered) {
957
+ return source.url;
958
+ }
959
+ }
960
+ // hopefully this is a valid source that dotnet understands
961
+ // - in my testing, dotnet doesn't understand source names,
962
+ // unlike nuget.exe
963
+ return source;
964
+ }
965
+ async function upgradePackages(opts) {
966
+ var _a;
967
+ verifyExists(opts, "no options provided to upgradePackages");
968
+ verifyNonEmptyString(opts.pathToProjectOrSolution, "no path to a project or solution was supplied");
969
+ if (!opts.packages || opts.packages.length === 0) {
970
+ throw new ZarroError(`no packages were specified`);
971
+ }
972
+ const projects = isProject(opts.pathToProjectOrSolution)
973
+ ? [opts.pathToProjectOrSolution]
974
+ : await listProjects(opts.pathToProjectOrSolution);
975
+ for (const project of projects) {
976
+ const projectPackages = await listPackages(project);
977
+ const toUpgrade = [];
978
+ for (const pkg of opts.packages) {
979
+ const test = isRegex(pkg)
980
+ ? (s) => pkg.test(s)
981
+ : (s) => projectPackages.find(pp => pp.id.toLowerCase() === s.toLowerCase());
982
+ for (const projectPackage of projectPackages) {
983
+ if (test(projectPackage.id)) {
984
+ toUpgrade.push(projectPackage.id);
985
+ }
986
+ }
987
+ }
988
+ const upstream = await searchForMultiplePackages(toUpgrade, opts.source, (_a = opts.preRelease) !== null && _a !== void 0 ? _a : false);
989
+ for (const pkg of upstream) {
990
+ await installPackage({
991
+ projectFile: project,
992
+ id: pkg.id,
993
+ version: pkg.version.toString(),
994
+ source: opts.source,
995
+ noRestore: opts.noRestore,
996
+ preRelease: opts.preRelease
997
+ });
998
+ }
999
+ }
1000
+ }
1001
+ async function searchForMultiplePackages(packageIds, source, preRelease) {
1002
+ // TODO: optimise
1003
+ const promises = packageIds.map(id => searchPackages({
1004
+ search: id,
1005
+ exactMatch: true,
1006
+ preRelease,
1007
+ source,
1008
+ take: 1
1009
+ }));
1010
+ const allResults = await Promise.all(promises), finalResult = [];
1011
+ for (const resultArray of allResults) {
1012
+ for (const result of resultArray) {
1013
+ finalResult.push(result);
1014
+ }
1015
+ }
1016
+ return finalResult;
1017
+ }
1018
+ function isRegex(value) {
1019
+ return value instanceof RegExp;
1020
+ }
1021
+ function verifyExists(value, failMessage) {
1022
+ if (value === undefined || value === null) {
1023
+ throw new ZarroError(failMessage);
1024
+ }
1025
+ }
1026
+ function verifyNonEmptyString(value, failMessage) {
1027
+ if (!`${value}`.trim()) {
1028
+ throw new ZarroError(failMessage);
1029
+ }
1030
+ }
867
1031
  module.exports = {
868
1032
  test,
869
1033
  build,
@@ -881,6 +1045,10 @@ WARNING: 'dotnet pack' ignores --version-suffix when a nuspec file is provided.
881
1045
  tryFindConfiguredNugetSource,
882
1046
  incrementTempDbPortHintIfFound,
883
1047
  searchPackages,
884
- installPackage
1048
+ installPackage,
1049
+ upgradePackages,
1050
+ create,
1051
+ listProjects,
1052
+ addProjectToSolution
885
1053
  };
886
1054
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zarro",
3
- "version": "1.172.2",
3
+ "version": "1.173.2",
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"
@@ -61,7 +61,7 @@
61
61
  "decompress": "^4.2.1",
62
62
  "del": "^5.1.0",
63
63
  "event-stream": "^4.0.1",
64
- "exec-step": "^0.8.0",
64
+ "exec-step": "^0.11.0",
65
65
  "fancy-log": "^1.3.3",
66
66
  "gulp": "^4.0.0",
67
67
  "gulp-debug": "^4.0.0",
package/types.d.ts CHANGED
@@ -22,6 +22,7 @@ interface RequireModule<T>
22
22
  }
23
23
 
24
24
  declare global {
25
+
25
26
  function requireModule<T>(module: string): T;
26
27
 
27
28
  // copied out of @types/fancy-log because imports are being stupid
@@ -115,7 +116,9 @@ declare global {
115
116
  threshold: LogThreshold;
116
117
 
117
118
  outputDisabled: boolean;
119
+
118
120
  enableOutput(): void;
121
+
119
122
  disableOutput(): void;
120
123
 
121
124
  }
@@ -1202,15 +1205,21 @@ declare global {
1202
1205
  stdout: string[];
1203
1206
 
1204
1207
  isResult(): this is SystemResult;
1208
+
1205
1209
  isError(): this is SystemError;
1206
1210
  }
1207
1211
 
1208
1212
  interface SystemResultBuilder {
1209
1213
  withExe(exe: string): SystemResultBuilder;
1214
+
1210
1215
  withArgs(args: string[]): SystemResultBuilder;
1216
+
1211
1217
  withExitCode(code: number): SystemResultBuilder;
1218
+
1212
1219
  withStdErr(lines: string[] | string): SystemResultBuilder;
1220
+
1213
1221
  withStdOut(lines: string[] | string): SystemResultBuilder;
1222
+
1214
1223
  build(): SystemResult;
1215
1224
  }
1216
1225
 
@@ -1244,11 +1253,13 @@ declare global {
1244
1253
  interface System
1245
1254
  extends SystemFunction {
1246
1255
  isError(o: any): o is SystemError;
1256
+
1247
1257
  isResult(o: any): o is SystemResult;
1248
1258
  }
1249
1259
 
1250
1260
  interface TempFile {
1251
1261
  path: string;
1262
+
1252
1263
  destroy(): void;
1253
1264
  }
1254
1265
 
@@ -1262,11 +1273,13 @@ declare global {
1262
1273
  }
1263
1274
 
1264
1275
  type ZarroTestPackage = "local" | "beta" | "latest" | string;
1276
+
1265
1277
  interface TestZarroOptions {
1266
1278
  packageVersion: ZarroTestPackage;
1267
1279
  tasks: string | string[];
1268
1280
  rollback?: boolean;
1269
1281
  }
1282
+
1270
1283
  type TestZarro = (opts: TestZarroOptions) => Promise<void>;
1271
1284
 
1272
1285
  type GulpNugetRestore = (opts: NugetRestoreOptions) => Stream;
@@ -1288,11 +1301,12 @@ declare global {
1288
1301
  gulpNpmRun: (gulp: Gulp) => void;
1289
1302
  isNpmScript: (name: string) => boolean;
1290
1303
  }
1304
+
1291
1305
  type Nuget = (args: string[], opts?: SystemOptions) => Promise<void>;
1292
1306
 
1293
1307
  interface CliSupport {
1294
- pushIfSet: (args: string[], value: Optional<string | number>, cliSwitch: string) => void;
1295
- pushFlag: (args: string[], value: Optional<boolean>, cliSwitch: string) => void;
1308
+ pushIfSet: (args: string[], value: Nullable<Optional<string | number>>, cliSwitch: string) => void;
1309
+ pushFlag: (args: string[], value: Nullable<Optional<boolean>>, cliSwitch: string) => void;
1296
1310
  }
1297
1311
 
1298
1312
  interface NugetInstallOptions {
@@ -1324,11 +1338,17 @@ declare global {
1324
1338
 
1325
1339
  interface NugetCli {
1326
1340
  install: (opts: NugetInstallOptions) => Promise<void>;
1341
+
1327
1342
  clearAllCache(): Promise<void>;
1343
+
1328
1344
  clearHttpCache(): Promise<void>;
1345
+
1329
1346
  listSources(): Promise<NugetSource[]>;
1347
+
1330
1348
  addSource(src: NugetAddSourceOptions): Promise<void>;
1349
+
1331
1350
  enableSource(name: string): Promise<void>;
1351
+
1332
1352
  disableSource(name: string): Promise<void>;
1333
1353
  }
1334
1354
 
@@ -1349,6 +1369,7 @@ declare global {
1349
1369
  outputStream?: NodeJS.WriteStream,
1350
1370
  validator?: (s: string) => boolean;
1351
1371
  }
1372
+
1352
1373
  type AskFunction = (message: string, options?: AskOptions) => Promise<string>;
1353
1374
  type Ask = {
1354
1375
  ask: AskFunction
@@ -1373,13 +1394,17 @@ declare global {
1373
1394
 
1374
1395
  interface DotNetBaseOptions
1375
1396
  extends IoConsumers {
1376
- msbuildProperties?: Dictionary<string>;
1377
- additionalArguments?: string[];
1378
1397
  verbosity?: DotNetVerbosity | string;
1379
1398
  // when set, errors are returned instead of thrown
1380
1399
  suppressErrors?: boolean;
1381
1400
  suppressStdIoInErrors?: boolean;
1382
1401
  suppressOutput?: boolean;
1402
+ }
1403
+
1404
+ interface DotNetMsBuildOptions
1405
+ extends DotNetBaseOptions {
1406
+ msbuildProperties?: Dictionary<string>;
1407
+ additionalArguments?: string[];
1383
1408
 
1384
1409
  env?: Dictionary<string>;
1385
1410
  }
@@ -1426,7 +1451,7 @@ declare global {
1426
1451
  type GulpDotNetCover = (opts?: GulpDotNetCoverOptions) => Transform;
1427
1452
 
1428
1453
  interface DotNetCommonBuildOptions
1429
- extends DotNetBaseOptions {
1454
+ extends DotNetMsBuildOptions {
1430
1455
  target: string;
1431
1456
  configuration?: string | string[];
1432
1457
  framework?: string;
@@ -1456,7 +1481,7 @@ declare global {
1456
1481
  }
1457
1482
 
1458
1483
  interface DotNetPackOptions
1459
- extends DotNetBaseOptions {
1484
+ extends DotNetMsBuildOptions {
1460
1485
  target: string;
1461
1486
  output?: string;
1462
1487
  configuration?: string | string[];
@@ -1485,7 +1510,7 @@ declare global {
1485
1510
  }
1486
1511
 
1487
1512
  interface DotNetCleanOptions
1488
- extends DotNetBaseOptions {
1513
+ extends DotNetMsBuildOptions {
1489
1514
  target: string;
1490
1515
  framework?: string;
1491
1516
  runtime?: string;
@@ -1494,7 +1519,7 @@ declare global {
1494
1519
  }
1495
1520
 
1496
1521
  interface DotNetNugetPushOptions
1497
- extends DotNetBaseOptions {
1522
+ extends DotNetMsBuildOptions {
1498
1523
  target: string;
1499
1524
  apiKey?: string;
1500
1525
  symbolApiKey?: string;
@@ -1508,8 +1533,9 @@ declare global {
1508
1533
  timeout?: number;
1509
1534
  }
1510
1535
 
1511
- interface DotNetSearchPackagesOptions extends DotNetBaseOptions {
1512
- source?: string;
1536
+ interface DotNetSearchPackagesOptions
1537
+ extends DotNetMsBuildOptions {
1538
+ source?: string | null | undefined;
1513
1539
  search?: string;
1514
1540
  take?: number;
1515
1541
  skip?: number;
@@ -1519,7 +1545,8 @@ declare global {
1519
1545
  latestOnly?: boolean;
1520
1546
  }
1521
1547
 
1522
- interface DotNetInstallNugetPackageOption extends DotNetBaseOptions {
1548
+ interface DotNetInstallNugetPackageOption
1549
+ extends DotNetMsBuildOptions {
1523
1550
  id: string;
1524
1551
  projectFile: string;
1525
1552
  version?: string;
@@ -1533,6 +1560,8 @@ declare global {
1533
1560
  interface IoConsumers {
1534
1561
  stdout?: IoConsumer;
1535
1562
  stderr?: IoConsumer;
1563
+ cwd?: string;
1564
+ env?: NodeJS.ProcessEnv
1536
1565
  }
1537
1566
 
1538
1567
  interface DotNetTestOptions
@@ -1576,6 +1605,38 @@ declare global {
1576
1605
  usingFallback: boolean;
1577
1606
  }
1578
1607
 
1608
+ interface DotNetCreateBaseOptions
1609
+ extends DotNetBaseOptions {
1610
+ output?: string;
1611
+ name: string;
1612
+ dryRun?: boolean;
1613
+ force?: boolean;
1614
+ skipTemplateUpdateCheck?: boolean;
1615
+ enableDiagnostics?: boolean;
1616
+ }
1617
+
1618
+ interface DotNetCreateOptions
1619
+ extends DotNetCreateBaseOptions {
1620
+ template: string;
1621
+ projectFile?: string;
1622
+ }
1623
+
1624
+ interface DotNetAddProjectToSolutionOptions
1625
+ extends DotNetBaseOptions {
1626
+ solutionFile: string;
1627
+ projectFile: string;
1628
+ }
1629
+
1630
+ type StringOrRegex = string | RegExp;
1631
+
1632
+ interface DotNetUpgradePackagesOptions {
1633
+ pathToProjectOrSolution: string;
1634
+ packages: StringOrRegex[],
1635
+ preRelease?: boolean;
1636
+ noRestore?: boolean;
1637
+ source?: string;
1638
+ }
1639
+
1579
1640
  type DotNetTestFunction = (opts: DotNetTestOptions) => Promise<SystemResult | SystemError>;
1580
1641
  type DotNetBuildFunction = (opts: DotNetBuildOptions) => Promise<SystemResult | SystemError>;
1581
1642
  type DotNetPackFunction = (opts: DotNetPackOptions) => Promise<SystemResult | SystemError>;
@@ -1592,6 +1653,10 @@ declare global {
1592
1653
  type DotNetTryMatchNugetSourceFunction = (nameOrUrlOrHostOrSpec: string | Partial<NugetSource> | RegExp) => Promise<Optional<NugetSource>>;
1593
1654
  type DotNetSearchNugetPackagesFunction = (opts: DotNetSearchPackagesOptions | string) => Promise<PackageInfo[]>;
1594
1655
  type DotNetInstallNugetPackageFunction = (opts: DotNetInstallNugetPackageOption | string) => Promise<void>;
1656
+ type DotNetUpgradePackagesFunction = (opts: DotNetUpgradePackagesOptions) => Promise<void>;
1657
+ type DotNetCreateFunction = (opts: DotNetCreateOptions) => Promise<string>;
1658
+ type DotNetListProjectsFunction = (solutionFile: string) => Promise<string[]>;
1659
+ type DotNetAddProjectToSolutionFunction = (opts: DotNetAddProjectToSolutionOptions) => Promise<void>;
1595
1660
 
1596
1661
  interface DotNetCli {
1597
1662
  clean: DotNetCleanFunction;
@@ -1611,6 +1676,10 @@ declare global {
1611
1676
  incrementTempDbPortHintIfFound: (env: Dictionary<string>) => void;
1612
1677
  searchPackages: DotNetSearchNugetPackagesFunction;
1613
1678
  installPackage: DotNetInstallNugetPackageFunction;
1679
+ upgradePackages: DotNetUpgradePackagesFunction;
1680
+ create: DotNetCreateFunction;
1681
+ listProjects: DotNetListProjectsFunction;
1682
+ addProjectToSolution: DotNetAddProjectToSolutionFunction;
1614
1683
  }
1615
1684
 
1616
1685
  type ReadCsProjNode = (csproj: string) => Promise<string>;