diff --git a/change/change-0b8bd43e-1dd3-4a10-af17-04c1ad59b3a4.json b/change/change-0b8bd43e-1dd3-4a10-af17-04c1ad59b3a4.json new file mode 100644 index 000000000..68fa3ed38 --- /dev/null +++ b/change/change-0b8bd43e-1dd3-4a10-af17-04c1ad59b3a4.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/package.json b/package.json index e5bcfb0aa..b0617664d 100644 --- a/package.json +++ b/package.json @@ -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" }, diff --git a/packages/cache/src/backfillWrapper.ts b/packages/cache/src/backfillWrapper.ts index ad453403b..ee8c5f44d 100644 --- a/packages/cache/src/backfillWrapper.ts +++ b/packages/cache/src/backfillWrapper.ts @@ -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", { @@ -28,13 +28,17 @@ export function createBackfillLogger() { }); } -export function createBackfillCacheConfig(cwd: string, cacheOptions: Partial = {}, backfillLogger: BackfillLogger) { +export function createBackfillCacheConfig( + cwd: string, + cacheOptions: Partial | 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; diff --git a/packages/cache/src/chunkPromise.ts b/packages/cache/src/chunkPromise.ts index 5d1269c47..605b28e1a 100644 --- a/packages/cache/src/chunkPromise.ts +++ b/packages/cache/src/chunkPromise.ts @@ -1,6 +1,6 @@ type PromiseFn = () => Promise; -export async function chunkPromise(promises: (Promise | PromiseFn)[], limit = 5) { +export async function chunkPromise(promises: (Promise | PromiseFn)[], limit = 5): Promise { for (let i = 0; i < promises.length; i += limit) { await Promise.all(promises.slice(i, i + limit).map((p) => (typeof p === "function" ? p() : p))); } diff --git a/packages/cache/src/getCacheDirectory.ts b/packages/cache/src/getCacheDirectory.ts index 0b5fac2f4..67cdead6a 100644 --- a/packages/cache/src/getCacheDirectory.ts +++ b/packages/cache/src/getCacheDirectory.ts @@ -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)); } diff --git a/packages/cache/src/providers/BackfillCacheProvider.ts b/packages/cache/src/providers/BackfillCacheProvider.ts index 2e9301ac6..3c122d020 100644 --- a/packages/cache/src/providers/BackfillCacheProvider.ts +++ b/packages/cache/src/providers/BackfillCacheProvider.ts @@ -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)); } } diff --git a/packages/cache/src/providers/RemoteFallbackCacheProvider.ts b/packages/cache/src/providers/RemoteFallbackCacheProvider.ts index 8b9c30fcb..9428289cb 100644 --- a/packages/cache/src/providers/RemoteFallbackCacheProvider.ts +++ b/packages/cache/src/providers/RemoteFallbackCacheProvider.ts @@ -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 { const { logger, remoteCacheProvider, localCacheProvider } = this.options; if (localCacheProvider) { @@ -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 { const { logger, remoteCacheProvider, localCacheProvider, writeRemoteCache } = this.options; const putPromises: Promise[] = []; diff --git a/packages/cli/src/cache/createCacheProvider.ts b/packages/cli/src/cache/createCacheProvider.ts index f7c581f23..ab956f57d 100644 --- a/packages/cli/src/cache/createCacheProvider.ts +++ b/packages/cli/src/cache/createCacheProvider.ts @@ -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({ diff --git a/packages/cli/src/cache/isRunningFromCI.ts b/packages/cli/src/cache/isRunningFromCI.ts index b2ec496b7..dd86cb254 100644 --- a/packages/cli/src/cache/isRunningFromCI.ts +++ b/packages/cli/src/cache/isRunningFromCI.ts @@ -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); diff --git a/packages/cli/src/commands/addOptions.ts b/packages/cli/src/commands/addOptions.ts index 955062482..b55528c1a 100644 --- a/packages/cli/src/commands/addOptions.ts +++ b/packages/cli/src/commands/addOptions.ts @@ -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