@codefast/cli 0.3.16-canary.3 → 0.4.0-canary.4
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/README.md +69 -62
- package/dist/arrange/analyze.mjs +2 -2
- package/dist/arrange/command.mjs +51 -27
- package/dist/arrange/domain/analyze-service.mjs +2 -2
- package/dist/arrange/domain/ast/collectors-cn.mjs +1 -1
- package/dist/arrange/domain/ast/collectors-tv.mjs +2 -2
- package/dist/arrange/domain/ast/helpers.mjs +2 -2
- package/dist/arrange/domain/ast/simplify-targets.mjs +109 -0
- package/dist/arrange/domain/ast/targets.mjs +25 -10
- package/dist/arrange/domain/grouping-service.mjs +1 -1
- package/dist/arrange/domain/grouping.mjs +5 -5
- package/dist/arrange/domain/imports.mjs +50 -2
- package/dist/arrange/domain/token-classifier.mjs +12 -12
- package/dist/arrange/output.mjs +11 -3
- package/dist/arrange/process-file.mjs +1 -1
- package/dist/arrange/scan-target.mjs +10 -1
- package/dist/arrange/simplify-process-file.mjs +35 -0
- package/dist/arrange/simplify-sync.mjs +32 -0
- package/dist/arrange/suggest.mjs +1 -1
- package/dist/arrange/sync.mjs +1 -1
- package/dist/arrange/workspace.mjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/core/cli/result-handle.mjs +1 -1
- package/dist/core/source-text-edit.mjs +1 -1
- package/dist/core/workspace/resolver.mjs +3 -3
- package/dist/mirror/cli-result.mjs +2 -1
- package/dist/mirror/cli-schema.mjs +2 -1
- package/dist/mirror/command.mjs +12 -11
- package/dist/mirror/domain/exports.mjs +2 -2
- package/dist/mirror/output.mjs +3 -0
- package/dist/mirror/supplement-exports.mjs +2 -2
- package/dist/mirror/sync-reporter.mjs +4 -1
- package/dist/mirror/sync-workspace-package.mjs +4 -4
- package/dist/mirror/sync.mjs +2 -1
- package/dist/mirror/write-exports.mjs +3 -2
- package/dist/tag/command.mjs +6 -6
- package/dist/tag/output.mjs +1 -1
- package/dist/tag/sync.mjs +1 -1
- package/dist/tag/target-runner.mjs +1 -1
- package/package.json +9 -9
|
@@ -8,7 +8,7 @@ import { MirrorError, MirrorErrorCode } from "./domain/errors.mjs";
|
|
|
8
8
|
*
|
|
9
9
|
* @since 0.3.16-canary.0
|
|
10
10
|
*/
|
|
11
|
-
async function writePackageJsonExportsAtomic(fs, packageJsonPath, mergeInput) {
|
|
11
|
+
async function writePackageJsonExportsAtomic(fs, packageJsonPath, mergeInput, write = true) {
|
|
12
12
|
function containsDistTarget(value) {
|
|
13
13
|
if (typeof value === "string") return value.startsWith("./dist/");
|
|
14
14
|
if (Array.isArray(value)) return value.some((entryValue) => containsDistTarget(entryValue));
|
|
@@ -76,7 +76,8 @@ async function writePackageJsonExportsAtomic(fs, packageJsonPath, mergeInput) {
|
|
|
76
76
|
} else packageJson.files = ["dist"];
|
|
77
77
|
const sortedExportMap = {};
|
|
78
78
|
const hasCatchAllWildcard = "./*" in mergedExportMap;
|
|
79
|
-
for (const exportSpecifier of Object.keys(mergedExportMap).
|
|
79
|
+
for (const exportSpecifier of Object.keys(mergedExportMap).toSorted((leftSpecifier, rightSpecifier) => compareExportSpecifiers(leftSpecifier, rightSpecifier, originalPathBySpecifier, hasCatchAllWildcard))) sortedExportMap[exportSpecifier] = mergedExportMap[exportSpecifier];
|
|
80
|
+
if (!write) return { prunedKeys };
|
|
80
81
|
packageJson.exports = sortedExportMap;
|
|
81
82
|
const serialized = JSON.stringify(packageJson, null, 2) + "\n";
|
|
82
83
|
const tmpPath = `${packageJsonPath}.tmp`;
|
package/dist/tag/command.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { parseWithSchema } from "../core/schema-parse.mjs";
|
|
2
1
|
import { logger } from "../core/logger.mjs";
|
|
2
|
+
import { readOptionalPositionalArg } from "../core/cli/positional.mjs";
|
|
3
3
|
import { consumeCliAppError } from "../core/cli/result-handle.mjs";
|
|
4
4
|
import { nodeFilesystem } from "../core/filesystem/node.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import { prepareTagSync } from "./prepare.mjs";
|
|
7
|
-
import { runTagSync } from "./sync.mjs";
|
|
8
|
-
import { tagSyncRunRequestSchema } from "./cli-schema.mjs";
|
|
5
|
+
import { parseWithSchema } from "../core/schema-parse.mjs";
|
|
9
6
|
import { exitCodeForTagSyncResult } from "./cli-result.mjs";
|
|
7
|
+
import { tagSyncRunRequestSchema } from "./cli-schema.mjs";
|
|
10
8
|
import { TagSyncProgressPresenter, presentTagSyncResult } from "./output.mjs";
|
|
9
|
+
import { prepareTagSync } from "./prepare.mjs";
|
|
10
|
+
import { runTagSync } from "./sync.mjs";
|
|
11
11
|
import process from "node:process";
|
|
12
12
|
import { Command } from "commander";
|
|
13
13
|
//#region src/tag/command.ts
|
|
@@ -15,7 +15,7 @@ import { Command } from "commander";
|
|
|
15
15
|
* @since 0.3.16-canary.0
|
|
16
16
|
*/
|
|
17
17
|
function createTagCommand() {
|
|
18
|
-
return new Command("tag").description("Add @since <version> JSDoc tags to exported declarations").
|
|
18
|
+
return new Command("tag").description("Add @since <version> JSDoc tags to exported declarations").argument("[target]", "Directory or file to tag (default: auto-discover workspace packages)").option("--dry-run", "Show summary without writing files", false).option("--json", "Print one JSON summary on stdout (suppresses human progress)", false).action(async (target, opts) => {
|
|
19
19
|
const prelude = await prepareTagSync(nodeFilesystem, {
|
|
20
20
|
currentWorkingDirectory: process.cwd(),
|
|
21
21
|
rawTarget: readOptionalPositionalArg(target)
|
package/dist/tag/output.mjs
CHANGED
package/dist/tag/sync.mjs
CHANGED
|
@@ -20,7 +20,7 @@ async function runTagSync(fs, input) {
|
|
|
20
20
|
const modifiedFiles = allFileResults.filter((entry) => entry.changed).map((entry) => entry.filePath);
|
|
21
21
|
const hookError = input.write && modifiedFiles.length > 0 ? await runTagOnAfterWriteHook(tagConfig?.onAfterWrite, modifiedFiles) : null;
|
|
22
22
|
const versionsSet = extractDistinctVersions(targetExecutionResults);
|
|
23
|
-
const distinctVersions = [...versionsSet].
|
|
23
|
+
const distinctVersions = [...versionsSet].toSorted((left, right) => left.localeCompare(right));
|
|
24
24
|
return ok({
|
|
25
25
|
mode: input.write ? "applied" : "dry-run",
|
|
26
26
|
selectedTargets,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { walkTsxFiles } from "../core/workspace/typescript-walk.mjs";
|
|
2
|
-
import { resolveNearestPackageVersion } from "./version-resolver.mjs";
|
|
3
2
|
import { TagSinceWriter } from "./since-writer.mjs";
|
|
3
|
+
import { resolveNearestPackageVersion } from "./version-resolver.mjs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
//#region src/tag/target-runner.ts
|
|
6
6
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codefast/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-canary.4",
|
|
4
4
|
"description": "Developer CLI for the Codefast monorepo (arrange, mirror, tag)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"commander": "^
|
|
54
|
+
"commander": "^15.0.0",
|
|
55
55
|
"jiti": "^2.7.0",
|
|
56
56
|
"picomatch": "^4.0.4",
|
|
57
57
|
"typescript": "^6.0.3",
|
|
@@ -59,14 +59,14 @@
|
|
|
59
59
|
"zod": "^4.4.3"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@types/node": "^25.9.
|
|
62
|
+
"@types/node": "^25.9.2",
|
|
63
63
|
"@types/picomatch": "^4.0.3",
|
|
64
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
65
|
-
"@vitest/coverage-v8": "^4.1.
|
|
66
|
-
"tsdown": "^0.22.
|
|
67
|
-
"vite": "^8.0.
|
|
68
|
-
"vitest": "^4.1.
|
|
69
|
-
"@codefast/typescript-config": "0.
|
|
64
|
+
"@typescript/native-preview": "7.0.0-dev.20260604.1",
|
|
65
|
+
"@vitest/coverage-v8": "^4.1.8",
|
|
66
|
+
"tsdown": "^0.22.2",
|
|
67
|
+
"vite": "^8.0.16",
|
|
68
|
+
"vitest": "^4.1.8",
|
|
69
|
+
"@codefast/typescript-config": "0.4.0-canary.4"
|
|
70
70
|
},
|
|
71
71
|
"engines": {
|
|
72
72
|
"node": ">=24.0.0"
|