@codefast/cli 0.10.0 → 0.12.0
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 +84 -0
- package/README.md +66 -41
- package/dist/arrange/command.js +99 -136
- package/dist/arrange/domain/ast/collectors-cn.d.ts +2 -2
- package/dist/arrange/domain/ast/collectors-cn.js +2 -2
- package/dist/arrange/domain/ast/collectors-jsx.d.ts +2 -2
- package/dist/arrange/domain/ast/collectors-jsx.js +1 -1
- package/dist/arrange/domain/ast/collectors-tv.d.ts +2 -2
- package/dist/arrange/domain/ast/collectors-tv.js +5 -5
- package/dist/arrange/domain/ast/helpers.d.ts +2 -2
- package/dist/arrange/domain/ast/helpers.js +3 -4
- package/dist/arrange/domain/ast/simplify-targets.d.ts +1 -1
- package/dist/arrange/domain/ast/simplify-targets.js +23 -28
- package/dist/arrange/domain/ast/targets.d.ts +2 -2
- package/dist/arrange/domain/ast/targets.js +9 -9
- package/dist/arrange/{typescript-ast-translator.d.ts → domain/ast/translator.d.ts} +6 -5
- package/dist/arrange/{typescript-ast-translator.js → domain/ast/translator.js} +20 -23
- package/dist/arrange/domain/constants.d.ts +1 -1
- package/dist/arrange/domain/grouping-service.d.ts +2 -2
- package/dist/arrange/domain/grouping-service.js +3 -3
- package/dist/arrange/domain/grouping.js +3 -3
- package/dist/arrange/domain/imports.d.ts +1 -1
- package/dist/arrange/domain/imports.js +2 -2
- package/dist/arrange/domain/source-text-formatters.js +1 -1
- package/dist/arrange/domain/tailwind-token.js +1 -1
- package/dist/arrange/domain/token-classifier.d.ts +1 -1
- package/dist/arrange/domain/token-classifier.js +2 -2
- package/dist/arrange/domain/types.d.ts +3 -3
- package/dist/arrange/group/cli-result.d.ts +7 -0
- package/dist/arrange/group/cli-result.js +12 -0
- package/dist/arrange/group/cli-schema.d.ts +17 -0
- package/dist/arrange/group/cli-schema.js +13 -0
- package/dist/arrange/group/output.d.ts +7 -0
- package/dist/arrange/group/output.js +10 -0
- package/dist/arrange/group/suggest.d.ts +8 -0
- package/dist/arrange/{suggest.js → group/suggest.js} +2 -2
- package/dist/arrange/inspect/cli-result.d.ts +7 -0
- package/dist/arrange/inspect/cli-result.js +8 -0
- package/dist/arrange/inspect/cli-schema.d.ts +15 -0
- package/dist/arrange/inspect/cli-schema.js +9 -0
- package/dist/arrange/{domain → inspect/domain}/analyze-service.d.ts +2 -2
- package/dist/arrange/{domain → inspect/domain}/analyze-service.js +7 -7
- package/dist/arrange/inspect/output.d.ts +7 -0
- package/dist/arrange/inspect/output.js +42 -0
- package/dist/arrange/inspect/run.d.ts +10 -0
- package/dist/arrange/{analyze.js → inspect/run.js} +7 -7
- package/dist/arrange/prepare.d.ts +13 -0
- package/dist/arrange/{workspace.js → prepare.js} +9 -12
- package/dist/arrange/regroup/cli-result.d.ts +13 -0
- package/dist/arrange/regroup/cli-result.js +23 -0
- package/dist/arrange/regroup/cli-schema.d.ts +20 -0
- package/dist/arrange/regroup/cli-schema.js +14 -0
- package/dist/arrange/regroup/output.d.ts +14 -0
- package/dist/arrange/regroup/output.js +72 -0
- package/dist/arrange/{process-file.d.ts → regroup/process-file.d.ts} +3 -3
- package/dist/arrange/{process-file.js → regroup/process-file.js} +3 -3
- package/dist/arrange/regroup/run.d.ts +11 -0
- package/dist/arrange/{sync.js → regroup/run.js} +5 -5
- package/dist/arrange/resolve-target.d.ts +2 -2
- package/dist/arrange/resolve-target.js +2 -2
- package/dist/arrange/scan-target.d.ts +2 -2
- package/dist/arrange/scan-target.js +3 -3
- package/dist/arrange/simplify/cli-result.d.ts +7 -0
- package/dist/arrange/simplify/cli-result.js +8 -0
- package/dist/arrange/simplify/cli-schema.d.ts +17 -0
- package/dist/arrange/simplify/cli-schema.js +11 -0
- package/dist/arrange/simplify/fold-targets.d.ts +13 -0
- package/dist/arrange/simplify/fold-targets.js +139 -0
- package/dist/arrange/simplify/output.d.ts +7 -0
- package/dist/arrange/simplify/output.js +15 -0
- package/dist/arrange/simplify/process-file.d.ts +13 -0
- package/dist/arrange/simplify/process-file.js +49 -0
- package/dist/arrange/simplify/run.d.ts +14 -0
- package/dist/arrange/simplify/run.js +38 -0
- package/dist/arrange/simplify/variant-classname-probe.d.ts +35 -0
- package/dist/arrange/simplify/variant-classname-probe.js +95 -0
- package/dist/arrange/source-parse.d.ts +1 -1
- package/dist/arrange/source-parse.js +3 -3
- package/dist/audit/command.js +152 -212
- package/dist/audit/comments/cli-result.d.ts +13 -0
- package/dist/audit/comments/cli-result.js +22 -0
- package/dist/audit/comments/cli-schema.d.ts +19 -0
- package/dist/audit/comments/cli-schema.js +13 -0
- package/dist/audit/comments/output.d.ts +7 -0
- package/dist/audit/comments/output.js +27 -0
- package/dist/audit/comments/prepare.d.ts +16 -0
- package/dist/audit/comments/prepare.js +12 -0
- package/dist/audit/{run-comments.d.ts → comments/run.d.ts} +5 -5
- package/dist/audit/{run-comments.js → comments/run.js} +9 -9
- package/dist/audit/display-names/cli-result.d.ts +13 -0
- package/dist/audit/display-names/cli-result.js +22 -0
- package/dist/audit/display-names/cli-schema.d.ts +18 -0
- package/dist/audit/display-names/cli-schema.js +12 -0
- package/dist/audit/{domain → display-names/domain}/display-names.d.ts +1 -1
- package/dist/audit/display-names/output.d.ts +7 -0
- package/dist/audit/display-names/output.js +21 -0
- package/dist/audit/display-names/prepare.d.ts +16 -0
- package/dist/audit/display-names/prepare.js +12 -0
- package/dist/audit/display-names/run.d.ts +14 -0
- package/dist/audit/{run-display-names.js → display-names/run.js} +5 -5
- package/dist/audit/domain/types.d.ts +43 -0
- package/dist/audit/imports/cli-result.d.ts +13 -0
- package/dist/audit/imports/cli-result.js +22 -0
- package/dist/audit/imports/cli-schema.d.ts +18 -0
- package/dist/audit/imports/cli-schema.js +12 -0
- package/dist/audit/{domain → imports/domain}/import-policy.d.ts +3 -3
- package/dist/audit/{domain → imports/domain}/import-policy.js +4 -11
- package/dist/audit/imports/output.d.ts +7 -0
- package/dist/audit/imports/output.js +21 -0
- package/dist/audit/imports/prepare.d.ts +16 -0
- package/dist/audit/imports/prepare.js +12 -0
- package/dist/audit/imports/run.d.ts +14 -0
- package/dist/audit/{run-imports.js → imports/run.js} +6 -6
- package/dist/audit/links/cli-result.d.ts +13 -0
- package/dist/audit/links/cli-result.js +22 -0
- package/dist/audit/links/cli-schema.d.ts +18 -0
- package/dist/audit/links/cli-schema.js +12 -0
- package/dist/audit/{domain → links/domain}/markdown-links.d.ts +3 -3
- package/dist/audit/{domain → links/domain}/markdown-links.js +22 -8
- package/dist/audit/links/output.d.ts +7 -0
- package/dist/audit/links/output.js +21 -0
- package/dist/audit/links/prepare.d.ts +16 -0
- package/dist/audit/links/prepare.js +12 -0
- package/dist/audit/links/run.d.ts +14 -0
- package/dist/audit/{run-links.js → links/run.js} +4 -4
- package/dist/audit/prepare.d.ts +13 -52
- package/dist/audit/prepare.js +13 -136
- package/dist/audit/publish/cli-result.d.ts +13 -0
- package/dist/audit/publish/cli-result.js +22 -0
- package/dist/audit/publish/cli-schema.d.ts +18 -0
- package/dist/audit/publish/cli-schema.js +12 -0
- package/dist/audit/publish/domain/legacy-subpath.d.ts +8 -0
- package/dist/audit/publish/domain/legacy-subpath.js +22 -0
- package/dist/audit/publish/output.d.ts +7 -0
- package/dist/audit/publish/output.js +24 -0
- package/dist/audit/publish/prepare.d.ts +16 -0
- package/dist/audit/publish/prepare.js +12 -0
- package/dist/audit/publish/run.d.ts +14 -0
- package/dist/audit/publish/run.js +62 -0
- package/dist/audit/rtl/cli-result.d.ts +13 -0
- package/dist/audit/rtl/cli-result.js +22 -0
- package/dist/audit/rtl/cli-schema.d.ts +18 -0
- package/dist/audit/rtl/cli-schema.js +12 -0
- package/dist/audit/{domain → rtl/domain}/audit-file.d.ts +1 -1
- package/dist/audit/{domain → rtl/domain}/audit-file.js +2 -2
- package/dist/audit/{domain → rtl/domain}/tokenize.d.ts +1 -1
- package/dist/audit/rtl/output.d.ts +7 -0
- package/dist/audit/rtl/output.js +21 -0
- package/dist/audit/rtl/prepare.d.ts +13 -0
- package/dist/audit/rtl/prepare.js +41 -0
- package/dist/audit/rtl/run.d.ts +14 -0
- package/dist/audit/{run.js → rtl/run.js} +4 -4
- package/dist/bin.js +1 -1
- package/dist/cli.js +5 -5
- package/dist/core/cli/command-pipeline.d.ts +90 -0
- package/dist/core/cli/command-pipeline.js +83 -0
- package/dist/core/cli/format-error.d.ts +1 -1
- package/dist/core/cli/global-options.d.ts +1 -1
- package/dist/core/cli/global-options.js +1 -1
- package/dist/core/cli/resolve-root.d.ts +9 -0
- package/dist/core/cli/resolve-root.js +16 -0
- package/dist/core/cli/result-handle.d.ts +3 -9
- package/dist/core/cli/result-handle.js +4 -17
- package/dist/core/config/define-config.d.ts +1 -1
- package/dist/core/config/loader.d.ts +3 -3
- package/dist/core/config/loader.js +2 -2
- package/dist/core/config/schema.d.ts +1 -1
- package/dist/core/config/schema.js +1 -1
- package/dist/core/config/warnings.js +1 -1
- package/dist/core/config.d.ts +5 -5
- package/dist/core/config.js +4 -4
- package/dist/core/filesystem/{port.d.ts → filesystem.d.ts} +1 -1
- package/dist/core/filesystem/node.d.ts +3 -3
- package/dist/core/filesystem/node.js +1 -1
- package/dist/core/schema-parse.d.ts +2 -2
- package/dist/core/schema-parse.js +2 -2
- package/dist/core/source-text-edit.d.ts +14 -0
- package/dist/core/source-text-edit.js +22 -0
- package/dist/core/workspace/markdown-walk.d.ts +2 -2
- package/dist/core/workspace/markdown-walk.js +1 -1
- package/dist/core/workspace/package-version.d.ts +2 -2
- package/dist/core/workspace/package-version.js +2 -2
- package/dist/core/workspace/resolver.d.ts +3 -3
- package/dist/core/workspace/resolver.js +5 -5
- package/dist/core/workspace/source-walk.d.ts +2 -2
- package/dist/core/workspace/source-walk.js +1 -1
- package/dist/core/workspace/typescript-walk.d.ts +2 -2
- package/dist/core/workspace/typescript-walk.js +1 -1
- package/dist/core/workspace/walk-files.d.ts +2 -2
- package/dist/core/workspace/walk-files.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/mirror/cli-result.d.ts +1 -1
- package/dist/mirror/cli-result.js +1 -1
- package/dist/mirror/cli-schema.d.ts +2 -2
- package/dist/mirror/cli-schema.js +1 -1
- package/dist/mirror/command.js +36 -65
- package/dist/mirror/dist-filesystem-node.d.ts +8 -0
- package/dist/mirror/{dist-filesystem-impl.js → dist-filesystem-node.js} +3 -3
- package/dist/mirror/domain/dirent-guard.d.ts +1 -1
- package/dist/mirror/domain/exports.d.ts +2 -2
- package/dist/mirror/domain/exports.js +1 -1
- package/dist/mirror/domain/types.d.ts +59 -2
- package/dist/mirror/output.d.ts +1 -3
- package/dist/mirror/output.js +127 -2
- package/dist/mirror/package-path.d.ts +5 -5
- package/dist/mirror/package-path.js +3 -3
- package/dist/mirror/prepare.d.ts +6 -6
- package/dist/mirror/prepare.js +8 -12
- package/dist/mirror/run.d.ts +12 -0
- package/dist/mirror/{sync.js → run.js} +7 -7
- package/dist/mirror/supplement-exports.d.ts +3 -3
- package/dist/mirror/supplement-exports.js +2 -2
- package/dist/mirror/sync-workspace-package.d.ts +4 -4
- package/dist/mirror/sync-workspace-package.js +11 -14
- package/dist/mirror/write-exports.d.ts +3 -3
- package/dist/mirror/write-exports.js +3 -3
- package/dist/pack-slim/cli-result.d.ts +1 -1
- package/dist/pack-slim/cli-result.js +1 -1
- package/dist/pack-slim/cli-schema.d.ts +1 -1
- package/dist/pack-slim/cli-schema.js +1 -1
- package/dist/pack-slim/command.js +36 -71
- package/dist/pack-slim/domain/transform.d.ts +22 -1
- package/dist/pack-slim/domain/transform.js +65 -8
- package/dist/pack-slim/output.d.ts +1 -1
- package/dist/pack-slim/output.js +1 -1
- package/dist/pack-slim/prepare.d.ts +21 -0
- package/dist/pack-slim/prepare.js +14 -0
- package/dist/pack-slim/{sync.d.ts → run.d.ts} +6 -6
- package/dist/pack-slim/{sync.js → run.js} +5 -5
- package/dist/pack-slim/working-tree.d.ts +2 -2
- package/dist/pack-slim/working-tree.js +2 -2
- package/dist/tag/cli-result.d.ts +8 -2
- package/dist/tag/cli-result.js +15 -2
- package/dist/tag/cli-schema.d.ts +4 -4
- package/dist/tag/cli-schema.js +3 -4
- package/dist/tag/command.js +34 -61
- package/dist/tag/domain/skip-filter.d.ts +13 -0
- package/dist/tag/domain/skip-filter.js +29 -0
- package/dist/tag/domain/types.d.ts +22 -2
- package/dist/tag/domain/version-summary.d.ts +13 -0
- package/dist/tag/domain/version-summary.js +24 -0
- package/dist/tag/output.d.ts +4 -4
- package/dist/tag/output.js +7 -10
- package/dist/tag/prepare.d.ts +5 -5
- package/dist/tag/prepare.js +5 -5
- package/dist/tag/run.d.ts +10 -0
- package/dist/tag/{sync.js → run.js} +23 -53
- package/dist/tag/target/candidates.d.ts +8 -0
- package/dist/tag/{target-candidates.js → target/candidates.js} +3 -3
- package/dist/tag/{resolve-target-path.d.ts → target/resolve-path.d.ts} +2 -2
- package/dist/tag/target/runner.d.ts +8 -0
- package/dist/tag/{target-runner.js → target/runner.js} +3 -3
- package/dist/tag/{since-writer.d.ts → writer/since-writer.d.ts} +3 -3
- package/dist/tag/{since-writer.js → writer/since-writer.js} +1 -1
- package/dist/tag/{version-resolver.d.ts → writer/version-resolver.d.ts} +2 -2
- package/dist/tag/{version-resolver.js → writer/version-resolver.js} +1 -1
- package/package.json +15 -7
- package/dist/arrange/analyze.d.ts +0 -10
- package/dist/arrange/cli-schema.d.ts +0 -50
- package/dist/arrange/cli-schema.js +0 -34
- package/dist/arrange/output.d.ts +0 -26
- package/dist/arrange/output.js +0 -127
- package/dist/arrange/simplify-process-file.d.ts +0 -11
- package/dist/arrange/simplify-process-file.js +0 -30
- package/dist/arrange/simplify-sync.d.ts +0 -13
- package/dist/arrange/simplify-sync.js +0 -30
- package/dist/arrange/suggest.d.ts +0 -8
- package/dist/arrange/sync.d.ts +0 -11
- package/dist/arrange/workspace.d.ts +0 -13
- package/dist/audit/cli-schema.d.ts +0 -93
- package/dist/audit/cli-schema.js +0 -66
- package/dist/audit/output.d.ts +0 -91
- package/dist/audit/output.js +0 -213
- package/dist/audit/run-display-names.d.ts +0 -14
- package/dist/audit/run-imports.d.ts +0 -14
- package/dist/audit/run-links.d.ts +0 -14
- package/dist/audit/run.d.ts +0 -14
- package/dist/mirror/dist-filesystem-impl.d.ts +0 -8
- package/dist/mirror/sync-reporter.d.ts +0 -60
- package/dist/mirror/sync-reporter.js +0 -128
- package/dist/mirror/sync-types.d.ts +0 -43
- package/dist/mirror/sync-types.js +0 -1
- package/dist/mirror/sync.d.ts +0 -12
- package/dist/tag/sync.d.ts +0 -42
- package/dist/tag/target-candidates.d.ts +0 -8
- package/dist/tag/target-runner.d.ts +0 -8
- /package/dist/audit/{domain → comments/domain}/comment-content.d.ts +0 -0
- /package/dist/audit/{domain → comments/domain}/comment-content.js +0 -0
- /package/dist/audit/{domain → comments/domain}/comment-dividers.d.ts +0 -0
- /package/dist/audit/{domain → comments/domain}/comment-dividers.js +0 -0
- /package/dist/audit/{domain → comments/domain}/link-references.d.ts +0 -0
- /package/dist/audit/{domain → comments/domain}/link-references.js +0 -0
- /package/dist/audit/{domain → comments/domain}/since-versions.d.ts +0 -0
- /package/dist/audit/{domain → comments/domain}/since-versions.js +0 -0
- /package/dist/audit/{domain → comments/domain}/tsdoc-syntax.d.ts +0 -0
- /package/dist/audit/{domain → comments/domain}/tsdoc-syntax.js +0 -0
- /package/dist/audit/{domain → display-names/domain}/display-names.js +0 -0
- /package/dist/audit/{domain → rtl/domain}/mappings.d.ts +0 -0
- /package/dist/audit/{domain → rtl/domain}/mappings.js +0 -0
- /package/dist/audit/{domain → rtl/domain}/tokenize.js +0 -0
- /package/dist/core/filesystem/{port.js → filesystem.js} +0 -0
- /package/dist/tag/{resolve-target-path.js → target/resolve-path.js} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
2
2
|
/**
|
|
3
3
|
* Finds the `version` of the nearest enclosing `package.json`, or null when the first
|
|
4
4
|
* one found declares none (the private workspace root is version-less by design).
|
|
5
5
|
*
|
|
6
6
|
* @since 0.8.0
|
|
7
7
|
*/
|
|
8
|
-
declare function findNearestPackageVersion(fs:
|
|
8
|
+
declare function findNearestPackageVersion(fs: Filesystem, targetPath: string): string | null;
|
|
9
9
|
export { findNearestPackageVersion };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { findNearestAncestor } from "
|
|
3
|
-
import { packageJsonFileName } from "
|
|
2
|
+
import { findNearestAncestor } from "#core/workspace/ancestor-directories";
|
|
3
|
+
import { packageJsonFileName } from "#core/workspace/well-known-files";
|
|
4
4
|
/**
|
|
5
5
|
* Finds the `version` of the nearest enclosing `package.json`, or null when the first
|
|
6
6
|
* one found declares none (the private workspace root is version-less by design).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
2
2
|
/**
|
|
3
3
|
* A resolved project root and whether it is a pnpm workspace or a standalone single package.
|
|
4
4
|
*
|
|
@@ -13,7 +13,7 @@ export type ResolvedProjectRoot = {
|
|
|
13
13
|
*
|
|
14
14
|
* @since 0.10.0
|
|
15
15
|
*/
|
|
16
|
-
export declare function resolveProjectRoot(fromDirectory: string, fs:
|
|
16
|
+
export declare function resolveProjectRoot(fromDirectory: string, fs: Filesystem): ResolvedProjectRoot;
|
|
17
17
|
/**
|
|
18
18
|
* Where the workspace package patterns came from.
|
|
19
19
|
*
|
|
@@ -35,5 +35,5 @@ export type WorkspacePackageLayoutOutcome = {
|
|
|
35
35
|
*
|
|
36
36
|
* @since 0.3.16-canary.0
|
|
37
37
|
*/
|
|
38
|
-
export declare function listWorkspacePackageDirectories(rootDirectoryPathAbsolute: string, fs:
|
|
38
|
+
export declare function listWorkspacePackageDirectories(rootDirectoryPathAbsolute: string, fs: Filesystem, suppressGlobPermissionDiagnostics?: boolean): Promise<WorkspacePackageLayoutOutcome>;
|
|
39
39
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { parse as parseYaml } from "yaml";
|
|
3
|
-
import { messageFrom } from "
|
|
4
|
-
import { createAnyGlobMatcher } from "
|
|
5
|
-
import { logger } from "
|
|
6
|
-
import { findNearestAncestor } from "
|
|
7
|
-
import { packageJsonFileName, workspaceYamlFileName } from "
|
|
3
|
+
import { messageFrom } from "#core/errors";
|
|
4
|
+
import { createAnyGlobMatcher } from "#core/glob";
|
|
5
|
+
import { logger } from "#core/logger";
|
|
6
|
+
import { findNearestAncestor } from "#core/workspace/ancestor-directories";
|
|
7
|
+
import { packageJsonFileName, workspaceYamlFileName } from "#core/workspace/well-known-files";
|
|
8
8
|
/**
|
|
9
9
|
* Resolves the project root: the `pnpm-workspace.yaml` directory, or the nearest `package.json` for a single package.
|
|
10
10
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
2
2
|
/**
|
|
3
3
|
* Every hand-written source file a comment convention applies to — `.ts`, `.tsx`, `.css`, and ignore files.
|
|
4
4
|
*
|
|
@@ -7,7 +7,7 @@ import type { FilesystemPort } from "#/core/filesystem/port";
|
|
|
7
7
|
*
|
|
8
8
|
* @since 0.6.0
|
|
9
9
|
*/
|
|
10
|
-
export declare function walkSourceFiles(rootDirectoryPath: string, fs:
|
|
10
|
+
export declare function walkSourceFiles(rootDirectoryPath: string, fs: Filesystem): Array<string>;
|
|
11
11
|
/**
|
|
12
12
|
* Which comment syntax a path is written in, or `null` when the convention does not cover it.
|
|
13
13
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { walkFiles } from "
|
|
2
|
+
import { walkFiles } from "#core/workspace/walk-files";
|
|
3
3
|
// Ignore files carry the divider convention over `#` comments — the content rules stay code-only.
|
|
4
4
|
const ignoreFileNames = new Set([
|
|
5
5
|
".gitignore",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
2
2
|
/**
|
|
3
3
|
* Recursively collects the `.ts`/`.tsx` file paths under a root, skipping `.d.ts` and skip-listed directories.
|
|
4
4
|
*
|
|
5
5
|
* @since 0.3.16-canary.0
|
|
6
6
|
*/
|
|
7
|
-
export declare function walkTsxFiles(rootDirectoryPath: string, fs:
|
|
7
|
+
export declare function walkTsxFiles(rootDirectoryPath: string, fs: Filesystem): Array<string>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
2
2
|
/**
|
|
3
3
|
* Every file under a root the predicate accepts, skipping build output and vendored trees.
|
|
4
4
|
*
|
|
5
5
|
* @since 0.10.0
|
|
6
6
|
*/
|
|
7
|
-
export declare function walkFiles(rootDirectoryPath: string, fs:
|
|
7
|
+
export declare function walkFiles(rootDirectoryPath: string, fs: Filesystem, shouldInclude: (filePath: string) => boolean): Array<string>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { defaultSkipDirectoryNames } from "
|
|
2
|
+
import { defaultSkipDirectoryNames } from "#core/workspace/skip-directories";
|
|
3
3
|
/**
|
|
4
4
|
* Every file under a root the predicate accepts, skipping build output and vendored trees.
|
|
5
5
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `@codefast/cli` public API: run the CLI in-process, and author a typed `codefast.config.*`.
|
|
3
3
|
*/
|
|
4
|
-
export { runCli } from "
|
|
5
|
-
export { defineConfig } from "
|
|
6
|
-
export type { CodefastAfterWriteHook, CodefastArrangeConfig, CodefastConfig, CodefastTagConfig, MirrorConfig, } from "
|
|
4
|
+
export { runCli } from "#cli";
|
|
5
|
+
export { defineConfig } from "#core/config/define-config";
|
|
6
|
+
export type { CodefastAfterWriteHook, CodefastArrangeConfig, CodefastConfig, CodefastTagConfig, MirrorConfig, } from "#core/config/schema";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `@codefast/cli` public API: run the CLI in-process, and author a typed `codefast.config.*`.
|
|
3
3
|
*/
|
|
4
|
-
export { runCli } from "
|
|
5
|
-
export { defineConfig } from "
|
|
4
|
+
export { runCli } from "#cli";
|
|
5
|
+
export { defineConfig } from "#core/config/define-config";
|
package/dist/mirror/command.js
CHANGED
|
@@ -1,74 +1,45 @@
|
|
|
1
|
-
import process from "node:process";
|
|
2
1
|
import { Command } from "commander";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
import { applyCommandPipeline } from "#core/cli/command-pipeline";
|
|
3
|
+
import { nodeFilesystem } from "#core/filesystem/node";
|
|
4
|
+
import { exitCodeForMirrorSyncResult, formatMirrorSyncJsonOutput } from "#mirror/cli-result";
|
|
5
|
+
import { mirrorSyncRunRequestSchema } from "#mirror/cli-schema";
|
|
6
|
+
import { MirrorSyncProgressPresenter } from "#mirror/output";
|
|
7
|
+
import { prepareMirrorSync } from "#mirror/prepare";
|
|
8
|
+
import { runMirrorSync } from "#mirror/run";
|
|
9
|
+
const mirrorPipeline = {
|
|
10
|
+
positional: { name: "[package]", help: "Optional package path relative to repo root (e.g. packages/ui)" },
|
|
11
|
+
schema: mirrorSyncRunRequestSchema,
|
|
12
|
+
configureArgv: (command) => {
|
|
13
|
+
command.option("--dry-run", "Report what would change without writing package.json", false);
|
|
14
|
+
command.option("-v, --verbose", "Print extra diagnostics", false);
|
|
15
|
+
},
|
|
16
|
+
prepare: (fs, input) => prepareMirrorSync(fs, {
|
|
17
|
+
currentWorkingDirectory: input.currentWorkingDirectory,
|
|
18
|
+
packageArg: input.rawArg,
|
|
19
|
+
globals: input.globals,
|
|
20
|
+
}),
|
|
21
|
+
buildRequest: ({ prelude, opts }) => ({
|
|
22
|
+
rootDir: prelude.rootDir,
|
|
23
|
+
config: prelude.config.mirror ?? {},
|
|
24
|
+
packageFilter: prelude.packageFilter,
|
|
25
|
+
write: !opts.dryRun,
|
|
26
|
+
}),
|
|
27
|
+
createPresenter: ({ opts, globals }) => {
|
|
28
|
+
const presenter = new MirrorSyncProgressPresenter();
|
|
29
|
+
presenter.configure({ noColor: globals.color === false, verbose: !!opts.verbose, dryRun: !!opts.dryRun });
|
|
30
|
+
return presenter;
|
|
31
|
+
},
|
|
32
|
+
run: (fs, request, presenter) => runMirrorSync(fs, { ...request, listener: presenter }),
|
|
33
|
+
formatJson: ({ result, opts, elapsedSeconds }) => formatMirrorSyncJsonOutput(result, elapsedSeconds, !opts.dryRun),
|
|
34
|
+
exitCode: exitCodeForMirrorSyncResult,
|
|
35
|
+
};
|
|
14
36
|
/**
|
|
15
37
|
* Creates the `mirror` subcommand, which writes `package.json#exports` from `dist/`.
|
|
16
38
|
*
|
|
17
39
|
* @since 0.3.16-canary.0
|
|
18
40
|
*/
|
|
19
41
|
export function createMirrorCommand() {
|
|
20
|
-
const cmd = new Command("mirror")
|
|
21
|
-
|
|
22
|
-
.argument("[package]", "Optional package path relative to repo root (e.g. packages/ui)")
|
|
23
|
-
.option("--dry-run", "Report what would change without writing package.json", false)
|
|
24
|
-
.option("-v, --verbose", "Print extra diagnostics", false)
|
|
25
|
-
.option("--json", "Print one JSON summary on stdout (suppresses human progress)", false)
|
|
26
|
-
.action(async (packageArg, opts, command) => {
|
|
27
|
-
const globalsOptionCarrier = command.optsWithGlobals?.() ??
|
|
28
|
-
command.opts();
|
|
29
|
-
const globalOptionsOutcome = parseWithSchema(globalCliCommanderOptionsSchema, globalsOptionCarrier);
|
|
30
|
-
if (!consumeCliAppError(globalOptionsOutcome)) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const prelude = await prepareMirrorSync(nodeFilesystem, {
|
|
34
|
-
currentWorkingDirectory: process.cwd(),
|
|
35
|
-
packageArg: readOptionalPositionalArg(packageArg),
|
|
36
|
-
globals: globalOptionsOutcome.value,
|
|
37
|
-
});
|
|
38
|
-
if (!consumeCliAppError(prelude)) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const write = !opts.dryRun;
|
|
42
|
-
const { rootDir, config, packageFilter } = prelude.value;
|
|
43
|
-
const parsed = parseWithSchema(mirrorSyncRunRequestSchema, {
|
|
44
|
-
rootDir,
|
|
45
|
-
config: config.mirror ?? {},
|
|
46
|
-
packageFilter,
|
|
47
|
-
write,
|
|
48
|
-
});
|
|
49
|
-
if (!consumeCliAppError(parsed)) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
const json = !!opts.json;
|
|
53
|
-
const noColor = globalOptionsOutcome.value.color === false;
|
|
54
|
-
const verbose = !!opts.verbose;
|
|
55
|
-
const progressPresenter = new MirrorSyncProgressPresenter();
|
|
56
|
-
const listener = json ? undefined : progressPresenter;
|
|
57
|
-
if (!json) {
|
|
58
|
-
progressPresenter.configure({ noColor, verbose, dryRun: !write });
|
|
59
|
-
}
|
|
60
|
-
const startTime = performance.now();
|
|
61
|
-
const outcome = await runMirrorSync(nodeFilesystem, {
|
|
62
|
-
...parsed.value,
|
|
63
|
-
listener,
|
|
64
|
-
});
|
|
65
|
-
if (!consumeCliAppError(outcome)) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
if (json) {
|
|
69
|
-
logger.out(formatMirrorSyncJsonOutput(outcome.value, (performance.now() - startTime) / 1000, write));
|
|
70
|
-
}
|
|
71
|
-
process.exitCode = exitCodeForMirrorSyncResult(outcome.value);
|
|
72
|
-
});
|
|
42
|
+
const cmd = new Command("mirror").description("Write package.json exports from dist/ for workspace packages");
|
|
43
|
+
applyCommandPipeline(cmd, nodeFilesystem, mirrorPipeline);
|
|
73
44
|
return cmd;
|
|
74
45
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
2
|
+
import type { DistFilesystem } from "#mirror/domain/dist-filesystem";
|
|
3
|
+
/**
|
|
4
|
+
* Creates the `DistFilesystem` the mirror scan uses, backed by a `Filesystem`.
|
|
5
|
+
*
|
|
6
|
+
* @since 0.3.16-canary.0
|
|
7
|
+
*/
|
|
8
|
+
export declare function createMirrorDistFilesystem(fs: Filesystem): DistFilesystem;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { isDirentList } from "
|
|
3
|
-
import { normalizePath } from "
|
|
2
|
+
import { isDirentList } from "#mirror/domain/dirent-guard";
|
|
3
|
+
import { normalizePath } from "#mirror/domain/path-normalizer";
|
|
4
4
|
/**
|
|
5
|
-
* Creates the `DistFilesystem` the mirror scan uses, backed by a `
|
|
5
|
+
* Creates the `DistFilesystem` the mirror scan uses, backed by a `Filesystem`.
|
|
6
6
|
*
|
|
7
7
|
* @since 0.3.16-canary.0
|
|
8
8
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DirectoryEntry } from "
|
|
1
|
+
import type { DirectoryEntry } from "#core/filesystem/filesystem";
|
|
2
2
|
/**
|
|
3
3
|
* Narrow `fs.promises.readdir` overload result to `Dirent[]` when `withFileTypes: true`.
|
|
4
4
|
* Accepts both historical checks (`isFile` / `isDirectory`) in one guard.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DistFilesystem } from "
|
|
2
|
-
import type { GenerateExportsResult } from "
|
|
1
|
+
import type { DistFilesystem } from "#mirror/domain/dist-filesystem";
|
|
2
|
+
import type { GenerateExportsResult } from "#mirror/domain/types";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a transform that strips a configured prefix from export paths, or `null` when none is set.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as nodePath from "node:path";
|
|
2
|
-
import { PACKAGE_JSON_EXPORT, VALID_DTS_EXTENSIONS, VALID_JS_EXTENSIONS } from "
|
|
2
|
+
import { PACKAGE_JSON_EXPORT, VALID_DTS_EXTENSIONS, VALID_JS_EXTENSIONS } from "#mirror/domain/constants";
|
|
3
3
|
function groupDistFilesByModule(relativeDistFiles) {
|
|
4
4
|
const distModulesByPath = new Map();
|
|
5
5
|
for (const relativeDistFile of relativeDistFiles) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { GlobalCliOptions } from "
|
|
2
|
-
import type { CodefastConfig } from "
|
|
1
|
+
import type { GlobalCliOptions } from "#core/cli/global-options";
|
|
2
|
+
import type { CodefastConfig } from "#core/config/schema";
|
|
3
3
|
/**
|
|
4
4
|
* One conditional exports entry, keyed by resolution condition.
|
|
5
5
|
*
|
|
@@ -128,4 +128,61 @@ export interface MirrorSyncCommandPrelude {
|
|
|
128
128
|
readonly config: CodefastConfig;
|
|
129
129
|
readonly packageFilter: string | undefined;
|
|
130
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* The inputs a mirror run is invoked with.
|
|
133
|
+
*
|
|
134
|
+
* @since 0.3.16-canary.0
|
|
135
|
+
*/
|
|
136
|
+
export type MirrorSyncRunRequest = {
|
|
137
|
+
rootDir: string;
|
|
138
|
+
packageFilter?: string | undefined;
|
|
139
|
+
config?: unknown;
|
|
140
|
+
/** When false, compute and report changes without writing package.json. Defaults to true. */
|
|
141
|
+
write?: boolean | undefined;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Whether a run targets a single package or the discovered workspace set.
|
|
145
|
+
*
|
|
146
|
+
* @since 0.3.16-canary.0
|
|
147
|
+
*/
|
|
148
|
+
export type MirrorProcessingModeInput = {
|
|
149
|
+
kind: "single";
|
|
150
|
+
} | {
|
|
151
|
+
kind: "multi";
|
|
152
|
+
source: WorkspaceMultiDiscoverySource;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Callbacks a mirror run invokes as it progresses through packages.
|
|
156
|
+
*
|
|
157
|
+
* @since 0.3.16-canary.0
|
|
158
|
+
*/
|
|
159
|
+
export type MirrorSyncProgressListener = {
|
|
160
|
+
configure(options: {
|
|
161
|
+
readonly noColor: boolean;
|
|
162
|
+
readonly verbose: boolean;
|
|
163
|
+
readonly dryRun: boolean;
|
|
164
|
+
}): void;
|
|
165
|
+
onBanner(): void;
|
|
166
|
+
onProcessingMode(mode: MirrorProcessingModeInput): void;
|
|
167
|
+
onNoPackages(): void;
|
|
168
|
+
onPackageComplete(pkgStats: PackageStats, ordinal: number, total: number): void;
|
|
169
|
+
onComplete(stats: GlobalStats, elapsedSeconds: number): void;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* A run request paired with an optional progress listener.
|
|
173
|
+
*
|
|
174
|
+
* @since 0.3.16-canary.0
|
|
175
|
+
*/
|
|
176
|
+
export type MirrorSyncExecutionInput = MirrorSyncRunRequest & {
|
|
177
|
+
readonly listener?: MirrorSyncProgressListener | undefined;
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* The stdout/stderr line-writer shape the reporter prints through.
|
|
181
|
+
*
|
|
182
|
+
* @since 0.3.16-canary.0
|
|
183
|
+
*/
|
|
184
|
+
export type CliLoggerLike = {
|
|
185
|
+
out(line: string): void;
|
|
186
|
+
err(line: string): void;
|
|
187
|
+
};
|
|
131
188
|
export {};
|
package/dist/mirror/output.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { GlobalStats, PackageStats } from "
|
|
2
|
-
import type { MirrorProcessingModeInput } from "#/mirror/sync-reporter";
|
|
3
|
-
import type { MirrorSyncProgressListener } from "#/mirror/sync-types";
|
|
1
|
+
import type { GlobalStats, MirrorProcessingModeInput, MirrorSyncProgressListener, PackageStats } from "#mirror/domain/types";
|
|
4
2
|
/**
|
|
5
3
|
* A progress listener that renders mirror run events through the CLI reporter.
|
|
6
4
|
*
|
package/dist/mirror/output.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
import { messageFrom } from "#core/errors";
|
|
3
|
+
import { logger } from "#core/logger";
|
|
3
4
|
const cliLogger = logger;
|
|
4
5
|
/**
|
|
5
6
|
* A progress listener that renders mirror run events through the CLI reporter.
|
|
@@ -45,4 +46,128 @@ export class MirrorSyncProgressPresenter {
|
|
|
45
46
|
this.reporter.mirrorSummarySeparator(cliLogger);
|
|
46
47
|
this.reporter.mirrorSummary(cliLogger, stats, elapsedSeconds);
|
|
47
48
|
}
|
|
49
|
+
}
|
|
50
|
+
const ANSI = {
|
|
51
|
+
reset: "\x1b[0m",
|
|
52
|
+
bold: "\x1b[1m",
|
|
53
|
+
dim: "\x1b[2m",
|
|
54
|
+
green: "\x1b[32m",
|
|
55
|
+
yellow: "\x1b[33m",
|
|
56
|
+
cyan: "\x1b[36m",
|
|
57
|
+
gray: "\x1b[90m",
|
|
58
|
+
magenta: "\x1b[35m",
|
|
59
|
+
brightGreen: "\x1b[92m",
|
|
60
|
+
brightCyan: "\x1b[96m",
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Console rendering — ANSI styling and layout — for every line a mirror run prints.
|
|
64
|
+
*/
|
|
65
|
+
class MirrorSyncReporter {
|
|
66
|
+
colorsAreEnabled = true;
|
|
67
|
+
configureMirrorColors(noColor) {
|
|
68
|
+
this.colorsAreEnabled = !!process.stdout.isTTY && !noColor;
|
|
69
|
+
}
|
|
70
|
+
mirrorBanner(target) {
|
|
71
|
+
target.out(`\n${this.paint("📦 Mirror — package exports", ANSI.bold + ANSI.cyan)}`);
|
|
72
|
+
target.out(`${this.paint("═".repeat(60), ANSI.dim)}\n`);
|
|
73
|
+
}
|
|
74
|
+
mirrorDryRunNotice(target) {
|
|
75
|
+
target.out(`${this.paint("Dry run — no files will be written.", ANSI.yellow)}\n`);
|
|
76
|
+
}
|
|
77
|
+
mirrorProcessingMode(target, mode) {
|
|
78
|
+
if (mode.kind === "single") {
|
|
79
|
+
target.out(`${this.paint("Processing single package...", ANSI.dim)}\n`);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (mode.source === "default-patterns") {
|
|
83
|
+
target.out(`${this.paint("Discovering workspace packages using default patterns (packages/*)…", ANSI.dim)}\n`);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (mode.source === "pnpm-workspace-yaml") {
|
|
87
|
+
target.out(`${this.paint("Discovering workspace packages from pnpm-workspace.yaml…", ANSI.dim)}\n`);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (mode.source === "single-package") {
|
|
91
|
+
target.out(`${this.paint("No pnpm-workspace.yaml — processing the single package at the project root…", ANSI.dim)}\n`);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
target.out(`${this.paint("pnpm-workspace.yaml declares an empty workspace package list.", ANSI.dim)}\n`);
|
|
95
|
+
}
|
|
96
|
+
mirrorNoPackages(target) {
|
|
97
|
+
target.out(this.paint("⚠ No packages found", ANSI.yellow));
|
|
98
|
+
}
|
|
99
|
+
logSkippedWorkspacePackage(target, index, total, displayName, reason) {
|
|
100
|
+
const progress = this.paint(`[${index}/${total}]`, ANSI.dim);
|
|
101
|
+
target.out(`${progress} ${this.paint("○", ANSI.gray)} ${this.paint(displayName, ANSI.dim)}`);
|
|
102
|
+
target.out(` ${this.paint("└─", ANSI.dim)} ${this.paint(`Skipped: ${reason}`, ANSI.gray)}`);
|
|
103
|
+
target.out("");
|
|
104
|
+
}
|
|
105
|
+
logPackageSuccess(target, index, total, pkgStats, generatedDistAssetCounts, verbose) {
|
|
106
|
+
const progress = this.paint(`[${index}/${total}]`, ANSI.dim);
|
|
107
|
+
target.out(`${progress} ${this.paint("✓", ANSI.brightGreen)} ${this.paint(pkgStats.name, ANSI.bold)}`);
|
|
108
|
+
if (verbose) {
|
|
109
|
+
target.out(` ${this.paint("├─", ANSI.dim)} Path: ${pkgStats.path}`);
|
|
110
|
+
if (pkgStats.hasTransform) {
|
|
111
|
+
target.out(` ${this.paint("├─", ANSI.dim)} ${this.paint("Custom path transformation", ANSI.cyan)}`);
|
|
112
|
+
}
|
|
113
|
+
if (pkgStats.cssConfigStatus) {
|
|
114
|
+
const status = pkgStats.cssConfigStatus === "disabled" ? "CSS disabled" : "CSS configured";
|
|
115
|
+
target.out(` ${this.paint("├─", ANSI.dim)} ${this.paint(status, ANSI.cyan)}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const breakdown = [];
|
|
119
|
+
if (generatedDistAssetCounts.jsCount > 0) {
|
|
120
|
+
breakdown.push(this.paint(`${generatedDistAssetCounts.jsCount} modules`, ANSI.green));
|
|
121
|
+
}
|
|
122
|
+
if (generatedDistAssetCounts.cssCount > 0) {
|
|
123
|
+
breakdown.push(this.paint(`${generatedDistAssetCounts.cssCount} CSS`, ANSI.magenta));
|
|
124
|
+
}
|
|
125
|
+
if (pkgStats.extraExports > 0) {
|
|
126
|
+
breakdown.push(this.paint(`${pkgStats.extraExports} custom`, ANSI.yellow));
|
|
127
|
+
}
|
|
128
|
+
const totalExportsText = this.paint(`${pkgStats.totalExports} exports`, ANSI.brightCyan);
|
|
129
|
+
if (breakdown.length === 0) {
|
|
130
|
+
target.out(` ${this.paint("└─", ANSI.dim)} ${totalExportsText}`);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
target.out(` ${this.paint("└─", ANSI.dim)} ${breakdown.join(" + ")} = ${totalExportsText}`);
|
|
134
|
+
}
|
|
135
|
+
target.out("");
|
|
136
|
+
}
|
|
137
|
+
logPrunedStaleExport(target, exportSpecifier) {
|
|
138
|
+
target.out(` ${this.paint("└─", ANSI.dim)} ${this.paint(`Pruned stale export: ${exportSpecifier}`, ANSI.gray)}`);
|
|
139
|
+
}
|
|
140
|
+
logPackageError(target, index, total, displayName, errorValue, verbose) {
|
|
141
|
+
target.out(`${this.paint(`[${index}/${total}]`, ANSI.dim)} ${this.paint("✗", ANSI.yellow)} ${this.paint(displayName, ANSI.bold)}`);
|
|
142
|
+
target.out(` ${this.paint("└─", ANSI.dim)} ${this.paint(`Error: ${messageFrom(errorValue)}`, ANSI.yellow)}\n`);
|
|
143
|
+
if (verbose) {
|
|
144
|
+
target.err(errorValue instanceof Error && errorValue.stack ? errorValue.stack : messageFrom(errorValue));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
mirrorSummarySeparator(target) {
|
|
148
|
+
target.out(this.paint("═".repeat(60), ANSI.dim));
|
|
149
|
+
}
|
|
150
|
+
mirrorSummary(target, stats, elapsedSeconds) {
|
|
151
|
+
target.out(`${this.paint("📊 Summary", ANSI.bold)} ${this.paint(`(completed in ${elapsedSeconds.toFixed(2)}s)`, ANSI.dim)}\n`);
|
|
152
|
+
target.out(` ${this.paint("Packages:", ANSI.bold)}`);
|
|
153
|
+
target.out(` ${this.paint("├─", ANSI.dim)} Processed: ${this.paint(String(stats.packagesProcessed), ANSI.green)}`);
|
|
154
|
+
if (stats.packagesSkipped > 0) {
|
|
155
|
+
target.out(` ${this.paint("├─", ANSI.dim)} Skipped: ${this.paint(String(stats.packagesSkipped), ANSI.gray)}`);
|
|
156
|
+
}
|
|
157
|
+
if (stats.packagesErrored > 0) {
|
|
158
|
+
target.out(` ${this.paint("├─", ANSI.dim)} Errors: ${this.paint(String(stats.packagesErrored), ANSI.yellow)}`);
|
|
159
|
+
}
|
|
160
|
+
target.out(` ${this.paint("└─", ANSI.dim)} Total found: ${stats.packagesFound}\n`);
|
|
161
|
+
target.out(` ${this.paint("Exports:", ANSI.bold)}`);
|
|
162
|
+
target.out(` ${this.paint("├─", ANSI.dim)} JS Modules: ${this.paint(String(stats.totalJsModules), ANSI.cyan)}`);
|
|
163
|
+
target.out(` ${this.paint("├─", ANSI.dim)} CSS Files: ${this.paint(String(stats.totalCssExports), ANSI.magenta)}`);
|
|
164
|
+
target.out(` ${this.paint("└─", ANSI.dim)} Total: ${this.paint(String(stats.totalExports), ANSI.brightCyan)}\n`);
|
|
165
|
+
target.out(`${this.paint("═".repeat(60), ANSI.dim)}\n`);
|
|
166
|
+
}
|
|
167
|
+
paint(text, openSequence) {
|
|
168
|
+
if (!this.colorsAreEnabled) {
|
|
169
|
+
return text;
|
|
170
|
+
}
|
|
171
|
+
return `${openSequence}${text}${ANSI.reset}`;
|
|
172
|
+
}
|
|
48
173
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { AppError } from "
|
|
2
|
-
import type {
|
|
3
|
-
import type { Result } from "
|
|
1
|
+
import { AppError } from "#core/errors";
|
|
2
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
3
|
+
import type { Result } from "#core/result";
|
|
4
4
|
/**
|
|
5
5
|
* Resolves the optional positional package argument to a root-relative path, or `undefined` when absent.
|
|
6
6
|
*
|
|
7
7
|
* @since 0.3.16-canary.0
|
|
8
8
|
*/
|
|
9
|
-
export declare function resolveMirrorPackageFromCliArg(fs:
|
|
9
|
+
export declare function resolveMirrorPackageFromCliArg(fs: Filesystem, args: {
|
|
10
10
|
readonly rootDir: string;
|
|
11
11
|
readonly packageArg: string | undefined;
|
|
12
12
|
readonly currentWorkingDirectory: string;
|
|
@@ -16,4 +16,4 @@ export declare function resolveMirrorPackageFromCliArg(fs: FilesystemPort, args:
|
|
|
16
16
|
*
|
|
17
17
|
* @since 0.3.16-canary.0
|
|
18
18
|
*/
|
|
19
|
-
export declare function resolvePackageFilterUnderRoot(fs:
|
|
19
|
+
export declare function resolvePackageFilterUnderRoot(fs: Filesystem, rootDir: string, packageFilter: string): Result<string, AppError>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { AppError } from "
|
|
3
|
-
import { err, ok } from "
|
|
4
|
-
import { normalizePath } from "
|
|
2
|
+
import { AppError } from "#core/errors";
|
|
3
|
+
import { err, ok } from "#core/result";
|
|
4
|
+
import { normalizePath } from "#mirror/domain/path-normalizer";
|
|
5
5
|
/**
|
|
6
6
|
* Resolves the optional positional package argument to a root-relative path, or `undefined` when absent.
|
|
7
7
|
*
|
package/dist/mirror/prepare.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { GlobalCliOptions } from "
|
|
2
|
-
import { AppError } from "
|
|
3
|
-
import type {
|
|
4
|
-
import type { Result } from "
|
|
5
|
-
import type { MirrorSyncCommandPrelude } from "
|
|
1
|
+
import type { GlobalCliOptions } from "#core/cli/global-options";
|
|
2
|
+
import type { AppError } from "#core/errors";
|
|
3
|
+
import type { Filesystem } from "#core/filesystem/filesystem";
|
|
4
|
+
import type { Result } from "#core/result";
|
|
5
|
+
import type { MirrorSyncCommandPrelude } from "#mirror/domain/types";
|
|
6
6
|
/**
|
|
7
7
|
* Resolves the repo root, config, and package filter into the prelude a mirror run starts from.
|
|
8
8
|
*
|
|
9
9
|
* @since 0.3.16-canary.0
|
|
10
10
|
*/
|
|
11
|
-
export declare function prepareMirrorSync(fs:
|
|
11
|
+
export declare function prepareMirrorSync(fs: Filesystem, args: {
|
|
12
12
|
readonly currentWorkingDirectory: string;
|
|
13
13
|
readonly packageArg: string | undefined;
|
|
14
14
|
readonly globals: GlobalCliOptions;
|