lage 0.34.1-fallback.2 → 0.40.0

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.
Files changed (134) hide show
  1. package/CHANGELOG.json +10 -85
  2. package/CHANGELOG.md +7 -47
  3. package/README.md +2 -0
  4. package/lib/cache/backfill.d.ts +4 -3
  5. package/lib/cache/backfill.js +16 -12
  6. package/lib/cache/cacheConfig.d.ts +16 -1
  7. package/lib/cache/cacheConfig.js +1 -4
  8. package/lib/cache/salt.js +7 -2
  9. package/lib/command/info.js +47 -37
  10. package/lib/command/run.d.ts +0 -6
  11. package/lib/command/run.js +8 -21
  12. package/lib/context.js +2 -2
  13. package/lib/displayReportAndExit.js +1 -1
  14. package/lib/logger/LogEntry.d.ts +1 -1
  15. package/lib/logger/initReporters.d.ts +1 -2
  16. package/lib/logger/initReporters.js +0 -4
  17. package/lib/logger/reporters/JsonReporter.js +9 -9
  18. package/lib/logger/reporters/NpmLogReporter.js +27 -19
  19. package/lib/task/NpmScriptTask.d.ts +29 -4
  20. package/lib/task/NpmScriptTask.js +95 -6
  21. package/lib/task/parsePipelineConfig.d.ts +12 -0
  22. package/lib/task/parsePipelineConfig.js +34 -0
  23. package/lib/task/taskRunner.d.ts +10 -0
  24. package/lib/task/taskRunner.js +98 -0
  25. package/lib/types/CacheOptions.d.ts +0 -1
  26. package/lib/types/ConfigOptions.d.ts +2 -2
  27. package/lib/types/Pipeline.d.ts +4 -0
  28. package/lib/types/{PipelineDefinition.js → Pipeline.js} +0 -0
  29. package/lib/types/Priority.d.ts +1 -1
  30. package/lib/types/RunContext.d.ts +6 -4
  31. package/lib/workspace/generateTopologicalGraph.d.ts +1 -1
  32. package/lib/workspace/getPackagePipelines.d.ts +2 -2
  33. package/package.json +12 -15
  34. package/coverage/clover.xml +0 -2459
  35. package/coverage/coverage-final.json +0 -41
  36. package/coverage/lcov-report/base.css +0 -224
  37. package/coverage/lcov-report/block-navigation.js +0 -79
  38. package/coverage/lcov-report/e2e/index.html +0 -111
  39. package/coverage/lcov-report/e2e/parseNdJson.ts.html +0 -107
  40. package/coverage/lcov-report/favicon.png +0 -0
  41. package/coverage/lcov-report/index.html +0 -216
  42. package/coverage/lcov-report/lib/args.d.ts.html +0 -107
  43. package/coverage/lcov-report/lib/cache/backfill.d.ts.html +0 -92
  44. package/coverage/lcov-report/lib/cache/cacheConfig.d.ts.html +0 -131
  45. package/coverage/lcov-report/lib/cache/cacheTasks.d.ts.html +0 -92
  46. package/coverage/lcov-report/lib/cache/index.html +0 -156
  47. package/coverage/lcov-report/lib/cache/salt.d.ts.html +0 -83
  48. package/coverage/lcov-report/lib/cli.d.ts.html +0 -83
  49. package/coverage/lcov-report/lib/command/cache.d.ts.html +0 -86
  50. package/coverage/lcov-report/lib/command/index.html +0 -186
  51. package/coverage/lcov-report/lib/command/info.d.ts.html +0 -194
  52. package/coverage/lcov-report/lib/command/init.d.ts.html +0 -83
  53. package/coverage/lcov-report/lib/command/run.d.ts.html +0 -107
  54. package/coverage/lcov-report/lib/command/version.d.ts.html +0 -83
  55. package/coverage/lcov-report/lib/command/worker.d.ts.html +0 -89
  56. package/coverage/lcov-report/lib/config/getConfig.d.ts.html +0 -86
  57. package/coverage/lcov-report/lib/config/index.html +0 -111
  58. package/coverage/lcov-report/lib/context.d.ts.html +0 -89
  59. package/coverage/lcov-report/lib/displayReportAndExit.d.ts.html +0 -89
  60. package/coverage/lcov-report/lib/index.d.ts.html +0 -83
  61. package/coverage/lcov-report/lib/index.html +0 -201
  62. package/coverage/lcov-report/lib/logger/LogEntry.d.ts.html +0 -185
  63. package/coverage/lcov-report/lib/logger/LogLevel.d.ts.html +0 -101
  64. package/coverage/lcov-report/lib/logger/Logger.d.ts.html +0 -119
  65. package/coverage/lcov-report/lib/logger/TaskLogWritable.d.ts.html +0 -107
  66. package/coverage/lcov-report/lib/logger/TaskLogger.d.ts.html +0 -122
  67. package/coverage/lcov-report/lib/logger/index.d.ts.html +0 -86
  68. package/coverage/lcov-report/lib/logger/index.html +0 -201
  69. package/coverage/lcov-report/lib/logger/initReporters.d.ts.html +0 -92
  70. package/coverage/lcov-report/lib/logger/reporters/JsonReporter.d.ts.html +0 -116
  71. package/coverage/lcov-report/lib/logger/reporters/NpmLogReporter.d.ts.html +0 -143
  72. package/coverage/lcov-report/lib/logger/reporters/Reporter.d.ts.html +0 -98
  73. package/coverage/lcov-report/lib/logger/reporters/formatDuration.d.ts.html +0 -86
  74. package/coverage/lcov-report/lib/logger/reporters/index.html +0 -156
  75. package/coverage/lcov-report/lib/paths.d.ts.html +0 -104
  76. package/coverage/lcov-report/lib/showHelp.d.ts.html +0 -83
  77. package/coverage/lcov-report/lib/task/DistributedTarget.d.ts.html +0 -152
  78. package/coverage/lcov-report/lib/task/NpmScriptTask.d.ts.html +0 -146
  79. package/coverage/lcov-report/lib/task/Pipeline.d.ts.html +0 -293
  80. package/coverage/lcov-report/lib/task/WrappedTarget.d.ts.html +0 -182
  81. package/coverage/lcov-report/lib/task/abortSignal.d.ts.html +0 -92
  82. package/coverage/lcov-report/lib/task/filterPackages.d.ts.html +0 -116
  83. package/coverage/lcov-report/lib/task/getNpmCommand.d.ts.html +0 -83
  84. package/coverage/lcov-report/lib/task/getPipelinePackages.d.ts.html +0 -89
  85. package/coverage/lcov-report/lib/task/index.html +0 -246
  86. package/coverage/lcov-report/lib/task/taskId.d.ts.html +0 -104
  87. package/coverage/lcov-report/lib/task/workerQueue.d.ts.html +0 -104
  88. package/coverage/lcov-report/lib/types/CacheOptions.d.ts.html +0 -95
  89. package/coverage/lcov-report/lib/types/CliOptions.d.ts.html +0 -584
  90. package/coverage/lcov-report/lib/types/Config.d.ts.html +0 -104
  91. package/coverage/lcov-report/lib/types/ConfigOptions.d.ts.html +0 -215
  92. package/coverage/lcov-report/lib/types/LoggerOptions.d.ts.html +0 -125
  93. package/coverage/lcov-report/lib/types/PipelineDefinition.d.ts.html +0 -260
  94. package/coverage/lcov-report/lib/types/Priority.d.ts.html +0 -104
  95. package/coverage/lcov-report/lib/types/RunContext.d.ts.html +0 -119
  96. package/coverage/lcov-report/lib/types/TargetStatus.d.ts.html +0 -83
  97. package/coverage/lcov-report/lib/types/TaskId.d.ts.html +0 -83
  98. package/coverage/lcov-report/lib/types/TopologicalGraph.d.ts.html +0 -98
  99. package/coverage/lcov-report/lib/types/Workspace.d.ts.html +0 -101
  100. package/coverage/lcov-report/lib/types/index.html +0 -276
  101. package/coverage/lcov-report/lib/workspace/findNpmClient.d.ts.html +0 -86
  102. package/coverage/lcov-report/lib/workspace/generateTopologicalGraph.d.ts.html +0 -89
  103. package/coverage/lcov-report/lib/workspace/getPackagePipelines.d.ts.html +0 -89
  104. package/coverage/lcov-report/lib/workspace/getWorkspace.d.ts.html +0 -89
  105. package/coverage/lcov-report/lib/workspace/index.html +0 -156
  106. package/coverage/lcov-report/mock/index.html +0 -111
  107. package/coverage/lcov-report/mock/monorepo.ts.html +0 -587
  108. package/coverage/lcov-report/prettify.css +0 -1
  109. package/coverage/lcov-report/prettify.js +0 -2
  110. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  111. package/coverage/lcov-report/sorter.js +0 -170
  112. package/coverage/lcov.info +0 -2789
  113. package/jest.config.js +0 -22
  114. package/lib/cache/RemoteFallbackCacheProvider.d.ts +0 -16
  115. package/lib/cache/RemoteFallbackCacheProvider.js +0 -57
  116. package/lib/command/worker.d.ts +0 -3
  117. package/lib/command/worker.js +0 -119
  118. package/lib/logger/reporters/AdoReporter.d.ts +0 -7
  119. package/lib/logger/reporters/AdoReporter.js +0 -37
  120. package/lib/task/DistributedTarget.d.ts +0 -24
  121. package/lib/task/DistributedTarget.js +0 -93
  122. package/lib/task/Pipeline.d.ts +0 -71
  123. package/lib/task/Pipeline.js +0 -306
  124. package/lib/task/WrappedTarget.d.ts +0 -34
  125. package/lib/task/WrappedTarget.js +0 -136
  126. package/lib/task/taskId.d.ts +0 -8
  127. package/lib/task/taskId.js +0 -16
  128. package/lib/task/workerQueue.d.ts +0 -8
  129. package/lib/task/workerQueue.js +0 -17
  130. package/lib/types/PipelineDefinition.d.ts +0 -60
  131. package/lib/types/TargetStatus.d.ts +0 -1
  132. package/lib/types/TargetStatus.js +0 -2
  133. package/lib/types/TopologicalGraph.d.ts +0 -6
  134. package/lib/types/TopologicalGraph.js +0 -2
package/CHANGELOG.json CHANGED
@@ -2,105 +2,30 @@
2
2
  "name": "lage",
3
3
  "entries": [
4
4
  {
5
- "date": "Thu, 23 Sep 2021 17:32:03 GMT",
6
- "tag": "lage_v0.33.0",
7
- "version": "0.33.0",
5
+ "date": "Wed, 20 Apr 2022 20:26:03 GMT",
6
+ "tag": "lage_v0.40.0",
7
+ "version": "0.40.0",
8
8
  "comments": {
9
9
  "minor": [
10
10
  {
11
- "comment": "add ado reporter",
12
- "author": "cheruiyotbryan@gmail.com",
13
- "commit": "cfb5e5aca31b2cb2719e8110eed434939ff156bd",
14
- "package": "lage"
15
- }
16
- ]
17
- }
18
- },
19
- {
20
- "date": "Tue, 21 Sep 2021 23:20:14 GMT",
21
- "tag": "lage_v0.32.5",
22
- "version": "0.32.5",
23
- "comments": {
24
- "patch": [
25
- {
26
- "comment": "Improve logging of cache fetch errors",
27
- "author": "elcraig@microsoft.com",
28
- "commit": "0aab60f20abc258d978e25d13d18c62ccdea4457",
29
- "package": "lage"
30
- }
31
- ]
32
- }
33
- },
34
- {
35
- "date": "Thu, 16 Sep 2021 19:43:57 GMT",
36
- "tag": "lage_v0.32.4",
37
- "version": "0.32.4",
38
- "comments": {
39
- "patch": [
40
- {
41
- "comment": "fixes the process.exitCode = 1 to happen before any other errors",
42
- "author": "kchau@microsoft.com",
43
- "commit": "ffe273c8bd00cb316724b086ca2822569958c58a",
44
- "package": "lage"
45
- }
46
- ]
47
- }
48
- },
49
- {
50
- "date": "Tue, 14 Sep 2021 20:24:31 GMT",
51
- "tag": "lage_v0.32.3",
52
- "version": "0.32.3",
53
- "comments": {
54
- "patch": [
55
- {
56
- "comment": "swap to jest to get watch mode for test, getting wrapped target to actually fail",
11
+ "comment": "0.39.0 -> 0.40.0",
57
12
  "author": "kchau@microsoft.com",
58
- "commit": "3419ad046898f4d223682246c0995a2048975114",
13
+ "commit": "c4b261f97244171b1544260c1434a75284c0e27e",
59
14
  "package": "lage"
60
15
  }
61
16
  ]
62
17
  }
63
18
  },
64
19
  {
65
- "date": "Sat, 04 Sep 2021 03:08:09 GMT",
66
- "tag": "lage_v0.32.2",
67
- "version": "0.32.2",
20
+ "date": "Thu, 03 Mar 2022 22:52:17 GMT",
21
+ "tag": "lage_v0.31.2",
22
+ "version": "0.31.2",
68
23
  "comments": {
69
24
  "patch": [
70
25
  {
71
- "comment": "make sure to allow loose mode for task deps",
72
- "author": "kchau@microsoft.com",
73
- "commit": "54edb78c695537d3d8d9fe788b741cd450ac8cdf",
74
- "package": "lage"
75
- }
76
- ]
77
- }
78
- },
79
- {
80
- "date": "Tue, 10 Aug 2021 16:48:42 GMT",
81
- "tag": "lage_v0.32.1",
82
- "version": "0.32.1",
83
- "comments": {
84
- "patch": [
85
- {
86
- "comment": "make sure to filter out targets that do not exist for packages",
87
- "author": "kchau@microsoft.com",
88
- "commit": "3056366b7acf84c26578886caa0d69c410721268",
89
- "package": "lage"
90
- }
91
- ]
92
- }
93
- },
94
- {
95
- "date": "Fri, 30 Jul 2021 00:15:54 GMT",
96
- "tag": "lage_v0.32.0",
97
- "version": "0.32.0",
98
- "comments": {
99
- "minor": [
100
- {
101
- "comment": "Internal changes to support for more config.pipeline types",
26
+ "comment": "update README.md / package.json to reference correct stable branch",
102
27
  "author": "kchau@microsoft.com",
103
- "commit": "6d6c6be3180ab10938b08a941fb4ed0e9ffa0394",
28
+ "commit": "40dc38bdb55b8a90de47b128fd75de7ec4b8be51",
104
29
  "package": "lage"
105
30
  }
106
31
  ]
package/CHANGELOG.md CHANGED
@@ -1,64 +1,24 @@
1
1
  # Change Log - lage
2
2
 
3
- This log was last generated on Thu, 23 Sep 2021 17:32:03 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 20 Apr 2022 20:26:03 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## 0.33.0
7
+ ## 0.40.0
8
8
 
9
- Thu, 23 Sep 2021 17:32:03 GMT
9
+ Wed, 20 Apr 2022 20:26:03 GMT
10
10
 
11
11
  ### Minor changes
12
12
 
13
- - add ado reporter (cheruiyotbryan@gmail.com)
13
+ - 0.39.0 -> 0.40.0 (kchau@microsoft.com)
14
14
 
15
- ## 0.32.5
15
+ ## 0.31.2
16
16
 
17
- Tue, 21 Sep 2021 23:20:14 GMT
17
+ Thu, 03 Mar 2022 22:52:17 GMT
18
18
 
19
19
  ### Patches
20
20
 
21
- - Improve logging of cache fetch errors (elcraig@microsoft.com)
22
-
23
- ## 0.32.4
24
-
25
- Thu, 16 Sep 2021 19:43:57 GMT
26
-
27
- ### Patches
28
-
29
- - fixes the process.exitCode = 1 to happen before any other errors (kchau@microsoft.com)
30
-
31
- ## 0.32.3
32
-
33
- Tue, 14 Sep 2021 20:24:31 GMT
34
-
35
- ### Patches
36
-
37
- - swap to jest to get watch mode for test, getting wrapped target to actually fail (kchau@microsoft.com)
38
-
39
- ## 0.32.2
40
-
41
- Sat, 04 Sep 2021 03:08:09 GMT
42
-
43
- ### Patches
44
-
45
- - make sure to allow loose mode for task deps (kchau@microsoft.com)
46
-
47
- ## 0.32.1
48
-
49
- Tue, 10 Aug 2021 16:48:42 GMT
50
-
51
- ### Patches
52
-
53
- - make sure to filter out targets that do not exist for packages (kchau@microsoft.com)
54
-
55
- ## 0.32.0
56
-
57
- Fri, 30 Jul 2021 00:15:54 GMT
58
-
59
- ### Minor changes
60
-
61
- - Internal changes to support for more config.pipeline types (kchau@microsoft.com)
21
+ - update README.md / package.json to reference correct stable branch (kchau@microsoft.com)
62
22
 
63
23
  ## 0.31.1
64
24
 
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # lage
2
2
 
3
+ This is the *stable* release branch. It is what will appear in the "latest" tag for npm registry.
4
+
3
5
  Documentation is here: https://microsoft.github.io/lage/
4
6
 
5
7
  ## Overview
@@ -1,4 +1,5 @@
1
+ import { PackageInfo } from "workspace-tools";
1
2
  import { CacheOptions } from "../types/CacheOptions";
2
- export declare function cacheHash(id: string, cwd: string, root: string, cacheOptions: CacheOptions, args: any): Promise<string | null>;
3
- export declare function cacheFetch(hash: string | null, id: string, cwd: string, cacheOptions: CacheOptions): Promise<boolean>;
4
- export declare function cachePut(hash: string | null, cwd: string, cacheOptions: CacheOptions): Promise<void>;
3
+ export declare function cacheHash(task: string, info: PackageInfo, root: string, cacheOptions: CacheOptions, args: any): Promise<string | null>;
4
+ export declare function cacheFetch(hash: string | null, info: PackageInfo, cacheOptions: CacheOptions): Promise<boolean>;
5
+ export declare function cachePut(hash: string | null, info: PackageInfo, cacheOptions: CacheOptions): Promise<void>;
@@ -15,13 +15,15 @@ const logger_1 = require("../logger");
15
15
  const salt_1 = require("./salt");
16
16
  const backfill = __importStar(require("backfill/lib/api"));
17
17
  const path_1 = __importDefault(require("path"));
18
- async function cacheHash(id, cwd, root, cacheOptions, args) {
19
- const cacheConfig = cacheConfig_1.getCacheConfig(cwd, cacheOptions);
18
+ async function cacheHash(task, info, root, cacheOptions, args) {
19
+ const packagePath = path_1.default.dirname(info.packageJsonPath);
20
+ const cacheConfig = cacheConfig_1.getCacheConfig(packagePath, cacheOptions);
20
21
  const backfillLogger = backfill.makeLogger("error", process.stdout, process.stderr);
21
- const hashKey = salt_1.salt(cacheOptions.environmentGlob || ["lage.config.js"], `${id}|${JSON.stringify(args)}`, path_1.default.relative(root, cwd), cacheOptions.cacheKey);
22
- backfillLogger.setName(id);
22
+ const name = info.name;
23
+ const hashKey = salt_1.salt(cacheOptions.environmentGlob || ["lage.config.js"], `${info.name}|${task}|${JSON.stringify(args)}`, root, cacheOptions.cacheKey);
24
+ backfillLogger.setName(name);
23
25
  try {
24
- return await backfill.computeHash(cwd, backfillLogger, hashKey, cacheConfig);
26
+ return await backfill.computeHash(packagePath, backfillLogger, hashKey, cacheConfig);
25
27
  }
26
28
  catch (_a) {
27
29
  // computeHash can throw exception when git is not installed or the repo hashes cannot be calculated with a staged file that is deleted
@@ -30,29 +32,31 @@ async function cacheHash(id, cwd, root, cacheOptions, args) {
30
32
  return null;
31
33
  }
32
34
  exports.cacheHash = cacheHash;
33
- async function cacheFetch(hash, id, cwd, cacheOptions) {
35
+ async function cacheFetch(hash, info, cacheOptions) {
34
36
  if (!hash) {
35
37
  return false;
36
38
  }
37
- const cacheConfig = cacheConfig_1.getCacheConfig(cwd, cacheOptions);
39
+ const packagePath = path_1.default.dirname(info.packageJsonPath);
40
+ const cacheConfig = cacheConfig_1.getCacheConfig(packagePath, cacheOptions);
38
41
  const backfillLogger = backfill.makeLogger("error", process.stdout, process.stderr);
39
42
  try {
40
- return await backfill.fetch(cwd, hash, backfillLogger, cacheConfig);
43
+ return await backfill.fetch(packagePath, hash, backfillLogger, cacheConfig);
41
44
  }
42
45
  catch (e) {
43
- logger_1.logger.error(`${id} fetchBackfill ${e && e.stack || e && e.message || e}`);
46
+ logger_1.logger.error(`${info.name} fetchBackfill`, e);
44
47
  }
45
48
  return false;
46
49
  }
47
50
  exports.cacheFetch = cacheFetch;
48
- async function cachePut(hash, cwd, cacheOptions) {
51
+ async function cachePut(hash, info, cacheOptions) {
49
52
  if (!hash) {
50
53
  return;
51
54
  }
52
- const cacheConfig = cacheConfig_1.getCacheConfig(cwd, cacheOptions);
55
+ const packagePath = path_1.default.dirname(info.packageJsonPath);
56
+ const cacheConfig = cacheConfig_1.getCacheConfig(packagePath, cacheOptions);
53
57
  const backfillLogger = backfill.makeLogger("warn", process.stdout, process.stderr);
54
58
  try {
55
- await backfill.put(cwd, hash, backfillLogger, cacheConfig);
59
+ await backfill.put(packagePath, hash, backfillLogger, cacheConfig);
56
60
  }
57
61
  catch (e) {
58
62
  // sometimes outputGlob don't match any files, so skipping this
@@ -1,2 +1,17 @@
1
1
  import { CacheOptions } from "../types/CacheOptions";
2
- export declare function getCacheConfig(cwd: string, cacheOptions: CacheOptions): CacheOptions;
2
+ export declare function getCacheConfig(cwd: string, cacheOptions: CacheOptions): {
3
+ cacheStorageConfig: import("backfill-config").CacheStorageConfig;
4
+ clearOutput: boolean;
5
+ internalCacheFolder: string;
6
+ logFolder: string;
7
+ logLevel: "verbose" | "silly" | "info" | "warn" | "error" | "mute";
8
+ name: string;
9
+ mode: "READ_ONLY" | "WRITE_ONLY" | "READ_WRITE" | "PASS";
10
+ outputGlob: string[];
11
+ packageRoot: string;
12
+ performanceReportName?: string | undefined;
13
+ producePerformanceLogs: boolean;
14
+ validateOutput: boolean;
15
+ environmentGlob: string[];
16
+ cacheKey: string;
17
+ };
@@ -2,15 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const backfill_config_1 = require("backfill-config");
4
4
  const backfill_logger_1 = require("backfill-logger");
5
- const RemoteFallbackCacheProvider_1 = require("./RemoteFallbackCacheProvider");
6
5
  function getCacheConfig(cwd, cacheOptions) {
7
6
  const defaultCacheConfig = backfill_config_1.createDefaultConfig(cwd);
8
7
  // in lage, default mode is to CACHE locally
9
8
  defaultCacheConfig.cacheStorageConfig.provider = "local";
10
9
  const logger = backfill_logger_1.makeLogger("warn");
11
10
  const envConfig = backfill_config_1.getEnvConfig(logger);
12
- const configWithEnvOverrides = Object.assign(Object.assign(Object.assign(Object.assign({}, defaultCacheConfig), cacheOptions), envConfig), { writeRemoteCache: cacheOptions.writeRemoteCache || !!process.env.LAGE_WRITE_REMOTE_CACHE });
13
- const configWithFallback = Object.assign(Object.assign({}, configWithEnvOverrides), { cacheStorageConfig: Object.assign(Object.assign({}, configWithEnvOverrides.cacheStorageConfig), { provider: (logger, cwd) => new RemoteFallbackCacheProvider_1.RemoteFallbackCacheProvider(configWithEnvOverrides, logger, cwd), name: "remote-fallback-provider" }) });
14
- return configWithFallback;
11
+ return Object.assign(Object.assign(Object.assign({}, defaultCacheConfig), cacheOptions), envConfig);
15
12
  }
16
13
  exports.getCacheConfig = getCacheConfig;
package/lib/cache/salt.js CHANGED
@@ -6,17 +6,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
6
6
  result["default"] = mod;
7
7
  return result;
8
8
  };
9
+ var __importDefault = (this && this.__importDefault) || function (mod) {
10
+ return (mod && mod.__esModule) ? mod : { "default": mod };
11
+ };
9
12
  Object.defineProperty(exports, "__esModule", { value: true });
10
13
  const path = __importStar(require("path"));
11
14
  const crypto = __importStar(require("crypto"));
12
15
  const fg = __importStar(require("fast-glob"));
13
16
  const fs = __importStar(require("fs"));
14
- // import os from "os";
15
- // import process from "process";
17
+ const os_1 = __importDefault(require("os"));
18
+ const process_1 = __importDefault(require("process"));
16
19
  let envHash;
17
20
  function salt(environmentGlobFiles, command, repoRoot, customKey = "") {
18
21
  return hashStrings([
19
22
  ...getEnvHash(environmentGlobFiles, repoRoot),
23
+ os_1.default.platform(),
24
+ process_1.default.version,
20
25
  command,
21
26
  customKey,
22
27
  ]);
@@ -5,11 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const logger_1 = require("../logger");
7
7
  const getWorkspace_1 = require("../workspace/getWorkspace");
8
+ const generateTopologicalGraph_1 = require("../workspace/generateTopologicalGraph");
9
+ const task_scheduler_1 = require("@microsoft/task-scheduler");
8
10
  const getPipelinePackages_1 = require("../task/getPipelinePackages");
11
+ const parsePipelineConfig_1 = require("../task/parsePipelineConfig");
9
12
  const path_1 = __importDefault(require("path"));
10
13
  const getNpmCommand_1 = require("../task/getNpmCommand");
11
- const Pipeline_1 = require("../task/Pipeline");
12
- const taskId_1 = require("../task/taskId");
13
14
  /**
14
15
  * Generates a graph and spit it out in stdout
15
16
  *
@@ -48,21 +49,40 @@ const taskId_1 = require("../task/taskId");
48
49
  */
49
50
  async function info(cwd, config) {
50
51
  const workspace = getWorkspace_1.getWorkspace(cwd, config);
52
+ const tasks = new Map();
53
+ const pipelineConfig = parsePipelineConfig_1.parsePipelineConfig(config.pipeline);
54
+ for (const [taskName, taskDeps] of Object.entries(pipelineConfig.taskDeps)) {
55
+ const { deps, topoDeps } = taskDeps;
56
+ tasks.set(taskName, {
57
+ name: taskName,
58
+ run: () => Promise.resolve(true),
59
+ deps,
60
+ topoDeps,
61
+ });
62
+ }
63
+ const graph = generateTopologicalGraph_1.generateTopologicGraph(workspace);
51
64
  const packages = getPipelinePackages_1.getPipelinePackages(workspace, config);
52
- const pipeline = new Pipeline_1.Pipeline(workspace, config);
53
- const targetGraph = pipeline.generateTargetGraph();
65
+ const taskDeps = task_scheduler_1.generateTaskGraph(packages, config.command.slice(1), tasks, graph, pipelineConfig.packageTaskDeps, false);
54
66
  const packageTasks = new Map();
55
- for (const [from, to] of targetGraph) {
56
- for (const id of [from, to]) {
57
- if (!packageTasks.has(id)) {
58
- const packageTaskInfo = createPackageTaskInfo(id, config, workspace);
59
- if (packageTaskInfo && id !== Pipeline_1.START_TARGET_ID) {
60
- packageTasks.set(id, packageTaskInfo);
61
- }
67
+ for (const [fromId, toId] of taskDeps) {
68
+ let fromPackageTask = packageTasks.get(fromId);
69
+ let toPackageTask = packageTasks.get(toId);
70
+ // Try creating missing package task info
71
+ if (!fromPackageTask) {
72
+ fromPackageTask = createPackageTaskInfo(fromId, config, workspace);
73
+ if (fromPackageTask) {
74
+ packageTasks.set(fromId, fromPackageTask);
75
+ }
76
+ }
77
+ if (!toPackageTask) {
78
+ toPackageTask = createPackageTaskInfo(toId, config, workspace);
79
+ if (toPackageTask) {
80
+ packageTasks.set(toId, toPackageTask);
62
81
  }
63
82
  }
64
- if (packageTasks.has(to) && from !== Pipeline_1.START_TARGET_ID) {
65
- packageTasks.get(to).dependencies.push(from);
83
+ // If "from" AND "to" package tasks are valid, then connect them
84
+ if (fromPackageTask && toPackageTask) {
85
+ toPackageTask.dependencies.push(fromId);
66
86
  }
67
87
  }
68
88
  logger_1.logger.info(`info`, {
@@ -72,32 +92,22 @@ async function info(cwd, config) {
72
92
  });
73
93
  }
74
94
  exports.info = info;
75
- function createPackageTaskInfo(id, config, workspace) {
76
- var _a;
77
- const { packageName, task } = taskId_1.getPackageAndTask(id);
78
- if (packageName) {
79
- const info = workspace.allPackages[packageName];
80
- if (!!((_a = info.scripts) === null || _a === void 0 ? void 0 : _a[task])) {
81
- return {
82
- id,
83
- command: [config.npmClient, ...getNpmCommand_1.getNpmCommand(config.node, config.args, task)],
84
- dependencies: [],
85
- workingDirectory: path_1.default
86
- .relative(workspace.root, path_1.default.dirname(workspace.allPackages[packageName].packageJsonPath))
87
- .replace(/\\/g, "/"),
88
- package: packageName,
89
- task,
90
- };
91
- }
92
- }
93
- else {
95
+ function createPackageTaskInfo(taskId, config, workspace) {
96
+ const [pkg, taskName] = task_scheduler_1.getPackageTaskFromId(taskId);
97
+ const scripts = workspace.allPackages[pkg].scripts;
98
+ if (scripts && scripts[taskName]) {
94
99
  return {
95
- id,
96
- command: ["echo", `"global script ${id}"`],
100
+ id: taskId,
101
+ command: [
102
+ config.npmClient,
103
+ ...getNpmCommand_1.getNpmCommand(config.node, config.args, taskName),
104
+ ],
97
105
  dependencies: [],
98
- workingDirectory: ".",
99
- package: undefined,
100
- task,
106
+ workingDirectory: path_1.default
107
+ .relative(workspace.root, path_1.default.dirname(workspace.allPackages[pkg].packageJsonPath))
108
+ .replace(/\\/g, "/"),
109
+ package: pkg,
110
+ task: taskName,
101
111
  };
102
112
  }
103
113
  }
@@ -1,9 +1,3 @@
1
1
  import { Config } from "../types/Config";
2
2
  import { Reporter } from "../logger/reporters/Reporter";
3
- /**
4
- * Prepares and runs a pipeline
5
- * @param cwd
6
- * @param config
7
- * @param reporters
8
- */
9
3
  export declare function run(cwd: string, config: Config, reporters: Reporter[]): Promise<void>;
@@ -2,20 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const getWorkspace_1 = require("../workspace/getWorkspace");
4
4
  const logger_1 = require("../logger");
5
+ const generateTopologicalGraph_1 = require("../workspace/generateTopologicalGraph");
5
6
  const abortSignal_1 = require("../task/abortSignal");
6
7
  const displayReportAndExit_1 = require("../displayReportAndExit");
7
8
  const context_1 = require("../context");
9
+ const taskRunner_1 = require("../task/taskRunner");
8
10
  const NpmScriptTask_1 = require("../task/NpmScriptTask");
9
- const Pipeline_1 = require("../task/Pipeline");
10
- /**
11
- * Prepares and runs a pipeline
12
- * @param cwd
13
- * @param config
14
- * @param reporters
15
- */
11
+ // Run multiple
16
12
  async function run(cwd, config, reporters) {
17
13
  const context = context_1.createContext(config);
18
14
  const workspace = getWorkspace_1.getWorkspace(cwd, config);
15
+ // generate topological graph
16
+ const graph = generateTopologicalGraph_1.generateTopologicGraph(workspace);
19
17
  const { profiler } = context;
20
18
  let aborted = false;
21
19
  context.measures.start = process.hrtime();
@@ -26,20 +24,11 @@ async function run(cwd, config, reporters) {
26
24
  displayReportAndExit_1.displayReportAndExit(reporters, context);
27
25
  });
28
26
  try {
29
- const pipeline = new Pipeline_1.Pipeline(workspace, config);
30
- await pipeline.run(context);
27
+ await taskRunner_1.runTasks({ graph, workspace, context, config });
31
28
  }
32
29
  catch (e) {
30
+ logger_1.logger.error("runTasks: " + (e.stack || e.message || e));
33
31
  process.exitCode = 1;
34
- if (e && e.stack) {
35
- logger_1.logger.error("runTasks: " + e.stack);
36
- }
37
- else if (e && e.message) {
38
- logger_1.logger.error("runTasks: " + e.message);
39
- }
40
- else {
41
- logger_1.logger.error("runTasks: " + e);
42
- }
43
32
  }
44
33
  if (config.profile) {
45
34
  try {
@@ -47,10 +36,8 @@ async function run(cwd, config, reporters) {
47
36
  logger_1.logger.info(`runTasks: Profile saved to ${profileFile}`);
48
37
  }
49
38
  catch (e) {
39
+ logger_1.logger.error(`An error occured while trying to write profile: ${e.message}`);
50
40
  process.exitCode = 1;
51
- if (e && e.message) {
52
- logger_1.logger.error(`An error occured while trying to write profile: ${e.message}`);
53
- }
54
41
  }
55
42
  }
56
43
  if (!aborted) {
package/lib/context.js CHANGED
@@ -28,9 +28,9 @@ function createContext(config) {
28
28
  measures: {
29
29
  start: [0, 0],
30
30
  duration: [0, 0],
31
- failedTargets: [],
31
+ failedTasks: [],
32
32
  },
33
- targets: new Map(),
33
+ tasks: new Map(),
34
34
  profiler,
35
35
  };
36
36
  }
@@ -5,7 +5,7 @@ function displayReportAndExit(reporters, context) {
5
5
  for (const reporter of reporters) {
6
6
  reporter.summarize(context);
7
7
  }
8
- if (context.measures.failedTargets && context.measures.failedTargets.length > 0) {
8
+ if (context.measures.failedTasks && context.measures.failedTasks.length > 0) {
9
9
  process.exit(1);
10
10
  }
11
11
  }
@@ -27,7 +27,7 @@ export interface InfoData {
27
27
  */
28
28
  export interface PackageTaskInfo {
29
29
  id: string;
30
- package?: string;
30
+ package: string;
31
31
  task: string;
32
32
  command: string[];
33
33
  workingDirectory: string;
@@ -1,5 +1,4 @@
1
1
  import { Config } from "../types/Config";
2
2
  import { NpmLogReporter } from "./reporters/NpmLogReporter";
3
3
  import { JsonReporter } from "./reporters/JsonReporter";
4
- import { AdoReporter } from "./reporters/AdoReporter";
5
- export declare function initReporters(config: Config): (NpmLogReporter | JsonReporter | AdoReporter)[];
4
+ export declare function initReporters(config: Config): (NpmLogReporter | JsonReporter)[];
@@ -4,7 +4,6 @@ const Logger_1 = require("./Logger");
4
4
  const NpmLogReporter_1 = require("./reporters/NpmLogReporter");
5
5
  const LogLevel_1 = require("./LogLevel");
6
6
  const JsonReporter_1 = require("./reporters/JsonReporter");
7
- const AdoReporter_1 = require("./reporters/AdoReporter");
8
7
  function initReporters(config) {
9
8
  // Initialize logger
10
9
  let logLevel = config.verbose ? LogLevel_1.LogLevel.verbose : LogLevel_1.LogLevel.info;
@@ -20,9 +19,6 @@ function initReporters(config) {
20
19
  npmLoggerOptions: config.loggerOptions
21
20
  }),
22
21
  ];
23
- if (config.reporter === "adoLog") { // Will always include NpmLogReporter and add AdoReporter
24
- reporters.push(new AdoReporter_1.AdoReporter());
25
- }
26
22
  Logger_1.Logger.reporters = reporters;
27
23
  return reporters;
28
24
  }
@@ -11,20 +11,20 @@ class JsonReporter {
11
11
  }
12
12
  }
13
13
  summarize(context) {
14
- const { measures, targets } = context;
14
+ const { measures, tasks } = context;
15
15
  const summary = {};
16
16
  const taskStats = [];
17
- for (const wrappedTarget of targets.values()) {
17
+ for (const task of tasks.values()) {
18
18
  taskStats.push({
19
- package: wrappedTarget.target.packageName,
20
- task: wrappedTarget.target.task,
21
- duration: formatDuration_1.hrToSeconds(wrappedTarget.duration),
22
- status: wrappedTarget.status,
23
- npmArgs: wrappedTarget.npmArgs,
19
+ package: task.info.name,
20
+ task: task.task,
21
+ duration: formatDuration_1.hrToSeconds(task.duration),
22
+ status: task.status,
23
+ npmArgs: task.npmArgs,
24
24
  });
25
25
  }
26
- if (measures.failedTargets && measures.failedTargets.length > 0) {
27
- summary.failedTargets = measures.failedTargets;
26
+ if (measures.failedTasks && measures.failedTasks.length > 0) {
27
+ summary.failedTasks = measures.failedTasks;
28
28
  }
29
29
  summary.duration = formatDuration_1.hrToSeconds(measures.duration);
30
30
  summary.taskStats = taskStats;