@akanjs/devkit 3.2.0-rc.14 → 3.2.0-rc.15
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.
- package/CHANGELOG.md +13 -1
- package/README.ko.md +3 -2
- package/README.md +4 -2
- package/akanApp/BackendImportGraph.test.ts +1 -1
- package/akanApp/akanApp.host.test.ts +1 -1
- package/akanApp/akanApp.host.ts +1 -1
- package/akanConfig/akanConfig.test.ts +1 -1
- package/akanConfig/akanConfig.ts +1 -1
- package/akanConfig/akanWorkspaceConfig.ts +1 -1
- package/akanConfig/productionLockfile.ts +1 -1
- package/apiReport/apiReport.test.ts +1 -1
- package/{applicationBuildRunner.test.ts → app/applicationBuildRunner.test.ts} +8 -8
- package/{applicationBuildRunner.ts → app/applicationBuildRunner.ts} +14 -14
- package/{applicationTestPreload.ts → app/applicationTestPreload.ts} +1 -1
- package/{routeJsBudget.test.ts → app/routeJsBudget.test.ts} +1 -1
- package/{routeJsBudget.ts → app/routeJsBudget.ts} +2 -2
- package/artifact/implicitRootLayout.test.ts +1 -1
- package/cloud/cloudApi.test.ts +1 -1
- package/cloud/configLock.test.ts +1 -1
- package/cloud/globalConfig.test.ts +1 -1
- package/cloud/globalConfig.ts +1 -1
- package/cloud/updatePackUpload.test.ts +1 -1
- package/codeAgent/agent/AkanCodeEnv.ts +1 -1
- package/codeAgent/agent/akanCodePaths.ts +1 -1
- package/codeAgent/agent/codeAgent.test.ts +1 -1
- package/codeAgent/skills/akan-debug/SKILL.md +8 -5
- package/codeAgent/tools/AkanCli.ts +1 -1
- package/codeAgent/tools/AkanToolPack.ts +1 -1
- package/codeAgent/tools/akanCodePlugins.test.ts +1 -1
- package/commandDecorators/command.ts +3 -3
- package/commandDecorators/commandDecorators.test.ts +1 -1
- package/commandDecorators/workspaceVersionCheck.test.ts +1 -1
- package/commandDecorators/workspaceVersionCheck.ts +1 -1
- package/{akanContext.ts → context/akanContext.ts} +8 -8
- package/{akanMcpContract.test.ts → context/akanMcpContract.test.ts} +1 -1
- package/{akanMcpContract.ts → context/akanMcpContract.ts} +5 -5
- package/{recipeScanner.test.ts → context/recipeScanner.test.ts} +1 -1
- package/devkitUtils.test.ts +5 -5
- package/{apiReference.test.ts → docs/apiReference.test.ts} +4 -4
- package/{apiReference.ts → docs/apiReference.ts} +2 -2
- package/{errorCodeReference.test.ts → docs/errorCodeReference.test.ts} +4 -4
- package/{errorCodeReference.ts → docs/errorCodeReference.ts} +2 -2
- package/{errorCodeScan.ts → docs/errorCodeScan.ts} +1 -1
- package/{frameworkGraph.test.ts → docs/frameworkGraph.test.ts} +1 -1
- package/executors/appExecutor.ts +5 -5
- package/executors/executor.ts +9 -9
- package/{executors.linkFallback.test.ts → executors/executors.linkFallback.test.ts} +1 -1
- package/{executors.test.ts → executors/executors.test.ts} +11 -18
- package/executors/index.ts +8 -0
- package/executors/pkgExecutor.ts +2 -2
- package/executors/sysExecutor.ts +8 -8
- package/executors/workspaceExecutor.ts +4 -4
- package/frontendBuild/allRoutesBuilder.test.ts +1 -1
- package/frontendBuild/autoImportSync.test.ts +1 -1
- package/frontendBuild/autoImportSync.ts +1 -1
- package/frontendBuild/buildRouteClient.test.ts +1 -1
- package/frontendBuild/clientEntriesBundler.test.ts +1 -1
- package/frontendBuild/csrArtifactBuilder.test.ts +1 -1
- package/frontendBuild/csrDevArtifactWriter.ts +1 -1
- package/frontendBuild/cssCompiler.test.ts +1 -1
- package/frontendBuild/devGeneratedIndexSync.test.ts +1 -1
- package/frontendBuild/devGeneratedIndexSync.ts +1 -1
- package/frontendBuild/dictionaryAssetBuilder.test.ts +1 -1
- package/frontendBuild/fontOptimizer.test.ts +1 -1
- package/frontendBuild/fontPruner.test.ts +1 -1
- package/frontendBuild/frontendBuild.test.ts +1 -1
- package/frontendBuild/hmrWatcher.test.ts +1 -1
- package/frontendBuild/mcpAppViewBuilder.test.ts +1 -1
- package/frontendBuild/mcpAppViewBuilder.ts +1 -1
- package/frontendBuild/nativeCore.test.ts +1 -1
- package/frontendBuild/optionalPeers.test.ts +1 -1
- package/frontendBuild/precompressArtifacts.test.ts +1 -1
- package/frontendBuild/serverGraphFile.ts +1 -1
- package/frontendBuild/sourceMtimeIndex.test.ts +1 -1
- package/frontendBuild/ssrDevBundler.test.ts +1 -1
- package/frontendBuild/vendorImportScanner.test.ts +1 -1
- package/frontendBuild/vendorNarrowing.test.ts +1 -1
- package/frontendBuild/watchRootResolver.test.ts +1 -1
- package/{agentAssets.test.ts → guideline/agentAssets.test.ts} +1 -1
- package/{agentAssets.ts → guideline/agentAssets.ts} +1 -1
- package/{agentsIndex.test.ts → guideline/agentsIndex.test.ts} +2 -2
- package/{agentsIndex.ts → guideline/agentsIndex.ts} +12 -9
- package/{conventionSet.test.ts → guideline/conventionSet.test.ts} +3 -3
- package/{prompter.ts → guideline/prompter.ts} +2 -3
- package/incrementalBuilder/buildBatch.proc.ts +1 -1
- package/incrementalBuilder/buildBatchRunner.test.ts +1 -1
- package/incrementalBuilder/builderChannel.test.ts +1 -1
- package/incrementalBuilder/builderGraphPayloads.ts +3 -3
- package/incrementalBuilder/incrementalBuilder.proc.test.ts +1 -1
- package/incrementalBuilder/incrementalBuilder.proc.ts +2 -2
- package/index.ts +22 -22
- package/integration/devStabilityHarness.test.ts +1 -1
- package/{biomeBase.test.ts → lint/biomeBase.test.ts} +1 -1
- package/lint/gritRules.test.ts +1 -1
- package/{linter.test.ts → lint/linter.test.ts} +1 -1
- package/mobile/desktopBin.test.ts +1 -1
- package/mobile/desktopRelease.test.ts +1 -1
- package/mobile/desktopServerStage.test.ts +2 -2
- package/mobile/desktopServerStage.ts +1 -1
- package/mobile/nativeApi.test.ts +1 -1
- package/mobile/nativeApp.test.ts +1 -1
- package/mobile/nativeConfig.test.ts +1 -1
- package/mobile/nativePluginFolders.test.ts +1 -1
- package/mobile/nativePublicEnv.test.ts +1 -1
- package/mobile/nativeWebDir.test.ts +1 -1
- package/mobile/serverBundleSecrets.test.ts +1 -1
- package/mobile/tarWriter.test.ts +1 -1
- package/mobile/updatePackFolder.test.ts +1 -1
- package/package.json +167 -3
- package/packageExports.test.ts +20 -2
- package/piDependencyPins.test.ts +1 -1
- package/pipeline/PipelineDefinition.ts +1 -1
- package/platformTest/IdleWatchedProcess.test.ts +1 -1
- package/platformTest/PlatformTestRun.test.ts +1 -1
- package/platformTest/TestSnapshot.test.ts +1 -1
- package/{abstractDoc.test.ts → quality/abstractDoc.test.ts} +2 -2
- package/{abstractDoc.ts → quality/abstractDoc.ts} +1 -1
- package/{maintainabilityBaseline.test.ts → quality/maintainabilityBaseline.test.ts} +24 -0
- package/{maintainabilityBaseline.ts → quality/maintainabilityBaseline.ts} +24 -1
- package/{maintainabilityContract.test.ts → quality/maintainabilityContract.test.ts} +82 -2
- package/{maintainabilityContract.ts → quality/maintainabilityContract.ts} +65 -8
- package/{maintainabilityExceptionScanner.test.ts → quality/maintainabilityExceptionScanner.test.ts} +1 -1
- package/{qualityScanner.test.ts → quality/qualityScanner.test.ts} +1 -1
- package/{qualityScanner.ts → quality/qualityScanner.ts} +8 -8
- package/{subspace.test.ts → subspace/subspace.test.ts} +3 -3
- package/{subspace.ts → subspace/subspace.ts} +4 -4
- package/{subspaceClone.ts → subspace/subspaceClone.ts} +5 -5
- package/{subspaceConfig.ts → subspace/subspaceConfig.ts} +1 -1
- package/{testHelpers.ts → test/testHelpers.ts} +1 -1
- package/transforms/browserDirnamePlugin.test.ts +1 -1
- package/transforms/externalizeFrameworkPlugin.test.ts +1 -1
- package/transforms/mcpAppPageTrimmer.test.ts +1 -1
- package/transforms/pureLazyMarker.test.ts +1 -1
- package/transforms/serverEnvPlugin.test.ts +1 -1
- package/transforms/serverEnvProfile.test.ts +1 -1
- package/transforms/sideEffectImportOrder.test.ts +1 -1
- package/transforms/transforms.test.ts +2 -2
- package/transforms/tsconfigPackageResolver.test.ts +1 -1
- package/{createTunnel.test.ts → tunnel/createTunnel.test.ts} +1 -1
- package/{createTunnel.ts → tunnel/createTunnel.ts} +2 -2
- package/{sshHostKeys.ts → tunnel/sshHostKeys.ts} +2 -2
- package/typecheck/projectTypecheck.test.ts +1 -1
- package/typecheck/projectTypecheck.ts +1 -1
- package/{typeChecker.test.ts → typecheck/typeChecker.test.ts} +1 -1
- package/{typeChecker.ts → typecheck/typeChecker.ts} +1 -1
- package/typecheck/typecheck.proc.ts +1 -1
- package/typecheck/typecheckFailure.ts +1 -1
- package/{jsonFormatter.test.ts → util/jsonFormatter.test.ts} +1 -1
- package/workflow/executor.ts +1 -1
- package/workflow/guardCatalog.test.ts +1 -1
- package/workflow/moduleIndex.test.ts +2 -2
- package/workflow/moduleIndex.ts +1 -1
- package/workflow/rolloutGate.test.ts +1 -1
- package/workflow/rolloutGate.ts +1 -1
- package/{appSelectionMemory.ts → workspace/appSelectionMemory.ts} +1 -1
- package/{codegenLock.test.ts → workspace/codegenLock.test.ts} +1 -1
- package/{dependencyScanner.test.ts → workspace/dependencyScanner.test.ts} +1 -1
- package/{dependencyScanner.ts → workspace/dependencyScanner.ts} +2 -2
- package/{envSeed.test.ts → workspace/envSeed.test.ts} +2 -2
- package/{envSeed.ts → workspace/envSeed.ts} +1 -1
- package/{libSource.test.ts → workspace/libSource.test.ts} +2 -2
- package/{libSource.ts → workspace/libSource.ts} +1 -1
- package/{scanInfo.ts → workspace/scanInfo.ts} +7 -7
- package/{slicePlanner.test.ts → workspace/slicePlanner.test.ts} +2 -2
- package/{slicePlanner.ts → workspace/slicePlanner.ts} +1 -1
- package/{workspaceGraph.test.ts → workspace/workspaceGraph.test.ts} +1 -1
- package/{workspaceGraph.ts → workspace/workspaceGraph.ts} +1 -1
- package/{workspaceLayout.test.ts → workspace/workspaceLayout.test.ts} +1 -1
- package/executors.ts +0 -8
- /package/{applicationBuildReporter.test.ts → app/applicationBuildReporter.test.ts} +0 -0
- /package/{applicationBuildReporter.ts → app/applicationBuildReporter.ts} +0 -0
- /package/{routeSourceValidator.test.ts → app/routeSourceValidator.test.ts} +0 -0
- /package/{routeSourceValidator.ts → app/routeSourceValidator.ts} +0 -0
- /package/{akanMcpToolError.ts → context/akanMcpToolError.ts} +0 -0
- /package/{moduleFieldNames.test.ts → context/moduleFieldNames.test.ts} +0 -0
- /package/{moduleFieldNames.ts → context/moduleFieldNames.ts} +0 -0
- /package/{recipeScanner.ts → context/recipeScanner.ts} +0 -0
- /package/{declarationReader.ts → docs/declarationReader.ts} +0 -0
- /package/{frameworkGraph.ts → docs/frameworkGraph.ts} +0 -0
- /package/{conventionSet.ts → guideline/conventionSet.ts} +0 -0
- /package/{biomeBase.ts → lint/biomeBase.ts} +0 -0
- /package/{linter.ts → lint/linter.ts} +0 -0
- /package/{bareErrorScanner.ts → quality/bareErrorScanner.ts} +0 -0
- /package/{commentDensityScanner.test.ts → quality/commentDensityScanner.test.ts} +0 -0
- /package/{commentDensityScanner.ts → quality/commentDensityScanner.ts} +0 -0
- /package/{componentSizeScanner.test.ts → quality/componentSizeScanner.test.ts} +0 -0
- /package/{componentSizeScanner.ts → quality/componentSizeScanner.ts} +0 -0
- /package/{componentWriteChainScanner.test.ts → quality/componentWriteChainScanner.test.ts} +0 -0
- /package/{componentWriteChainScanner.ts → quality/componentWriteChainScanner.ts} +0 -0
- /package/{deprecatedCommentScanner.test.ts → quality/deprecatedCommentScanner.test.ts} +0 -0
- /package/{deprecatedCommentScanner.ts → quality/deprecatedCommentScanner.ts} +0 -0
- /package/{endpointReach.test.ts → quality/endpointReach.test.ts} +0 -0
- /package/{endpointReach.ts → quality/endpointReach.ts} +0 -0
- /package/{formSetterScanner.test.ts → quality/formSetterScanner.test.ts} +0 -0
- /package/{formSetterScanner.ts → quality/formSetterScanner.ts} +0 -0
- /package/{kindBranchScanner.test.ts → quality/kindBranchScanner.test.ts} +0 -0
- /package/{kindBranchScanner.ts → quality/kindBranchScanner.ts} +0 -0
- /package/{maintainabilityExceptionScanner.ts → quality/maintainabilityExceptionScanner.ts} +0 -0
- /package/{maintainabilityLimits.ts → quality/maintainabilityLimits.ts} +0 -0
- /package/{maintainabilityReport.test.ts → quality/maintainabilityReport.test.ts} +0 -0
- /package/{maintainabilityReport.ts → quality/maintainabilityReport.ts} +0 -0
- /package/{renderMutationScanner.test.ts → quality/renderMutationScanner.test.ts} +0 -0
- /package/{renderMutationScanner.ts → quality/renderMutationScanner.ts} +0 -0
- /package/{serviceLoopCallScanner.test.ts → quality/serviceLoopCallScanner.test.ts} +0 -0
- /package/{serviceLoopCallScanner.ts → quality/serviceLoopCallScanner.ts} +0 -0
- /package/{signalMutationIndex.test.ts → quality/signalMutationIndex.test.ts} +0 -0
- /package/{signalMutationIndex.ts → quality/signalMutationIndex.ts} +0 -0
- /package/{sourceComments.test.ts → quality/sourceComments.test.ts} +0 -0
- /package/{sourceComments.ts → quality/sourceComments.ts} +0 -0
- /package/{ssrScanner.test.ts → quality/ssrScanner.test.ts} +0 -0
- /package/{ssrScanner.ts → quality/ssrScanner.ts} +0 -0
- /package/{storeAccessScanner.test.ts → quality/storeAccessScanner.test.ts} +0 -0
- /package/{storeAccessScanner.ts → quality/storeAccessScanner.ts} +0 -0
- /package/{storeSource.ts → quality/storeSource.ts} +0 -0
- /package/{storeWriteScanner.test.ts → quality/storeWriteScanner.test.ts} +0 -0
- /package/{storeWriteScanner.ts → quality/storeWriteScanner.ts} +0 -0
- /package/{structureScanner.test.ts → quality/structureScanner.test.ts} +0 -0
- /package/{structureScanner.ts → quality/structureScanner.ts} +0 -0
- /package/{testOnlyExportScanner.test.ts → quality/testOnlyExportScanner.test.ts} +0 -0
- /package/{testOnlyExportScanner.ts → quality/testOnlyExportScanner.ts} +0 -0
- /package/{writePath.test.ts → quality/writePath.test.ts} +0 -0
- /package/{writePath.ts → quality/writePath.ts} +0 -0
- /package/{writePlacementScanner.test.ts → quality/writePlacementScanner.test.ts} +0 -0
- /package/{writePlacementScanner.ts → quality/writePlacementScanner.ts} +0 -0
- /package/{writingActionIndex.test.ts → quality/writingActionIndex.test.ts} +0 -0
- /package/{writingActionIndex.ts → quality/writingActionIndex.ts} +0 -0
- /package/{subspaceReport.ts → subspace/subspaceReport.ts} +0 -0
- /package/{sshTunnel.ts → tunnel/sshTunnel.ts} +0 -0
- /package/{fileEditor.ts → util/fileEditor.ts} +0 -0
- /package/{fileSys.test.ts → util/fileSys.test.ts} +0 -0
- /package/{fileSys.ts → util/fileSys.ts} +0 -0
- /package/{jsonFormatter.ts → util/jsonFormatter.ts} +0 -0
- /package/{selectModel.ts → util/selectModel.ts} +0 -0
- /package/{semver.test.ts → util/semver.test.ts} +0 -0
- /package/{semver.ts → util/semver.ts} +0 -0
- /package/{shellOnlyEnv.test.ts → util/shellOnlyEnv.test.ts} +0 -0
- /package/{shellOnlyEnv.ts → util/shellOnlyEnv.ts} +0 -0
- /package/{spinner.test.ts → util/spinner.test.ts} +0 -0
- /package/{spinner.ts → util/spinner.ts} +0 -0
- /package/{stripAnsi.ts → util/stripAnsi.ts} +0 -0
- /package/{codegenLock.ts → workspace/codegenLock.ts} +0 -0
- /package/{getRelatedCnsts.ts → workspace/getRelatedCnsts.ts} +0 -0
- /package/{gitRevision.test.ts → workspace/gitRevision.test.ts} +0 -0
- /package/{gitRevision.ts → workspace/gitRevision.ts} +0 -0
- /package/{manifestDependencies.ts → workspace/manifestDependencies.ts} +0 -0
- /package/{packageExportsMap.ts → workspace/packageExportsMap.ts} +0 -0
- /package/{repoIdentity.ts → workspace/repoIdentity.ts} +0 -0
- /package/{types.ts → workspace/types.ts} +0 -0
- /package/{workspaceLayout.ts → workspace/workspaceLayout.ts} +0 -0
|
@@ -225,6 +225,30 @@ describe("MaintainabilityBaseline", () => {
|
|
|
225
225
|
expect(baseline.tightenedBy([]).reasons.size).toBe(0);
|
|
226
226
|
});
|
|
227
227
|
|
|
228
|
+
test("moves a moved file's entries and reasons to its new path, matching the file before the first #", () => {
|
|
229
|
+
const reason = "The canvas is one pointer state machine.";
|
|
230
|
+
const baseline = baselineOf(
|
|
231
|
+
{
|
|
232
|
+
"akan.size.file": { "lib/a/A.Zone.tsx": 900, "lib/a/A.Zone.tsxx": 700 },
|
|
233
|
+
"akan.component.store-access": { "lib/a/A.Zone.tsx#Canvas": 30, "lib/a/A.Zone.tsx#Canvas#2": 25 },
|
|
234
|
+
},
|
|
235
|
+
{ "lib/a/A.Zone.tsx#Canvas": reason },
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
const moved = baseline.movedBy(new Map([["lib/a/A.Zone.tsx", "lib/b/A.Zone.tsx"]]));
|
|
239
|
+
|
|
240
|
+
expect([...(moved.sections.get("akan.size.file") ?? [])]).toEqual([
|
|
241
|
+
["lib/b/A.Zone.tsx", 900],
|
|
242
|
+
["lib/a/A.Zone.tsxx", 700],
|
|
243
|
+
]);
|
|
244
|
+
expect([...(moved.sections.get("akan.component.store-access") ?? [])]).toEqual([
|
|
245
|
+
["lib/b/A.Zone.tsx#Canvas", 30],
|
|
246
|
+
["lib/b/A.Zone.tsx#Canvas#2", 25],
|
|
247
|
+
]);
|
|
248
|
+
expect([...moved.reasons]).toEqual([["lib/b/A.Zone.tsx#Canvas", reason]]);
|
|
249
|
+
expect(baseline.movedBy(new Map())).toBe(baseline);
|
|
250
|
+
});
|
|
251
|
+
|
|
228
252
|
test("holds a total rule to the sum of its section: a moved count passes, a raised sum names the files that rose", () => {
|
|
229
253
|
const baseline = baselineOf({ "akan.error.bare-error": { "server/a.ts": 2, "server/b.ts": 1 } });
|
|
230
254
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JsonFormatter } from "
|
|
1
|
+
import { JsonFormatter } from "../util/jsonFormatter";
|
|
2
2
|
import type { DebtRuleId, MaintainabilityViolation } from "./maintainabilityContract";
|
|
3
3
|
|
|
4
4
|
export interface BaselineEntryGrowth {
|
|
@@ -194,6 +194,29 @@ export class MaintainabilityBaseline {
|
|
|
194
194
|
return new MaintainabilityBaseline(sections, this.reasons);
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
+
movedBy(moves: ReadonlyMap<string, string>) {
|
|
198
|
+
if (!moves.size) return this;
|
|
199
|
+
const movedKey = (key: string) => {
|
|
200
|
+
const file = key.split("#", 1)[0] ?? key;
|
|
201
|
+
const to = moves.get(file);
|
|
202
|
+
return to === undefined ? key : `${to}${key.slice(file.length)}`;
|
|
203
|
+
};
|
|
204
|
+
const sections = new Map(
|
|
205
|
+
[...this.sections].map(([rule, counts]) => {
|
|
206
|
+
const moved = new Map<string, number>();
|
|
207
|
+
for (const [key, count] of counts) {
|
|
208
|
+
const to = movedKey(key);
|
|
209
|
+
moved.set(to, Math.max(moved.get(to) ?? 0, count));
|
|
210
|
+
}
|
|
211
|
+
return [rule, moved];
|
|
212
|
+
}),
|
|
213
|
+
);
|
|
214
|
+
return new MaintainabilityBaseline(
|
|
215
|
+
sections,
|
|
216
|
+
new Map([...this.reasons].map(([key, reason]) => [movedKey(key), reason])),
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
197
220
|
tightenedBy(violations: MaintainabilityViolation[]) {
|
|
198
221
|
const current = MaintainabilityBaseline.of(violations);
|
|
199
222
|
const sections = new Map(
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
|
-
import { readFile, rm } from "node:fs/promises";
|
|
3
|
+
import { mkdir, readFile, rename, rm } from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
5
|
+
import { tempDirs, writeText } from "../test/testHelpers";
|
|
5
6
|
import { MaintainabilityBaseline } from "./maintainabilityBaseline";
|
|
6
7
|
import { MaintainabilityContract } from "./maintainabilityContract";
|
|
7
8
|
import { MaintainabilityLimits } from "./maintainabilityLimits";
|
|
8
|
-
import { tempDirs, writeText } from "./testHelpers";
|
|
9
9
|
|
|
10
10
|
const makeTempRoot = tempDirs("akan-maintainability-");
|
|
11
11
|
|
|
@@ -957,6 +957,86 @@ describe("MaintainabilityContract packages", () => {
|
|
|
957
957
|
" function: Split it by family into named functions or a collaborator class, each under the limit, keeping its signature for callers.",
|
|
958
958
|
);
|
|
959
959
|
});
|
|
960
|
+
|
|
961
|
+
test("keeps a moved file's entries under its new path, and still fails one that grew in the move", async () => {
|
|
962
|
+
const recordOf = (key: string, count: number, reason?: string) =>
|
|
963
|
+
`{\n "akan.size.function": {\n ${JSON.stringify(key)}: ${count}\n }${reason ? `,\n "reasons": {\n ${JSON.stringify(key)}: ${JSON.stringify(reason)}\n }` : ""}\n}\n`;
|
|
964
|
+
const reason = "boot reads every flag in one pass";
|
|
965
|
+
const root = await makeWorkspace({
|
|
966
|
+
"pkgs/@demo/core/server/host.ts": functionOf("boot", 200),
|
|
967
|
+
"pkgs/@demo/core/akan.baseline.json": recordOf("server/host.ts#boot", 200, reason),
|
|
968
|
+
});
|
|
969
|
+
await commitAll(root);
|
|
970
|
+
await mkdir(path.join(root, "pkgs/@demo/core/gateway"));
|
|
971
|
+
await git(root, "mv", "pkgs/@demo/core/server/host.ts", "pkgs/@demo/core/gateway/host.ts");
|
|
972
|
+
const baselinePath = path.join(root, "pkgs/@demo/core/akan.baseline.json");
|
|
973
|
+
|
|
974
|
+
expect(await packageOf(root).enforce({ fix: true })).toEqual([]);
|
|
975
|
+
expect(await readFile(baselinePath, "utf8")).toBe(recordOf("gateway/host.ts#boot", 200, reason));
|
|
976
|
+
|
|
977
|
+
expect(await packageOf(root).enforce({ fix: false })).toEqual([]);
|
|
978
|
+
|
|
979
|
+
await writeText(path.join(root, "pkgs/@demo/core/gateway/host.ts"), functionOf("boot", 210));
|
|
980
|
+
await writeText(baselinePath, recordOf("gateway/host.ts#boot", 210));
|
|
981
|
+
expect(await packageOf(root).enforce({ fix: false })).toMatchObject([
|
|
982
|
+
{ kind: "baselineGrowth", key: "gateway/host.ts#boot", count: 210, committed: 200 },
|
|
983
|
+
]);
|
|
984
|
+
});
|
|
985
|
+
|
|
986
|
+
test("follows a move git has not staged, without staging it, and reads an entry left at the old key as the reference's", async () => {
|
|
987
|
+
const recordOf = (key: string) => `{\n "akan.size.function": {\n ${JSON.stringify(key)}: 200\n }\n}\n`;
|
|
988
|
+
const root = await makeWorkspace({
|
|
989
|
+
"pkgs/@demo/core/server/host.ts": functionOf("boot", 200),
|
|
990
|
+
"pkgs/@demo/core/akan.baseline.json": recordOf("server/host.ts#boot"),
|
|
991
|
+
});
|
|
992
|
+
await commitAll(root);
|
|
993
|
+
await mkdir(path.join(root, "pkgs/@demo/core/gateway"));
|
|
994
|
+
await rename(path.join(root, "pkgs/@demo/core/server/host.ts"), path.join(root, "pkgs/@demo/core/gateway/host.ts"));
|
|
995
|
+
|
|
996
|
+
expect(await packageOf(root).enforce({ fix: false })).toMatchObject([
|
|
997
|
+
{ rule: "akan.size.function", key: "gateway/host.ts#boot" },
|
|
998
|
+
]);
|
|
999
|
+
expect(Bun.spawnSync(["git", "status", "--porcelain"], { cwd: root }).stdout.toString()).toBe(
|
|
1000
|
+
" D pkgs/@demo/core/server/host.ts\n?? pkgs/@demo/core/gateway/\n",
|
|
1001
|
+
);
|
|
1002
|
+
|
|
1003
|
+
await writeText(path.join(root, "pkgs/@demo/core/gateway/host.ts"), functionOf("boot", 120));
|
|
1004
|
+
expect(await packageOf(root).enforce({ fix: false })).toEqual([]);
|
|
1005
|
+
|
|
1006
|
+
await writeText(path.join(root, "pkgs/@demo/core/gateway/host.ts"), functionOf("boot", 200));
|
|
1007
|
+
expect(await packageOf(root).enforce({ fix: true })).toEqual([]);
|
|
1008
|
+
expect(await readFile(path.join(root, "pkgs/@demo/core/akan.baseline.json"), "utf8")).toBe(
|
|
1009
|
+
recordOf("gateway/host.ts#boot"),
|
|
1010
|
+
);
|
|
1011
|
+
});
|
|
1012
|
+
|
|
1013
|
+
test("still reads a staged move where it cannot stage, and stores no untracked file but a source", async () => {
|
|
1014
|
+
const recordOf = (key: string) => `{\n "akan.size.function": {\n ${JSON.stringify(key)}: 200\n }\n}\n`;
|
|
1015
|
+
const root = await makeWorkspace({
|
|
1016
|
+
"pkgs/@demo/core/server/host.ts": functionOf("boot", 200),
|
|
1017
|
+
"pkgs/@demo/core/akan.baseline.json": recordOf("server/host.ts#boot"),
|
|
1018
|
+
});
|
|
1019
|
+
await commitAll(root);
|
|
1020
|
+
await mkdir(path.join(root, "pkgs/@demo/core/gateway"));
|
|
1021
|
+
await git(root, "mv", "pkgs/@demo/core/server/host.ts", "pkgs/@demo/core/gateway/host.ts");
|
|
1022
|
+
await writeText(path.join(root, "pkgs/@demo/core/local.db"), "rows that change on every run");
|
|
1023
|
+
|
|
1024
|
+
const tmpdirBefore = process.env.TMPDIR;
|
|
1025
|
+
process.env.TMPDIR = path.join(root, "missing-tmp");
|
|
1026
|
+
try {
|
|
1027
|
+
expect(await packageOf(root).enforce({ fix: true })).toEqual([]);
|
|
1028
|
+
} finally {
|
|
1029
|
+
if (tmpdirBefore === undefined) delete process.env.TMPDIR;
|
|
1030
|
+
else process.env.TMPDIR = tmpdirBefore;
|
|
1031
|
+
}
|
|
1032
|
+
expect(await readFile(path.join(root, "pkgs/@demo/core/akan.baseline.json"), "utf8")).toBe(
|
|
1033
|
+
recordOf("gateway/host.ts#boot"),
|
|
1034
|
+
);
|
|
1035
|
+
|
|
1036
|
+
expect(await packageOf(root).enforce({ fix: false })).toEqual([]);
|
|
1037
|
+
const hash = Bun.spawnSync(["git", "hash-object", "pkgs/@demo/core/local.db"], { cwd: root }).stdout.toString();
|
|
1038
|
+
expect(Bun.spawnSync(["git", "cat-file", "-e", hash.trim()], { cwd: root }).exitCode).not.toBe(0);
|
|
1039
|
+
});
|
|
960
1040
|
});
|
|
961
1041
|
|
|
962
1042
|
describe("MaintainabilityContract bare errors", () => {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
-
import { readFile, rm, writeFile } from "node:fs/promises";
|
|
2
|
+
import { copyFile, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
3
4
|
import path from "node:path";
|
|
4
5
|
import ts from "typescript";
|
|
6
|
+
import { GitRevision } from "../workspace/gitRevision";
|
|
5
7
|
import { BareErrorScanner } from "./bareErrorScanner";
|
|
6
8
|
import { ComponentSizeScanner } from "./componentSizeScanner";
|
|
7
9
|
import { ComponentWriteChainScanner } from "./componentWriteChainScanner";
|
|
8
10
|
import { EndpointReach } from "./endpointReach";
|
|
9
|
-
import { GitRevision } from "./gitRevision";
|
|
10
11
|
import { MaintainabilityBaseline } from "./maintainabilityBaseline";
|
|
11
12
|
import { MaintainabilityLimits } from "./maintainabilityLimits";
|
|
12
13
|
import { MaintainabilityReport } from "./maintainabilityReport";
|
|
@@ -199,10 +200,12 @@ export class MaintainabilityContract {
|
|
|
199
200
|
this.#readBaseline(),
|
|
200
201
|
this.#readReferenceBaseline(),
|
|
201
202
|
]);
|
|
202
|
-
const
|
|
203
|
+
const moves = await this.#movesSince(reference.ref);
|
|
204
|
+
const onDisk =
|
|
203
205
|
existing === null ? new MaintainabilityBaseline() : MaintainabilityBaseline.parse(existing, this.baselinePath);
|
|
206
|
+
const baseline = fix ? onDisk.movedBy(moves) : onDisk;
|
|
204
207
|
const tightened = baseline.tightenedBy(violations);
|
|
205
|
-
if (fix && existing !== null) await this.#tighten(
|
|
208
|
+
if (fix && existing !== null) await this.#tighten(onDisk, tightened);
|
|
206
209
|
//? Without fix the file on disk is what merges, so an entry it holds above the measured count is checked as written.
|
|
207
210
|
const working = fix ? tightened : baseline;
|
|
208
211
|
const lines = ((await this.#readBaseline()) ?? "").split(/\r?\n/);
|
|
@@ -229,8 +232,9 @@ export class MaintainabilityContract {
|
|
|
229
232
|
const unrecorded = new Set(working.rulesOutside(recorded));
|
|
230
233
|
const measured = unrecorded.size ? await this.#measuredAt(reference.ref) : null;
|
|
231
234
|
if (recorded === null && measured === null) return failures;
|
|
232
|
-
const committed = (recorded ?? new MaintainabilityBaseline()).withSectionsOf(measured, unrecorded);
|
|
233
|
-
|
|
235
|
+
const committed = (recorded ?? new MaintainabilityBaseline()).withSectionsOf(measured, unrecorded).movedBy(moves);
|
|
236
|
+
//? Without fix the entries on disk keep their old keys, so they are compared under the moved ones the reference took.
|
|
237
|
+
const growths = (fix ? working : working.movedBy(moves))
|
|
234
238
|
.grownFrom(committed)
|
|
235
239
|
.map(
|
|
236
240
|
({ rule, ...growth }): BaselineGrowth => ({
|
|
@@ -519,6 +523,53 @@ export class MaintainabilityContract {
|
|
|
519
523
|
return "HEAD";
|
|
520
524
|
}
|
|
521
525
|
|
|
526
|
+
//? A move that also rewrote more than half the file, or left a file at the old path, reads as an add and fails as new.
|
|
527
|
+
async #movesSince(ref: string) {
|
|
528
|
+
const staged = await this.#stagedScope();
|
|
529
|
+
try {
|
|
530
|
+
const diff = ["diff", ...(staged ? ["--cached"] : []), "--relative", "--name-status", "-z", "-M", ref];
|
|
531
|
+
const fields = (await this.#git([...diff, "--", this.sysPath], staged?.env))?.split("\0") ?? [];
|
|
532
|
+
const prefix = `${this.sysPath}/`;
|
|
533
|
+
const moves = new Map<string, string>();
|
|
534
|
+
for (let idx = 0; idx < fields.length; idx += fields[idx]?.startsWith("R") ? 3 : 2) {
|
|
535
|
+
const [from, to] = [fields[idx + 1], fields[idx + 2]];
|
|
536
|
+
if (!fields[idx]?.startsWith("R") || !from?.startsWith(prefix) || !to?.startsWith(prefix)) continue;
|
|
537
|
+
moves.set(from.slice(prefix.length), to.slice(prefix.length));
|
|
538
|
+
}
|
|
539
|
+
return moves;
|
|
540
|
+
} finally {
|
|
541
|
+
if (staged) await rm(staged.dir, { recursive: true, force: true });
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
//? Git pairs moves only between staged paths, so a plain rename is staged too, in a copy of the user's index.
|
|
546
|
+
async #stagedScope() {
|
|
547
|
+
const indexPath = (await this.#git(["rev-parse", "--git-path", "index"]))?.trim();
|
|
548
|
+
//? Only sources: staging writes each file into .git/objects, where a local database or a log would pile up.
|
|
549
|
+
const untracked = (await this.#git(["ls-files", "-o", "--exclude-standard", "-z", "--", this.sysPath]))
|
|
550
|
+
?.split("\0")
|
|
551
|
+
.filter((file) => /\.(tsx?|md)$/.test(file));
|
|
552
|
+
if (!indexPath || !untracked) return null;
|
|
553
|
+
const dir = await mkdtemp(path.join(tmpdir(), "akan-moves-")).catch(() => null);
|
|
554
|
+
if (!dir) return null;
|
|
555
|
+
const env = { GIT_INDEX_FILE: path.join(dir, "index") };
|
|
556
|
+
const listPath = path.join(dir, "untracked");
|
|
557
|
+
try {
|
|
558
|
+
const indexFile = path.resolve(this.#workspaceRoot, indexPath);
|
|
559
|
+
if (existsSync(indexFile)) await copyFile(indexFile, env.GIT_INDEX_FILE);
|
|
560
|
+
await writeFile(listPath, untracked.join("\0"));
|
|
561
|
+
const added =
|
|
562
|
+
(await this.#git(["add", "-u", "--", this.sysPath], env)) !== null &&
|
|
563
|
+
(!untracked.length ||
|
|
564
|
+
(await this.#git(["add", "--pathspec-from-file", listPath, "--pathspec-file-nul"], env)) !== null);
|
|
565
|
+
if (added) return { dir, env };
|
|
566
|
+
} catch {
|
|
567
|
+
//? A full or read-only temp dir: fall back to the moves the user's own index holds.
|
|
568
|
+
}
|
|
569
|
+
await rm(dir, { recursive: true, force: true });
|
|
570
|
+
return null;
|
|
571
|
+
}
|
|
572
|
+
|
|
522
573
|
static #missingHistory(sysPath: string, cause: string) {
|
|
523
574
|
return (
|
|
524
575
|
`${sysPath}/${MaintainabilityBaseline.fileName} is compared with its copy where this branch forked from the default branch, ` +
|
|
@@ -526,9 +577,15 @@ export class MaintainabilityContract {
|
|
|
526
577
|
);
|
|
527
578
|
}
|
|
528
579
|
|
|
529
|
-
|
|
580
|
+
//? GIT_OPTIONAL_LOCKS=0 keeps a read from refreshing the index under the user's own git, which would then fail on index.lock.
|
|
581
|
+
async #git(args: string[], env: Record<string, string> = {}) {
|
|
530
582
|
try {
|
|
531
|
-
const proc = Bun.spawn(["git", ...args], {
|
|
583
|
+
const proc = Bun.spawn(["git", ...args], {
|
|
584
|
+
cwd: this.#workspaceRoot,
|
|
585
|
+
env: { ...process.env, GIT_OPTIONAL_LOCKS: "0", ...env },
|
|
586
|
+
stdout: "pipe",
|
|
587
|
+
stderr: "ignore",
|
|
588
|
+
});
|
|
532
589
|
const [text, exitCode] = await Promise.all([new Response(proc.stdout).text(), proc.exited]);
|
|
533
590
|
return exitCode === 0 ? text : null;
|
|
534
591
|
} catch {
|
package/{maintainabilityExceptionScanner.test.ts → quality/maintainabilityExceptionScanner.test.ts}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { tempDirs, writeText } from "../test/testHelpers";
|
|
3
4
|
import { MaintainabilityExceptionScanner } from "./maintainabilityExceptionScanner";
|
|
4
|
-
import { tempDirs, writeText } from "./testHelpers";
|
|
5
5
|
|
|
6
6
|
const makeTempRoot = tempDirs("akan-maintainability-exceptions-");
|
|
7
7
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { tempDirs, writeText } from "../test/testHelpers";
|
|
3
4
|
import { AbstractDoc } from "./abstractDoc";
|
|
4
5
|
import { AkanQualityScanner, type QualityScanResult } from "./qualityScanner";
|
|
5
|
-
import { tempDirs, writeText } from "./testHelpers";
|
|
6
6
|
|
|
7
7
|
const makeTempRoot = tempDirs("akan-quality-scanner-");
|
|
8
8
|
|
|
@@ -4,6 +4,14 @@ import path from "node:path";
|
|
|
4
4
|
import { RESERVED_ROUTE_CONFIG_EXPORTS } from "akanjs/common";
|
|
5
5
|
import ignore from "ignore";
|
|
6
6
|
import ts from "typescript";
|
|
7
|
+
import {
|
|
8
|
+
facetIndexShadowOf,
|
|
9
|
+
isAllowedLibFacetRootFile,
|
|
10
|
+
libFacetRootHintOf,
|
|
11
|
+
rootAllowedDirs,
|
|
12
|
+
rootAllowedFiles,
|
|
13
|
+
rootEntryHintOf,
|
|
14
|
+
} from "../workspace/workspaceLayout";
|
|
7
15
|
import { AbstractDoc } from "./abstractDoc";
|
|
8
16
|
import { CommentDensityScanner } from "./commentDensityScanner";
|
|
9
17
|
import { DeprecatedCommentScanner } from "./deprecatedCommentScanner";
|
|
@@ -12,14 +20,6 @@ import { KindBranchScanner } from "./kindBranchScanner";
|
|
|
12
20
|
import { MaintainabilityExceptionScanner } from "./maintainabilityExceptionScanner";
|
|
13
21
|
import { fileWarning, formatSsrBalance, type SsrBalanceEntry, SsrScanner } from "./ssrScanner";
|
|
14
22
|
import { TestOnlyExportScanner } from "./testOnlyExportScanner";
|
|
15
|
-
import {
|
|
16
|
-
facetIndexShadowOf,
|
|
17
|
-
isAllowedLibFacetRootFile,
|
|
18
|
-
libFacetRootHintOf,
|
|
19
|
-
rootAllowedDirs,
|
|
20
|
-
rootAllowedFiles,
|
|
21
|
-
rootEntryHintOf,
|
|
22
|
-
} from "./workspaceLayout";
|
|
23
23
|
|
|
24
24
|
type QualitySeverity = "warning";
|
|
25
25
|
type QualityScope = "global" | "file" | "convention" | "layout" | "ssr" | "agent" | "comment";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { describe, expect, setDefaultTimeout, test } from "bun:test";
|
|
2
2
|
import { mkdir, readdir, rm } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { Executor, WorkspaceExecutor } from "
|
|
5
|
-
import {
|
|
4
|
+
import { Executor, WorkspaceExecutor } from "../executors";
|
|
5
|
+
import { isolateEnv, tempDirs, writeText as write } from "../test/testHelpers";
|
|
6
|
+
import { FileSys } from "../util/fileSys";
|
|
6
7
|
import { Subspace } from "./subspace";
|
|
7
8
|
import { SubspaceClone } from "./subspaceClone";
|
|
8
9
|
import { SubspaceConfig } from "./subspaceConfig";
|
|
9
10
|
import { SubspaceReport } from "./subspaceReport";
|
|
10
|
-
import { isolateEnv, tempDirs, writeText as write } from "./testHelpers";
|
|
11
11
|
|
|
12
12
|
//? Each case drives several real git clones and pushes; on a 4-core Windows VM that alone lands at 2-5s.
|
|
13
13
|
setDefaultTimeout(20_000);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { mkdir } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { toError } from "akanjs/common";
|
|
4
|
-
import { AppExecutor, type WorkspaceExecutor } from "
|
|
5
|
-
import { FileSys } from "
|
|
6
|
-
import { LibSource } from "
|
|
7
|
-
import { SlicePlanner } from "
|
|
4
|
+
import { AppExecutor, type WorkspaceExecutor } from "../executors";
|
|
5
|
+
import { FileSys } from "../util/fileSys";
|
|
6
|
+
import { LibSource } from "../workspace/libSource";
|
|
7
|
+
import { SlicePlanner } from "../workspace/slicePlanner";
|
|
8
8
|
import { SubspaceClone } from "./subspaceClone";
|
|
9
9
|
import type { SubspaceConfig, SubspaceDeclaration } from "./subspaceConfig";
|
|
10
10
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { mkdir, readdir, rename, rm } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { toError } from "akanjs/common";
|
|
4
|
-
import { Executor, WorkspaceExecutor } from "
|
|
5
|
-
import { FileSys } from "
|
|
6
|
-
import { LibSource } from "
|
|
7
|
-
import { type SlicePlan, SlicePlanner } from "
|
|
4
|
+
import { Executor, WorkspaceExecutor } from "../executors";
|
|
5
|
+
import { FileSys } from "../util/fileSys";
|
|
6
|
+
import { LibSource } from "../workspace/libSource";
|
|
7
|
+
import { type SlicePlan, SlicePlanner } from "../workspace/slicePlanner";
|
|
8
|
+
import type { PackageJson } from "../workspace/types";
|
|
8
9
|
import { SubspaceConfig, type SubspaceDeclaration } from "./subspaceConfig";
|
|
9
|
-
import type { PackageJson } from "./types";
|
|
10
10
|
|
|
11
11
|
export class SubspaceClone {
|
|
12
12
|
static readonly anchorFile = "akan.subspace.json";
|
|
@@ -129,7 +129,7 @@ export const writeJson = async (filePath: string, value: object) => {
|
|
|
129
129
|
await writeText(filePath, `${JSON.stringify(value, null, 2)}\n`);
|
|
130
130
|
};
|
|
131
131
|
|
|
132
|
-
const repoRoot = path.resolve(import.meta.dir, "
|
|
132
|
+
const repoRoot = path.resolve(import.meta.dir, "../../../..");
|
|
133
133
|
const biomeBin = path.join(repoRoot, "node_modules", ".bin", process.platform === "win32" ? "biome.exe" : "biome");
|
|
134
134
|
export const hasBiome = existsSync(biomeBin);
|
|
135
135
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import { realpathSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { tempDirs, writeText } from "../testHelpers";
|
|
4
|
+
import { tempDirs, writeText } from "../test/testHelpers";
|
|
5
5
|
import { createBrowserDirnamePlugin } from "./browserDirnamePlugin";
|
|
6
6
|
|
|
7
7
|
const makeTempRoot = tempDirs("akan-devkit-browser-dirname-");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { tempDirs, writeText as write } from "../testHelpers";
|
|
3
|
+
import { tempDirs, writeText as write } from "../test/testHelpers";
|
|
4
4
|
import { createExternalizeFrameworkPlugin } from "./externalizeFrameworkPlugin";
|
|
5
5
|
|
|
6
6
|
const makeTempRoot = tempDirs("akan-devkit-externalize-");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import { symlink } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { tempDirs, writeText } from "../testHelpers";
|
|
4
|
+
import { tempDirs, writeText } from "../test/testHelpers";
|
|
5
5
|
import { createBarrelImportsPlugin } from "./barrelImportsPlugin";
|
|
6
6
|
import { McpAppPageTrimmer } from "./mcpAppPageTrimmer";
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { tempDirs, writeText } from "../testHelpers";
|
|
3
|
+
import { tempDirs, writeText } from "../test/testHelpers";
|
|
4
4
|
import { PureLazyMarker } from "./pureLazyMarker";
|
|
5
5
|
|
|
6
6
|
const makeTempRoot = tempDirs("akan-pure-lazy-");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { tempDirs, writeText as write } from "../testHelpers";
|
|
3
|
+
import { tempDirs, writeText as write } from "../test/testHelpers";
|
|
4
4
|
import { createServerEnvPlugin } from "./serverEnvPlugin";
|
|
5
5
|
|
|
6
6
|
const makeTempRoot = tempDirs("akan-devkit-server-env-");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { Logger } from "akanjs/common";
|
|
4
|
-
import { tempDirs, writeText as write } from "../testHelpers";
|
|
4
|
+
import { tempDirs, writeText as write } from "../test/testHelpers";
|
|
5
5
|
import { ServerEnvProfile } from "./serverEnvProfile";
|
|
6
6
|
|
|
7
7
|
const makeTempRoot = tempDirs("akan-devkit-server-env-profile-");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { tempDirs, writeText } from "../testHelpers";
|
|
3
|
+
import { tempDirs, writeText } from "../test/testHelpers";
|
|
4
4
|
import { SideEffectImportOrder } from "./sideEffectImportOrder";
|
|
5
5
|
|
|
6
6
|
const makeTempRoot = tempDirs("akan-devkit-side-effect-order-");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { ApplicationBuildReporter } from "../applicationBuildReporter";
|
|
5
|
-
import { tempDirs, writeText as write } from "../testHelpers";
|
|
4
|
+
import { ApplicationBuildReporter } from "../app/applicationBuildReporter";
|
|
5
|
+
import { tempDirs, writeText as write } from "../test/testHelpers";
|
|
6
6
|
import { BarrelAnalyzer, type BarrelExportTarget } from "./barrelAnalyzer";
|
|
7
7
|
import { createTsconfigPackageResolver, rewriteBarrelImports } from "./barrelImportsPlugin";
|
|
8
8
|
import {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { tempDirs } from "../testHelpers";
|
|
4
|
+
import { tempDirs } from "../test/testHelpers";
|
|
5
5
|
import { createTsconfigPackageResolver } from "./barrelImportsPlugin";
|
|
6
6
|
|
|
7
7
|
const makeTempRoot = tempDirs("akan-devkit-resolver-");
|
|
@@ -3,9 +3,9 @@ import { readFile, stat, writeFile } from "node:fs/promises";
|
|
|
3
3
|
import type { AddressInfo } from "node:net";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { Client, type Connection, Server, utils } from "ssh2";
|
|
6
|
+
import { createTempApp, isolateEnv, tempRoots } from "../test/testHelpers";
|
|
6
7
|
import { createTunnel } from "./createTunnel";
|
|
7
8
|
import { SshHostKeys } from "./sshHostKeys";
|
|
8
|
-
import { createTempApp, isolateEnv, tempRoots } from "./testHelpers";
|
|
9
9
|
|
|
10
10
|
const freePort = () => {
|
|
11
11
|
const listener = Bun.listen({ hostname: "127.0.0.1", port: 0, socket: { data() {} } });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import type { ConnectConfig } from "ssh2";
|
|
3
|
-
import { type AppExecutor, WorkspaceExecutor } from "
|
|
4
|
-
import { ShellOnlyEnv } from "
|
|
3
|
+
import { type AppExecutor, WorkspaceExecutor } from "../executors";
|
|
4
|
+
import { ShellOnlyEnv } from "../util/shellOnlyEnv";
|
|
5
5
|
import { SshHostKeys } from "./sshHostKeys";
|
|
6
6
|
import { createSshTunnel } from "./sshTunnel";
|
|
7
7
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { ConfigLock } from "
|
|
5
|
-
import { FileSys } from "
|
|
4
|
+
import { ConfigLock } from "../cloud/configLock";
|
|
5
|
+
import { FileSys } from "../util/fileSys";
|
|
6
6
|
|
|
7
7
|
type KnownHosts = Record<string, string>;
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { tempDirs, writeText as write } from "../testHelpers";
|
|
3
|
+
import { tempDirs, writeText as write } from "../test/testHelpers";
|
|
4
4
|
import { ProjectTypecheck } from "./projectTypecheck";
|
|
5
5
|
import { TypecheckFailure } from "./typecheckFailure";
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mkdir, rm } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { CliError } from "../commandDecorators/cliError";
|
|
4
|
-
import type { TypecheckRecord } from "
|
|
4
|
+
import type { TypecheckRecord } from "./typeChecker";
|
|
5
5
|
import { TypecheckFailure } from "./typecheckFailure";
|
|
6
6
|
|
|
7
7
|
export interface ProjectTypecheckOptions {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import * as ts from "typescript";
|
|
4
|
-
import { tempDirs, writeJson, writeText } from "
|
|
4
|
+
import { tempDirs, writeJson, writeText } from "../test/testHelpers";
|
|
5
5
|
import { TypeChecker } from "./typeChecker";
|
|
6
6
|
|
|
7
7
|
const makeTempRoot = tempDirs("akan-devkit-type-checker-");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CliError } from "../commandDecorators/cliError";
|
|
2
|
-
import type { TypecheckRecord } from "
|
|
2
|
+
import type { TypecheckRecord } from "./typeChecker";
|
|
3
3
|
|
|
4
4
|
export class TypecheckFailure extends CliError<"checkFailed"> {
|
|
5
5
|
//? The worker's exit when the project has type errors, so its crash, which exits 1, is told apart.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { formatWithBiome, hasBiome } from "../test/testHelpers";
|
|
2
3
|
import { JsonFormatter } from "./jsonFormatter";
|
|
3
|
-
import { formatWithBiome, hasBiome } from "./testHelpers";
|
|
4
4
|
|
|
5
5
|
const pad = (length: number) => "x".repeat(length);
|
|
6
6
|
const thousands = Array.from({ length: 40 }, (_, idx) => idx * 1000);
|
package/workflow/executor.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { capitalize } from "akanjs/common";
|
|
2
2
|
import ts from "typescript";
|
|
3
|
-
import type { AkanModuleContext } from "../akanContext";
|
|
4
3
|
import type { Sys, Workspace } from "../commandDecorators";
|
|
4
|
+
import type { AkanModuleContext } from "../context/akanContext";
|
|
5
5
|
import { AppExecutor, LibExecutor } from "../executors";
|
|
6
6
|
import { createWorkflowApplyReport, workflowCommandsForPlan } from "./artifacts";
|
|
7
7
|
import { buildAkanModuleContextIndex } from "./moduleIndex";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { createTempApp, tempRoots, writeJson, writeText } from "../testHelpers";
|
|
3
|
+
import { createTempApp, tempRoots, writeJson, writeText } from "../test/testHelpers";
|
|
4
4
|
import { GuardCatalog } from "./guardCatalog";
|
|
5
5
|
|
|
6
6
|
const track = tempRoots();
|