Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions change/change-0b8bd43e-1dd3-4a10-af17-04c1ad59b3a4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"changes": [
{
"type": "patch",
"comment": "Add explicit module boundary types and update typescript version",
"packageName": "@lage-run/cache",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Add explicit module boundary types and update typescript version",
"packageName": "@lage-run/cli",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Add explicit module boundary types and update typescript version",
"packageName": "@lage-run/config",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Add explicit module boundary types and update typescript version",
"packageName": "@lage-run/format-hrtime",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Add explicit module boundary types and update typescript version",
"packageName": "@lage-run/globby",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Add explicit module boundary types and update typescript version",
"packageName": "@lage-run/hasher",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Add explicit module boundary types and update typescript version",
"packageName": "@lage-run/logger",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Add explicit module boundary types and update typescript version",
"packageName": "@lage-run/reporters",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Add explicit module boundary types and update typescript version",
"packageName": "@lage-run/rpc",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Add explicit module boundary types and update typescript version",
"packageName": "@lage-run/runners",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Add explicit module boundary types and update typescript version",
"packageName": "@lage-run/scheduler",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Add explicit module boundary types and update typescript version",
"packageName": "@lage-run/target-graph",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Add explicit module boundary types and update typescript version",
"packageName": "@lage-run/worker-threads-pool",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
}
]
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
"prettier": "^3.0.0",
"syncpack": "^13.0.0",
"ts-node": "^10.9.1",
"typescript": "~5.0.3"
"typescript": "~5.9.3"
},
"resolutions": {
"@types/node@npm:*": "^16.0.0",
"typescript@npm:>=5.0.2": "~5.0.3",
"typescript@npm:>=5.0.2": "~5.9.3",
"node-gyp@npm:latest": "^11.0.0",
"listr2@npm:^9.0.5": "9.0.3"
},
Expand Down
12 changes: 8 additions & 4 deletions packages/cache/src/backfillWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
*/

import * as os from "os";
import { createDefaultConfig, getEnvConfig } from "backfill-config";
import { type Config, createDefaultConfig, getEnvConfig } from "backfill-config";
import { makeLogger } from "backfill-logger";
import type { Logger as BackfillLogger } from "backfill-logger";
import type { CacheOptions } from "@lage-run/config";
import type { AzureCredentialName } from "@lage-run/config";
import { CredentialCache } from "./CredentialCache.js";

export function createBackfillLogger() {
export function createBackfillLogger(): BackfillLogger {
const stdout = process.stdout;
const stderr = process.stderr;
return makeLogger("error", {
Expand All @@ -28,13 +28,17 @@ export function createBackfillLogger() {
});
}

export function createBackfillCacheConfig(cwd: string, cacheOptions: Partial<CacheOptions> = {}, backfillLogger: BackfillLogger) {
export function createBackfillCacheConfig(
cwd: string,
cacheOptions: Partial<CacheOptions> | undefined = {},
backfillLogger: BackfillLogger
): Config {
const envConfig = getEnvConfig(backfillLogger);
const mergedConfig = {
...createDefaultConfig(cwd),
...cacheOptions,
...envConfig,
};
} as Config;

if (mergedConfig.cacheStorageConfig.provider === "azure-blob") {
const azureOptions = mergedConfig.cacheStorageConfig.options;
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/src/chunkPromise.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
type PromiseFn = () => Promise<unknown>;

export async function chunkPromise(promises: (Promise<unknown> | PromiseFn)[], limit = 5) {
export async function chunkPromise(promises: (Promise<unknown> | PromiseFn)[], limit = 5): Promise<void> {
for (let i = 0; i < promises.length; i += limit) {
await Promise.all(promises.slice(i, i + limit).map((p) => (typeof p === "function" ? p() : p)));
}
Expand Down
6 changes: 3 additions & 3 deletions packages/cache/src/getCacheDirectory.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import path from "path";

export function getCacheDirectoryRoot(root: string) {
export function getCacheDirectoryRoot(root: string): string {
return path.join(root, "node_modules", ".cache", "lage");
}

export function getCacheDirectory(root: string, hash: string) {
export function getCacheDirectory(root: string, hash: string): string {
return path.join(getCacheDirectoryRoot(root), "cache", hash.substring(0, 4));
}

export function getLogsCacheDirectory(root: string, hash: string) {
export function getLogsCacheDirectory(root: string, hash: string): string {
return path.join(getCacheDirectoryRoot(root), "logs", hash.substring(0, 4));
}
2 changes: 1 addition & 1 deletion packages/cache/src/providers/BackfillCacheProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class BackfillCacheProvider implements CacheProvider {
);
}

getCachePath(packagePath: string, hash: string) {
getCachePath(packagePath: string, hash: string): string {
return path.relative(packagePath, getCacheDirectory(this.options.root, hash));
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/cache/src/providers/RemoteFallbackCacheProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class RemoteFallbackCacheProvider implements CacheProvider {

constructor(private options: RemoteFallbackCacheProviderOptions) {}

async fetch(hash: string, target: Target) {
async fetch(hash: string, target: Target): Promise<boolean> {
const { logger, remoteCacheProvider, localCacheProvider } = this.options;

if (localCacheProvider) {
Expand All @@ -48,7 +48,7 @@ export class RemoteFallbackCacheProvider implements CacheProvider {
return RemoteFallbackCacheProvider.localHits[hash];
}

async put(hash: string, target: Target) {
async put(hash: string, target: Target): Promise<void> {
const { logger, remoteCacheProvider, localCacheProvider, writeRemoteCache } = this.options;
const putPromises: Promise<void>[] = [];

Expand Down
4 changes: 3 additions & 1 deletion packages/cli/src/cache/createCacheProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ interface CreateCacheOptions {
cliArgs: string[];
}

export async function createCache(options: CreateCacheOptions) {
export async function createCache(options: CreateCacheOptions): Promise<{
hasher: TargetHasher;
}> {
const { cacheOptions, root, cliArgs, logger } = options;

const hasher = new TargetHasher({
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/cache/isRunningFromCI.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const isRunningFromCI = process.env.NODE_ENV !== "test" && (!!process.env.CI || !!process.env.TF_BUILD);
export const isRunningFromCI: boolean = process.env.NODE_ENV !== "test" && (!!process.env.CI || !!process.env.TF_BUILD);
2 changes: 1 addition & 1 deletion packages/cli/src/commands/addOptions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Command, Option } from "commander";
import { options } from "./options.js";

export function addOptions(category: keyof typeof options, command: Command) {
export function addOptions(category: keyof typeof options, command: Command): Command {
for (const option of Object.values<Option>(options[category])) {
command.addOption(option);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/affected/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface AffectedOptions extends FilterOptions {
outputFormat?: "json" | "graph" | "default";
}

export async function affectedAction(options: AffectedOptions) {
export async function affectedAction(options: AffectedOptions): Promise<void> {
const { dependencies, dependents, since, scope, ignore, outputFormat } = options;

const cwd = process.cwd();
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/affected/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Command } from "commander";
import { affectedAction } from "./action.js";
import { addOptions } from "../addOptions.js";

const affectedCommand = new Command("affected");
const affectedCommand: Command = new Command("affected");
addOptions("filter", affectedCommand).action(affectedAction);

export { affectedCommand };
2 changes: 1 addition & 1 deletion packages/cli/src/commands/cache/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface CacheOptions extends ReporterInitOptions {
clear?: boolean;
}

export async function cacheAction(options: CacheOptions, command: Command) {
export async function cacheAction(options: CacheOptions, command: Command): Promise<void> {
const cwd = process.cwd();
const config = await getConfig(cwd);
const logger = createLogger();
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/cache/clearCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface ClearCacheOptions {
concurrency: number;
}

export async function clearCache(options: ClearCacheOptions) {
export async function clearCache(options: ClearCacheOptions): Promise<void> {
const { logger, cwd } = options;

const config = await getConfig(cwd);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/cache/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Command } from "commander";
import { cacheAction } from "./action.js";
import { addOptions } from "../addOptions.js";

const command = new Command("cache");
const command: Command = new Command("cache");

addOptions("cache", command);
addOptions("logger", command);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/cache/pruneCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface PruneCacheOptions {
pruneDays: number;
}

export async function pruneCache(options: PruneCacheOptions) {
export async function pruneCache(options: PruneCacheOptions): Promise<void> {
const { logger, cwd, pruneDays } = options;

const config = await getConfig(cwd);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import path from "path";
import { rm, stat, unlink } from "fs/promises";

export class ClearCacheRunner implements TargetRunner {
async shouldRun() {
async shouldRun(): Promise<boolean> {
return true;
}
async run(runOptions: TargetRunnerOptions): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { rm, stat, unlink } from "fs/promises";
const MS_IN_A_DAY = 1000 * 60 * 60 * 24;

export class PruneCacheRunner implements TargetRunner {
async shouldRun() {
async shouldRun(): Promise<boolean> {
return true;
}
async run(runOptions: TargetRunnerOptions): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/exec/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface ExecRemoteOptions extends ExecOptions {
tasks: string[];
}

export async function execAction(options: ExecOptions, command: Command) {
export async function execAction(options: ExecOptions, command: Command): Promise<void> {
const cwd = options.cwd ?? process.cwd();
const config = await getConfig(cwd);
const logger = createLogger();
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/exec/executeInProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function parsePackageInfoFromArgs(root: string, cwd: string | undefined, package
};
}

export async function executeInProcess({ cwd, args, nodeArg, logger }: ExecuteInProcessOptions) {
export async function executeInProcess({ cwd, args, nodeArg, logger }: ExecuteInProcessOptions): Promise<void> {
const root = getWorkspaceManagerRoot(process.cwd())!;
const config = await getConfig(root);
const { pipeline } = config;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/exec/executeRemotely.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ async function executeOnServer(args: string[], client: LageClient, logger: Logge
}
}

export async function executeRemotely(options: ExecRemotelyOptions, command: Command) {
export async function executeRemotely(options: ExecRemotelyOptions, command: Command): Promise<void> {
// launch a 'lage-server.js' process, detached if it is not already running
// send the command to the server process
const { server, tasks, nodeArg } = options;
Expand Down
8 changes: 7 additions & 1 deletion packages/cli/src/commands/exec/expandTargetDefinition.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { type PipelineDefinition } from "@lage-run/config";
import { type TargetConfig } from "@lage-run/target-graph";

export function expandTargetDefinition(packageName: string | undefined, task: string, pipeline: PipelineDefinition, outputs: string[]) {
export function expandTargetDefinition(
packageName: string | undefined,
task: string,
pipeline: PipelineDefinition,
outputs: string[]
): TargetConfig {
const id = packageName ? `${packageName}#${task}` : task;
const emptyDefinition = {
cache: false,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/exec/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Command } from "commander";
import { execAction } from "./action.js";
import { addOptions } from "../addOptions.js";

const command = new Command("exec");
const command: Command = new Command("exec");
addOptions("pool", command);
addOptions("runner", command);
addOptions("server", command);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/exec/simulateFileAccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Logger } from "@lage-run/logger";
import path from "path";
import fs from "fs";

export async function simulateFileAccess(logger: Logger, root: string, inputs: string[], outputs: string[]) {
export async function simulateFileAccess(logger: Logger, root: string, inputs: string[], outputs: string[]): Promise<void> {
logger.silly("Now probing and touching inputs and outputs");

// Helper to get all directory parts up to root
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/info/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ interface PackageTask {
* ...
* ]
*/
export async function infoAction(options: InfoActionOptions, command: Command) {
export async function infoAction(options: InfoActionOptions, command: Command): Promise<void> {
const cwd = process.cwd();
const config = await getConfig(cwd);
const logger = createLogger();
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/info/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Command } from "commander";
import { infoAction } from "./action.js";
import { addOptions } from "../addOptions.js";

const command = new Command("info");
const command: Command = new Command("info");
addOptions("server", command);
addOptions("runner", command);
addOptions("logger", command);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/init/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import execa from "execa";

type WorkspaceManager = "rush" | "pnpm" | "yarn" | "npm";

export async function initAction() {
export async function initAction(): Promise<void> {
const cwd = process.cwd();

const config = await readConfigFile(cwd);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/init/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Command } from "commander";
import { initAction } from "./action.js";

const initCommand = new Command("init");
const initCommand: Command = new Command("init");

initCommand.description("Install lage in a workspace and create a config file").action(initAction);

Expand Down
Loading