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
60 changes: 60 additions & 0 deletions change/change-3a1c5c00-cc62-4ec6-8fe5-cb3d6d2c81ff.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"changes": [
{
"type": "patch",
"comment": "Add/enforce explicit visibility modifiers",
"packageName": "@lage-run/cache",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Add/enforce explicit visibility modifiers",
"packageName": "@lage-run/cli",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Add/enforce explicit visibility modifiers",
"packageName": "@lage-run/logger",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Add/enforce explicit visibility modifiers",
"packageName": "@lage-run/reporters",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Add/enforce explicit visibility modifiers",
"packageName": "@lage-run/runners",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Add/enforce explicit visibility modifiers",
"packageName": "@lage-run/scheduler",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Add/enforce explicit visibility modifiers",
"packageName": "@lage-run/target-graph",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "patch",
"comment": "Add/enforce explicit visibility modifiers",
"packageName": "@lage-run/worker-threads-pool",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
}
]
}
10 changes: 5 additions & 5 deletions packages/cache/src/providers/BackfillCacheProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class BackfillCacheProvider implements CacheProvider {
this.backfillLogger = createBackfillLogger();
}

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

if (!hash) {
Expand All @@ -67,7 +67,7 @@ export class BackfillCacheProvider implements CacheProvider {
}
}

async put(hash: string, target: Target): Promise<void> {
public async put(hash: string, target: Target): Promise<void> {
const { logger } = this.options;

if (!hash) {
Expand All @@ -91,11 +91,11 @@ export class BackfillCacheProvider implements CacheProvider {
}
}

async clear(concurrency = 10): Promise<void> {
public async clear(concurrency = 10): Promise<void> {
return this.purge(0, concurrency);
}

async purge(prunePeriod = 30, concurrency = 10): Promise<void> {
public async purge(prunePeriod = 30, concurrency = 10): Promise<void> {
const now = new Date();

const cacheTypes = ["cache", "logs"];
Expand Down Expand Up @@ -127,7 +127,7 @@ export class BackfillCacheProvider implements CacheProvider {
);
}

getCachePath(packagePath: string, hash: string): string {
private getCachePath(packagePath: string, hash: string): string {
return path.relative(packagePath, getCacheDirectory(this.options.root, hash));
}
}
Expand Down
8 changes: 4 additions & 4 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): Promise<boolean> {
public 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): Promise<void> {
public async put(hash: string, target: Target): Promise<void> {
const { logger, remoteCacheProvider, localCacheProvider, writeRemoteCache } = this.options;
const putPromises: Promise<void>[] = [];

Expand Down Expand Up @@ -80,14 +80,14 @@ export class RemoteFallbackCacheProvider implements CacheProvider {
return hash in RemoteFallbackCacheProvider.localHits && RemoteFallbackCacheProvider.localHits[hash];
}

async clear(): Promise<void> {
public async clear(): Promise<void> {
const { localCacheProvider } = this.options;
if (localCacheProvider) {
return localCacheProvider.clear();
}
}

async purge(sinceDays: number): Promise<void> {
public async purge(sinceDays: number): Promise<void> {
const { localCacheProvider } = this.options;
if (localCacheProvider) {
return localCacheProvider.purge(sinceDays);
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/__tests__/simulateFileAccess.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jest.mock("fs");
// Mock the logger
const mockSilly = jest.fn();
class MockLogger extends Logger {
override silly = mockSilly;
public override silly = mockSilly;
// do nothing
override log() {}
override stream() {
public override log() {}
public override stream() {
return () => {};
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/cache/runners/ClearCacheRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import path from "path";
import { rm, stat, unlink } from "fs/promises";

export class ClearCacheRunner implements TargetRunner {
async shouldRun(): Promise<boolean> {
public async shouldRun(): Promise<boolean> {
return true;
}
async run(runOptions: TargetRunnerOptions): Promise<void> {
public async run(runOptions: TargetRunnerOptions): Promise<void> {
const { target } = runOptions;
const { clearPaths } = target.options!;

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/cache/runners/PruneCacheRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { rm, stat, unlink } from "fs/promises";
const MS_IN_A_DAY = 1000 * 60 * 60 * 24;

export class PruneCacheRunner implements TargetRunner {
async shouldRun(): Promise<boolean> {
public async shouldRun(): Promise<boolean> {
return true;
}
async run(runOptions: TargetRunnerOptions): Promise<void> {
public async run(runOptions: TargetRunnerOptions): Promise<void> {
const { target } = runOptions;
const { clearPaths, prunePeriod, now } = target.options!;

Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/commands/server/MemoryStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ export class MemoryStream extends Writable {
this.chunks = [];
}

_write(chunk: unknown, encoding: BufferEncoding): void {
public _write(chunk: unknown, encoding: BufferEncoding): void {
this.chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk as any, encoding));
}

getData(): Buffer {
public getData(): Buffer {
return Buffer.concat(this.chunks);
}

toString(): string {
public toString(): string {
return this.getData().toString();
}
}
7 changes: 6 additions & 1 deletion packages/e2e-tests/jest.config.js
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
module.exports = require("@lage-run/monorepo-scripts/config/jest.config.js");
const baseConfig = require("@lage-run/monorepo-scripts/config/jest.config.js");

module.exports = {
...baseConfig,
testTimeout: baseConfig.testTimeout * 2,
};
1 change: 1 addition & 0 deletions packages/e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"dependencies": {
"@lage-run/cli": "workspace:^",
"@lage-run/globby": "workspace:^",
"@lage-run/monorepo-fixture": "workspace:^",
"@lage-run/monorepo-scripts": "workspace:^",
"@lage-run/scheduler-types": "workspace:^",
"@lage-run/target-graph": "workspace:^",
Expand Down
56 changes: 28 additions & 28 deletions packages/e2e-tests/src/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ describe("basics", () => {
repo = undefined;
});

it("basic test case", () => {
it("basic test case", async () => {
repo = new Monorepo("basics");

repo.init();
repo.addPackage("a", ["b"]);
repo.addPackage("b");
await repo.init();
await repo.addPackage("a", ["b"]);
await repo.addPackage("b");

repo.install();
await repo.install();

const results = repo.run("test");
const results = await repo.run("test");
const output = results.stdout + results.stderr;
const jsonOutput = parseNdJson(output);

Expand All @@ -29,21 +29,21 @@ describe("basics", () => {
expect(jsonOutput.find((entry) => filterEntry(entry.data, "a", "lint", "success"))).toBeFalsy();
});

it("basic with missing script names - logging should not include those targets", () => {
it("basic with missing script names - logging should not include those targets", async () => {
repo = new Monorepo("basics-missing-scripts");

repo.init();
repo.addPackage("a", ["b"]);
repo.addPackage("b", [], {
await repo.init();
await repo.addPackage("a", ["b"]);
await repo.addPackage("b", [], {
build: "node ./build.js",
test: "node ./test.js",
lint: "node ./lint.js",
extra: "node ./extra.js",
});

repo.install();
await repo.install();

const results = repo.run("extra");
const results = await repo.run("extra");
const output = results.stdout + results.stderr;
const jsonOutput = parseNdJson(output);

Expand All @@ -54,20 +54,20 @@ describe("basics", () => {
expect(jsonOutput.find((entry) => filterEntry(entry.data, "a", "lint", "success"))).toBeFalsy();
});

it("basic test case - with task args", () => {
it("basic test case - with task args", async () => {
repo = new Monorepo("basics-with-task-args");

repo.init();
repo.addPackage("a", ["b"]);
repo.addPackage("b");
await repo.init();
await repo.addPackage("a", ["b"]);
await repo.addPackage("b");

repo.install();
await repo.install();

// run once without params
repo.run("test");
await repo.run("test");

// run with some params, expected actual runs
const results = repo.run("test", ["--1", "--2"]);
const results = await repo.run("test", ["--1", "--2"]);
const output = results.stdout + results.stderr;
const jsonOutput = parseNdJson(output);

Expand All @@ -78,7 +78,7 @@ describe("basics", () => {
expect(jsonOutput.find((entry) => filterEntry(entry.data, "a", "lint", "success"))).toBeFalsy();

// run with some params, expected skips
const results2 = repo.run("test", ["--1", "--2"]);
const results2 = await repo.run("test", ["--1", "--2"]);
const output2 = results2.stdout + results2.stderr;
const jsonOutput2 = parseNdJson(output2);

Expand All @@ -89,7 +89,7 @@ describe("basics", () => {
expect(jsonOutput2.find((entry) => filterEntry(entry.data, "a", "lint", "skipped"))).toBeFalsy();

// run with some lage specific params, expected skips
const results3 = repo.run("test", ["--concurrency", "1"]);
const results3 = await repo.run("test", ["--concurrency", "1"]);
const output3 = results3.stdout + results3.stderr;
const jsonOutput3 = parseNdJson(output3);

Expand All @@ -100,7 +100,7 @@ describe("basics", () => {
expect(jsonOutput3.find((entry) => filterEntry(entry.data, "a", "lint", "skipped"))).toBeFalsy();

// run with some params AND lage specific params, expected skips
const results4 = repo.run("test", ["--1", "--2", "--concurrency", "1"]);
const results4 = await repo.run("test", ["--1", "--2", "--concurrency", "1"]);
const output4 = results4.stdout + results4.stderr;
const jsonOutput4 = parseNdJson(output4);

Expand All @@ -111,16 +111,16 @@ describe("basics", () => {
expect(jsonOutput4.find((entry) => filterEntry(entry.data, "a", "lint", "skipped"))).toBeFalsy();
});

it("works in repo with spaces", () => {
it("works in repo with spaces", async () => {
repo = new Monorepo("spaces why");

repo.init();
repo.addPackage("a", ["b"]);
repo.addPackage("b");
await repo.init();
await repo.addPackage("a", ["b"]);
await repo.addPackage("b");

repo.install();
await repo.install();

const results = repo.run("test");
const results = await repo.run("test");
const output = results.stdout + results.stderr;
const jsonOutput = parseNdJson(output);

Expand Down
Loading