@lage-run/cli 0.8.1 → 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.
Files changed (44) hide show
  1. package/CHANGELOG.json +22 -1
  2. package/CHANGELOG.md +11 -2
  3. package/lib/cli.d.ts +1 -0
  4. package/lib/commands/addFilterOptions.d.ts +2 -0
  5. package/lib/commands/addLoggerOptions.d.ts +2 -0
  6. package/lib/commands/affected/action.d.ts +6 -0
  7. package/lib/commands/affected/index.d.ts +3 -0
  8. package/lib/commands/cache/action.d.ts +8 -0
  9. package/lib/commands/cache/cacheDir.d.ts +1 -0
  10. package/lib/commands/cache/clearCache.d.ts +8 -0
  11. package/lib/commands/cache/index.d.ts +3 -0
  12. package/lib/commands/cache/pruneCache.d.ts +9 -0
  13. package/lib/commands/cache/runners/ClearCacheRunner.d.ts +5 -0
  14. package/lib/commands/cache/runners/PruneCacheRunner.d.ts +5 -0
  15. package/lib/commands/createReporter.d.ts +3 -0
  16. package/lib/commands/initializeReporters.d.ts +3 -0
  17. package/lib/commands/isRunningFromCI.d.ts +1 -0
  18. package/lib/commands/run/action.d.ts +23 -0
  19. package/lib/commands/run/createCacheProvider.d.ts +15 -0
  20. package/lib/commands/run/createTargetGraph.d.ts +21 -0
  21. package/lib/commands/run/filterArgsForTasks.d.ts +4 -0
  22. package/lib/commands/run/filterPipelineDefinitions.d.ts +3 -0
  23. package/lib/commands/run/index.d.ts +3 -0
  24. package/lib/commands/run/infoAction.d.ts +14 -0
  25. package/lib/commands/run/runAction.d.ts +16 -0
  26. package/lib/commands/run/runners/NpmScriptRunner.d.ts +1 -0
  27. package/lib/commands/run/runners/WorkerRunner.d.ts +1 -0
  28. package/lib/commands/run/watchAction.d.ts +16 -0
  29. package/lib/commands/run/watcher.d.ts +3 -0
  30. package/lib/config/getConcurrency.d.ts +1 -0
  31. package/lib/config/getConfig.d.ts +2 -0
  32. package/lib/config/getMaxWorkersPerTask.d.ts +3 -0
  33. package/lib/filter/getFilteredPackages.d.ts +21 -0
  34. package/lib/index.d.ts +1 -0
  35. package/lib/showHelp.d.ts +1 -0
  36. package/lib/types/CacheOptions.d.ts +7 -0
  37. package/lib/types/ConfigOptions.d.ts +56 -0
  38. package/lib/types/FilterOptions.d.ts +9 -0
  39. package/lib/types/LoggerOptions.d.ts +15 -0
  40. package/lib/types/PipelineDefinition.d.ts +12 -0
  41. package/lib/types/Priority.d.ts +8 -0
  42. package/lib/types/ReporterInitOptions.d.ts +10 -0
  43. package/lib/types/errors.d.ts +1 -0
  44. package/package.json +2 -2
package/CHANGELOG.json CHANGED
@@ -2,7 +2,28 @@
2
2
  "name": "@lage-run/cli",
3
3
  "entries": [
4
4
  {
5
- "date": "Mon, 06 Feb 2023 23:42:47 GMT",
5
+ "date": "Tue, 07 Feb 2023 23:52:38 GMT",
6
+ "tag": "@lage-run/cli_v0.8.2",
7
+ "version": "0.8.2",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "kchau@microsoft.com",
12
+ "package": "@lage-run/cli",
13
+ "commit": "d7bf00acf2e7bda7d3e3478b6ef60db0d32ba243",
14
+ "comment": "migrating to V2"
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "@lage-run/cli",
19
+ "comment": "Bump @lage-run/scheduler to v0.8.3",
20
+ "commit": "d7bf00acf2e7bda7d3e3478b6ef60db0d32ba243"
21
+ }
22
+ ]
23
+ }
24
+ },
25
+ {
26
+ "date": "Mon, 06 Feb 2023 23:42:51 GMT",
6
27
  "tag": "@lage-run/cli_v0.8.1",
7
28
  "version": "0.8.1",
8
29
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,21 @@
1
1
  # Change Log - @lage-run/cli
2
2
 
3
- This log was last generated on Mon, 06 Feb 2023 23:42:47 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 07 Feb 2023 23:52:38 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.8.2
8
+
9
+ Tue, 07 Feb 2023 23:52:38 GMT
10
+
11
+ ### Patches
12
+
13
+ - migrating to V2 (kchau@microsoft.com)
14
+ - Bump @lage-run/scheduler to v0.8.3
15
+
7
16
  ## 0.8.1
8
17
 
9
- Mon, 06 Feb 2023 23:42:47 GMT
18
+ Mon, 06 Feb 2023 23:42:51 GMT
10
19
 
11
20
  ### Patches
12
21
 
package/lib/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { Command } from "commander";
2
+ export declare function addFilterOptions(program: Command): Command;
@@ -0,0 +1,2 @@
1
+ import type { Command } from "commander";
2
+ export declare function addLoggerOptions(program: Command): Command;
@@ -0,0 +1,6 @@
1
+ import type { FilterOptions } from "../../types/FilterOptions.js";
2
+ interface AffectedOptions extends FilterOptions {
3
+ outputFormat?: "json" | "graph" | "default";
4
+ }
5
+ export declare function affectedAction(options: AffectedOptions): Promise<void>;
6
+ export {};
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ declare const affectedCommand: Command;
3
+ export { affectedCommand };
@@ -0,0 +1,8 @@
1
+ import type { Command } from "commander";
2
+ import type { ReporterInitOptions } from "../../types/ReporterInitOptions.js";
3
+ interface CacheOptions extends ReporterInitOptions {
4
+ prune?: number;
5
+ clear?: boolean;
6
+ }
7
+ export declare function cacheAction(options: CacheOptions, command: Command): Promise<void>;
8
+ export {};
@@ -0,0 +1 @@
1
+ export declare function getCacheDir(workspace: string, internalCacheFolder: string): string;
@@ -0,0 +1,8 @@
1
+ import type { Logger } from "@lage-run/logger";
2
+ export interface ClearCacheOptions {
3
+ cwd: string;
4
+ internalCacheFolder: string;
5
+ logger: Logger;
6
+ concurrency: number;
7
+ }
8
+ export declare function clearCache(options: ClearCacheOptions): Promise<void>;
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ declare const cacheCommand: Command;
3
+ export { cacheCommand };
@@ -0,0 +1,9 @@
1
+ import type { Logger } from "@lage-run/logger";
2
+ export interface PruneCacheOptions {
3
+ cwd: string;
4
+ internalCacheFolder: string;
5
+ logger: Logger;
6
+ concurrency: number;
7
+ pruneDays: number;
8
+ }
9
+ export declare function pruneCache(options: PruneCacheOptions): Promise<void>;
@@ -0,0 +1,5 @@
1
+ import type { TargetRunner, TargetRunnerOptions } from "@lage-run/scheduler-types";
2
+ export declare class ClearCacheRunner implements TargetRunner {
3
+ shouldRun(): Promise<boolean>;
4
+ run(runOptions: TargetRunnerOptions): Promise<void>;
5
+ }
@@ -0,0 +1,5 @@
1
+ import type { TargetRunner, TargetRunnerOptions } from "@lage-run/scheduler-types";
2
+ export declare class PruneCacheRunner implements TargetRunner {
3
+ shouldRun(): Promise<boolean>;
4
+ run(runOptions: TargetRunnerOptions): Promise<void>;
5
+ }
@@ -0,0 +1,3 @@
1
+ import { JsonReporter, AdoReporter, LogReporter, ProgressReporter, ChromeTraceEventsReporter } from "@lage-run/reporters";
2
+ import type { ReporterInitOptions } from "../types/ReporterInitOptions.js";
3
+ export declare function createReporter(reporter: string, options: ReporterInitOptions): ChromeTraceEventsReporter | JsonReporter | AdoReporter | ProgressReporter | LogReporter;
@@ -0,0 +1,3 @@
1
+ import type { Logger } from "@lage-run/logger";
2
+ import type { ReporterInitOptions } from "../types/ReporterInitOptions.js";
3
+ export declare function initializeReporters(logger: Logger, options: ReporterInitOptions): import("@lage-run/logger").Reporter<import("@lage-run/logger").LogStructuredData>[];
@@ -0,0 +1 @@
1
+ export declare const isRunningFromCI: boolean;
@@ -0,0 +1,23 @@
1
+ import type { Command } from "commander";
2
+ import type { ReporterInitOptions } from "../../types/ReporterInitOptions.js";
3
+ interface RunOptions extends ReporterInitOptions {
4
+ concurrency: number;
5
+ profile: string | boolean | undefined;
6
+ dependencies: boolean;
7
+ dependents: boolean;
8
+ since: string;
9
+ to: string[];
10
+ scope: string[];
11
+ skipLocalCache: boolean;
12
+ continue: boolean;
13
+ cache: boolean;
14
+ resetCache: boolean;
15
+ nodeArg: string;
16
+ ignore: string[];
17
+ unstableWatch: boolean;
18
+ info: boolean;
19
+ maxWorkersPerTask: string[];
20
+ allowNoTargetRuns: boolean;
21
+ }
22
+ export declare function action(options: RunOptions, command: Command): Promise<void>;
23
+ export {};
@@ -0,0 +1,15 @@
1
+ import type { CacheOptions } from "@lage-run/cache";
2
+ import { RemoteFallbackCacheProvider, TargetHasher } from "@lage-run/cache";
3
+ import type { Logger } from "@lage-run/logger";
4
+ interface CreateCacheOptions {
5
+ cacheOptions?: CacheOptions;
6
+ logger: Logger;
7
+ root: string;
8
+ skipLocalCache: boolean;
9
+ cliArgs: string[];
10
+ }
11
+ export declare function createCache(options: CreateCacheOptions): {
12
+ cacheProvider: RemoteFallbackCacheProvider;
13
+ hasher: TargetHasher;
14
+ };
15
+ export {};
@@ -0,0 +1,21 @@
1
+ import type { Logger } from "@lage-run/logger";
2
+ import type { PackageInfos } from "workspace-tools";
3
+ import type { PipelineDefinition } from "../../types/PipelineDefinition.js";
4
+ interface CreateTargetGraphOptions {
5
+ logger: Logger;
6
+ root: string;
7
+ dependencies: boolean;
8
+ dependents: boolean;
9
+ since: string;
10
+ scope: string[];
11
+ ignore: string[];
12
+ repoWideChanges: string[];
13
+ pipeline: PipelineDefinition;
14
+ outputs: string[];
15
+ tasks: string[];
16
+ packageInfos: PackageInfos;
17
+ }
18
+ export declare function createTargetGraph(options: CreateTargetGraphOptions): {
19
+ targets: Map<string, import("@lage-run/target-graph").Target>;
20
+ };
21
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare function filterArgsForTasks(args: string[]): {
2
+ tasks: string[];
3
+ taskArgs: string[];
4
+ };
@@ -0,0 +1,3 @@
1
+ import type { Target } from "@lage-run/target-graph";
2
+ import type { PipelineDefinition } from "../../types/PipelineDefinition.js";
3
+ export declare function filterPipelineDefinitions(targets: IterableIterator<Target>, pipeline: PipelineDefinition): PipelineDefinition;
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ declare const runCommand: Command;
3
+ export { runCommand };
@@ -0,0 +1,14 @@
1
+ import type { Command } from "commander";
2
+ import type { ReporterInitOptions } from "../../types/ReporterInitOptions.js";
3
+ interface RunOptions extends ReporterInitOptions {
4
+ dependencies: boolean;
5
+ dependents: boolean;
6
+ since: string;
7
+ scope: string[];
8
+ to: string[];
9
+ cache: boolean;
10
+ nodeArg: string;
11
+ ignore: string[];
12
+ }
13
+ export declare function infoAction(options: RunOptions, command: Command): Promise<void>;
14
+ export {};
@@ -0,0 +1,16 @@
1
+ import type { Command } from "commander";
2
+ import type { ReporterInitOptions } from "../../types/ReporterInitOptions.js";
3
+ import type { FilterOptions } from "../../types/FilterOptions.js";
4
+ interface RunOptions extends ReporterInitOptions, FilterOptions {
5
+ concurrency: number;
6
+ maxWorkersPerTask: string[];
7
+ profile: string | boolean | undefined;
8
+ skipLocalCache: boolean;
9
+ continue: boolean;
10
+ cache: boolean;
11
+ resetCache: boolean;
12
+ nodeArg: string;
13
+ allowNoTargetRuns: boolean;
14
+ }
15
+ export declare function runAction(options: RunOptions, command: Command): Promise<void>;
16
+ export {};
@@ -0,0 +1 @@
1
+ export { NpmScriptRunner } from "@lage-run/scheduler";
@@ -0,0 +1 @@
1
+ export { WorkerRunner } from "@lage-run/scheduler";
@@ -0,0 +1,16 @@
1
+ import type { Command } from "commander";
2
+ import type { ReporterInitOptions } from "../../types/ReporterInitOptions.js";
3
+ import type { FilterOptions } from "../../types/FilterOptions.js";
4
+ interface RunOptions extends ReporterInitOptions, FilterOptions {
5
+ concurrency: number;
6
+ maxWorkersPerTask: string[];
7
+ profile: string | boolean | undefined;
8
+ skipLocalCache: boolean;
9
+ continue: boolean;
10
+ cache: boolean;
11
+ resetCache: boolean;
12
+ nodeArg: string;
13
+ allowNoTargetRuns: boolean;
14
+ }
15
+ export declare function watchAction(options: RunOptions, command: Command): Promise<void>;
16
+ export {};
@@ -0,0 +1,3 @@
1
+ /// <reference types="node" />
2
+ import EventEmitter from "events";
3
+ export declare function watch(cwd: string): EventEmitter;
@@ -0,0 +1 @@
1
+ export declare function getConcurrency(optionsConcurrency: number | undefined, configConcurrency: number | undefined): number;
@@ -0,0 +1,2 @@
1
+ import type { ConfigOptions } from "../types/ConfigOptions.js";
2
+ export declare function getConfig(cwd: string): Promise<ConfigOptions>;
@@ -0,0 +1,3 @@
1
+ import type { ConfigOptions } from "../types/ConfigOptions.js";
2
+ export declare function getMaxWorkersPerTask(pipelineConfig: ConfigOptions["pipeline"], concurrency: number): Map<string, number>;
3
+ export declare function getMaxWorkersPerTaskFromOptions(maxWorkersPerTask: string[]): Map<string, number>;
@@ -0,0 +1,21 @@
1
+ import type { PackageInfos } from "workspace-tools";
2
+ import type { Logger } from "@lage-run/logger";
3
+ export declare function getFilteredPackages(options: {
4
+ root: string;
5
+ packageInfos: PackageInfos;
6
+ logger: Logger;
7
+ scope: string[] | undefined;
8
+ since: string | undefined;
9
+ sinceIgnoreGlobs: string[] | undefined;
10
+ repoWideChanges: string[];
11
+ includeDependents: boolean;
12
+ includeDependencies: boolean;
13
+ }): string[];
14
+ export declare function filterPackages(options: {
15
+ logger: Logger;
16
+ packageInfos: PackageInfos;
17
+ includeDependents: boolean;
18
+ includeDependencies: boolean;
19
+ scopedPackages: string[] | undefined;
20
+ changedPackages: string[] | undefined;
21
+ }): string[];
package/lib/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export type { ConfigOptions } from "./types/ConfigOptions.js";
@@ -0,0 +1 @@
1
+ export declare function showHelp(msg: string): void;
@@ -0,0 +1,7 @@
1
+ import type { Config as BackfillCacheOptions } from "backfill-config";
2
+ export type CacheOptions = BackfillCacheOptions & {
3
+ environmentGlob: string[];
4
+ cacheKey: string;
5
+ writeRemoteCache: boolean;
6
+ skipLocalCache: boolean;
7
+ };
@@ -0,0 +1,56 @@
1
+ import type { CacheOptions } from "./CacheOptions.js";
2
+ import type { Priority } from "./Priority.js";
3
+ import type { PipelineDefinition } from "./PipelineDefinition.js";
4
+ import type { LoggerOptions } from "./LoggerOptions.js";
5
+ import type { TargetRunnerPickerOptions } from "@lage-run/scheduler";
6
+ export type NpmClient = "npm" | "yarn" | "pnpm";
7
+ export interface ConfigOptions {
8
+ /**
9
+ * Defines the task pipeline, prefix with "^" character to denote a direct topological dependency,
10
+ * prefix with ^^ to denote a transitive topological dependency.
11
+ *
12
+ * Example:
13
+ *
14
+ * ```
15
+ * {
16
+ * build: ["^build"],
17
+ * test: ["build"],
18
+ * lint: []
19
+ * bundle: ["^^transpile"],
20
+ * transpile: [],
21
+ * }
22
+ * ```
23
+ */
24
+ pipeline: PipelineDefinition;
25
+ /** Backfill cache options */
26
+ cacheOptions: CacheOptions;
27
+ /** Which files to ignore when calculating scopes with --since */
28
+ ignore: string[];
29
+ /** disables --since flag when any of this list of files changed */
30
+ repoWideChanges: string[];
31
+ /** Which NPM Client to use when running npm lifecycle scripts */
32
+ npmClient: NpmClient;
33
+ /** Optional priority to set on tasks in a package to make the scheduler give priority to tasks on the critical path for high priority tasks */
34
+ priorities: Priority[];
35
+ /**
36
+ * Options that will be sent to all log reporters.
37
+ */
38
+ loggerOptions: LoggerOptions;
39
+ /**
40
+ * Custom runners for tasks in the pipeline. The key is the task name, and the value is a configuration describing what would be
41
+ * passed to the runner constructor.
42
+ */
43
+ runners: TargetRunnerPickerOptions;
44
+ /**
45
+ * Maximum worker idle memory, this would cause workers to restart if they exceed this limit. This is useful to prevent memory leaks.
46
+ */
47
+ workerIdleMemoryLimit: number;
48
+ /**
49
+ * Maximum number of concurrent tasks to run
50
+ */
51
+ concurrency: number;
52
+ /**
53
+ * Allows for no targets run
54
+ */
55
+ allowNoTargetRuns: boolean;
56
+ }
@@ -0,0 +1,9 @@
1
+ export interface FilterOptions {
2
+ dependencies: boolean;
3
+ dependents: boolean;
4
+ since: string;
5
+ scope: string[];
6
+ to: string[];
7
+ ignore: string[];
8
+ allowNoTargetRuns: boolean;
9
+ }
@@ -0,0 +1,15 @@
1
+ import type { LogLevel } from "@lage-run/logger";
2
+ export interface LoggerOptions {
3
+ disp?: {
4
+ [level: string]: string;
5
+ };
6
+ style?: {
7
+ [level: string]: {
8
+ fg?: string;
9
+ bg?: string;
10
+ };
11
+ };
12
+ levels?: {
13
+ [level: string]: LogLevel;
14
+ };
15
+ }
@@ -0,0 +1,12 @@
1
+ import type { TargetConfig } from "@lage-run/target-graph";
2
+ import type { ConfigOptions } from "./ConfigOptions.js";
3
+ export interface FactoryArgs {
4
+ cwd: string;
5
+ config: ConfigOptions;
6
+ }
7
+ export interface TargetConfigFactory {
8
+ (args: FactoryArgs): TargetConfig | TargetConfig[];
9
+ }
10
+ export interface PipelineDefinition {
11
+ [task: string]: string[] | TargetConfig;
12
+ }
@@ -0,0 +1,8 @@
1
+ export interface Priority {
2
+ /** package name, as in package.json */
3
+ package?: string;
4
+ /** task name, as listed in the `scripts` section of package.json */
5
+ task: string;
6
+ /** priority, the higher the more priority; undefined priority means lowest priority*/
7
+ priority: number;
8
+ }
@@ -0,0 +1,10 @@
1
+ import type { LogLevel } from "@lage-run/logger";
2
+ export interface ReporterInitOptions {
3
+ reporter: string[] | string;
4
+ progress: boolean;
5
+ verbose: boolean;
6
+ grouped: boolean;
7
+ concurrency: number;
8
+ logLevel: keyof typeof LogLevel;
9
+ profile?: boolean | string;
10
+ }
@@ -0,0 +1 @@
1
+ export declare const NoTargetFoundError: Error;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lage-run/cli",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "Command Line Interface for Lage",
5
5
  "repository": {
6
6
  "url": "https://github.com/microsoft/lage"
@@ -20,7 +20,7 @@
20
20
  "dependencies": {
21
21
  "@lage-run/find-npm-client": "^0.1.4",
22
22
  "@lage-run/logger": "^1.2.2",
23
- "@lage-run/scheduler": "^0.8.2",
23
+ "@lage-run/scheduler": "^0.8.3",
24
24
  "@lage-run/scheduler-types": "^0.3.0",
25
25
  "@lage-run/target-graph": "^0.6.1",
26
26
  "@lage-run/cache": "^0.2.3",