@codefast/cli 0.3.7-canary.0 → 0.3.12
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 +60 -299
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +5 -0
- package/dist/commands/arrange.d.ts +3 -0
- package/dist/commands/arrange.d.ts.map +1 -0
- package/dist/commands/arrange.js +114 -0
- package/dist/commands/mirror.d.ts +4 -0
- package/dist/commands/mirror.d.ts.map +1 -0
- package/dist/commands/mirror.js +63 -0
- package/dist/lib/arrange/analyze.d.ts +4 -0
- package/dist/lib/arrange/analyze.d.ts.map +1 -0
- package/dist/lib/arrange/analyze.js +105 -0
- package/dist/lib/arrange/ast/collectors-cn.d.ts +10 -0
- package/dist/lib/arrange/ast/collectors-cn.d.ts.map +1 -0
- package/dist/lib/arrange/ast/collectors-cn.js +84 -0
- package/dist/lib/arrange/ast/collectors-jsx.d.ts +4 -0
- package/dist/lib/arrange/ast/collectors-jsx.d.ts.map +1 -0
- package/dist/lib/arrange/ast/collectors-jsx.js +18 -0
- package/dist/lib/arrange/ast/collectors-tv.d.ts +13 -0
- package/dist/lib/arrange/ast/collectors-tv.d.ts.map +1 -0
- package/dist/lib/arrange/ast/collectors-tv.js +273 -0
- package/dist/lib/arrange/ast/targets.d.ts +8 -0
- package/dist/lib/arrange/ast/targets.d.ts.map +1 -0
- package/dist/lib/arrange/ast/targets.js +143 -0
- package/dist/lib/arrange/ast/utils.d.ts +36 -0
- package/dist/lib/arrange/ast/utils.d.ts.map +1 -0
- package/dist/lib/arrange/ast/utils.js +138 -0
- package/dist/lib/arrange/constants.d.ts +68 -0
- package/dist/lib/arrange/constants.d.ts.map +1 -0
- package/dist/lib/arrange/constants.js +179 -0
- package/dist/lib/arrange/errors.d.ts +14 -0
- package/dist/lib/arrange/errors.d.ts.map +1 -0
- package/dist/lib/arrange/errors.js +16 -0
- package/dist/lib/arrange/formatters.d.ts +16 -0
- package/dist/lib/arrange/formatters.d.ts.map +1 -0
- package/dist/lib/arrange/formatters.js +57 -0
- package/dist/lib/arrange/group-file.d.ts +4 -0
- package/dist/lib/arrange/group-file.d.ts.map +1 -0
- package/dist/lib/arrange/group-file.js +115 -0
- package/dist/lib/arrange/grouping.d.ts +41 -0
- package/dist/lib/arrange/grouping.d.ts.map +1 -0
- package/dist/lib/arrange/grouping.js +280 -0
- package/dist/lib/arrange/imports.d.ts +6 -0
- package/dist/lib/arrange/imports.d.ts.map +1 -0
- package/dist/lib/arrange/imports.js +74 -0
- package/dist/lib/arrange/report.d.ts +4 -0
- package/dist/lib/arrange/report.d.ts.map +1 -0
- package/dist/lib/arrange/report.js +37 -0
- package/dist/lib/arrange/run-target.d.ts +4 -0
- package/dist/lib/arrange/run-target.d.ts.map +1 -0
- package/dist/lib/arrange/run-target.js +28 -0
- package/dist/lib/arrange/tokenizer.d.ts +37 -0
- package/dist/lib/arrange/tokenizer.d.ts.map +1 -0
- package/dist/lib/arrange/tokenizer.js +390 -0
- package/dist/lib/arrange/types.d.ts +104 -0
- package/dist/lib/arrange/types.d.ts.map +1 -0
- package/dist/lib/arrange/types.js +7 -0
- package/dist/lib/arrange/walk.d.ts +4 -0
- package/dist/lib/arrange/walk.d.ts.map +1 -0
- package/dist/lib/arrange/walk.js +34 -0
- package/dist/lib/arrange.d.ts +41 -0
- package/dist/lib/arrange.d.ts.map +1 -0
- package/dist/lib/arrange.js +38 -0
- package/dist/lib/infra/fs-contract.d.ts +28 -0
- package/dist/lib/infra/fs-contract.d.ts.map +1 -0
- package/dist/lib/infra/fs-contract.js +1 -0
- package/dist/lib/infra/node-io.d.ts +4 -0
- package/dist/lib/infra/node-io.d.ts.map +1 -0
- package/dist/lib/infra/node-io.js +27 -0
- package/dist/lib/mirror/config.d.ts +7 -0
- package/dist/lib/mirror/config.d.ts.map +1 -0
- package/dist/lib/mirror/config.js +146 -0
- package/dist/lib/mirror/constants.d.ts +10 -0
- package/dist/lib/mirror/constants.d.ts.map +1 -0
- package/dist/lib/mirror/constants.js +13 -0
- package/dist/lib/mirror/engine.d.ts +12 -0
- package/dist/lib/mirror/engine.d.ts.map +1 -0
- package/dist/lib/mirror/engine.js +248 -0
- package/dist/lib/mirror/errors.d.ts +10 -0
- package/dist/lib/mirror/errors.d.ts.map +1 -0
- package/dist/lib/mirror/errors.js +12 -0
- package/dist/lib/mirror/package-filter.d.ts +8 -0
- package/dist/lib/mirror/package-filter.d.ts.map +1 -0
- package/dist/lib/mirror/package-filter.js +33 -0
- package/dist/lib/mirror/reporter.d.ts +24 -0
- package/dist/lib/mirror/reporter.d.ts.map +1 -0
- package/dist/lib/mirror/reporter.js +126 -0
- package/dist/lib/mirror/sync.d.ts +4 -0
- package/dist/lib/mirror/sync.d.ts.map +1 -0
- package/dist/lib/mirror/sync.js +135 -0
- package/dist/lib/mirror/types.d.ts +81 -0
- package/dist/lib/mirror/types.d.ts.map +1 -0
- package/dist/lib/mirror/types.js +1 -0
- package/dist/lib/mirror/update-pkg.d.ts +13 -0
- package/dist/lib/mirror/update-pkg.d.ts.map +1 -0
- package/dist/lib/mirror/update-pkg.js +39 -0
- package/dist/lib/mirror/workspace-packages.d.ts +26 -0
- package/dist/lib/mirror/workspace-packages.d.ts.map +1 -0
- package/dist/lib/mirror/workspace-packages.js +160 -0
- package/dist/lib/mirror.d.ts +7 -0
- package/dist/lib/mirror.d.ts.map +1 -0
- package/dist/lib/mirror.js +5 -0
- package/dist/lib/repo-root.d.ts +7 -0
- package/dist/lib/repo-root.d.ts.map +1 -0
- package/dist/lib/repo-root.js +23 -0
- package/dist/lib/shared/utils.d.ts +9 -0
- package/dist/lib/shared/utils.d.ts.map +1 -0
- package/dist/lib/shared/utils.js +12 -0
- package/dist/program.d.ts +4 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +38 -0
- package/package.json +42 -53
- package/CHANGELOG.md +0 -15
- package/dist/cjs/index.cjs +0 -2
- package/dist/cjs/src/index.d.ts +0 -3
- package/dist/cjs/src/index.d.ts.map +0 -1
- package/dist/esm/index.js +0 -2
- package/dist/esm/src/index.d.ts +0 -3
- package/dist/esm/src/index.d.ts.map +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CliFs } from "#lib/infra/fs-contract";
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the monorepo root (directory containing `pnpm-workspace.yaml`).
|
|
4
|
+
* Tries the compiled package location first, then `process.cwd()`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function findRepoRoot(fs: CliFs): string;
|
|
7
|
+
//# sourceMappingURL=repo-root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo-root.d.ts","sourceRoot":"","sources":["../../src/lib/repo-root.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,KAAK,GAAG,MAAM,CAoB9C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
/**
|
|
4
|
+
* Resolve the monorepo root (directory containing `pnpm-workspace.yaml`).
|
|
5
|
+
* Tries the compiled package location first, then `process.cwd()`.
|
|
6
|
+
*/
|
|
7
|
+
export function findRepoRoot(fs) {
|
|
8
|
+
const candidates = [path.dirname(fileURLToPath(import.meta.url)), process.cwd()];
|
|
9
|
+
for (const start of candidates) {
|
|
10
|
+
let dir = path.resolve(start);
|
|
11
|
+
for (;;) {
|
|
12
|
+
if (fs.existsSync(path.join(dir, "pnpm-workspace.yaml"))) {
|
|
13
|
+
return dir;
|
|
14
|
+
}
|
|
15
|
+
const parent = path.dirname(dir);
|
|
16
|
+
if (parent === dir) {
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
dir = parent;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
throw new Error(`Could not locate monorepo root (missing pnpm-workspace.yaml). Searched from: ${candidates.join(", ")}`);
|
|
23
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Dirent } from "node:fs";
|
|
2
|
+
/**
|
|
3
|
+
* Narrow `fs.promises.readdir` overload result to `Dirent[]` when `withFileTypes: true`.
|
|
4
|
+
* Accepts both historical checks (`isFile` / `isDirectory`) in one guard.
|
|
5
|
+
* Returning `true` for an empty array is intentional: callers treat empty lists
|
|
6
|
+
* the same regardless of the element type, so `[]` is safely accepted as `Dirent[]`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isDirentList(x: string[] | Dirent[]): x is Dirent[];
|
|
9
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/shared/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,CAAC,IAAI,MAAM,EAAE,CAIlE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Narrow `fs.promises.readdir` overload result to `Dirent[]` when `withFileTypes: true`.
|
|
3
|
+
* Accepts both historical checks (`isFile` / `isDirectory`) in one guard.
|
|
4
|
+
* Returning `true` for an empty array is intentional: callers treat empty lists
|
|
5
|
+
* the same regardless of the element type, so `[]` is safely accepted as `Dirent[]`.
|
|
6
|
+
*/
|
|
7
|
+
export function isDirentList(x) {
|
|
8
|
+
if (x.length === 0)
|
|
9
|
+
return true;
|
|
10
|
+
const first = x[0];
|
|
11
|
+
return typeof first === "object" && first !== null && "isFile" in first && "isDirectory" in first;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBpC,wBAAgB,aAAa,IAAI,OAAO,CAcvC;AAED,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAK5D"}
|
package/dist/program.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import process from "node:process";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { Command } from "commander";
|
|
6
|
+
import { registerArrangeCommand } from "#commands/arrange";
|
|
7
|
+
import { registerMirrorCommand } from "#commands/mirror";
|
|
8
|
+
function readVersion() {
|
|
9
|
+
try {
|
|
10
|
+
const dir = path.dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const pkgPath = path.join(dir, "..", "package.json");
|
|
12
|
+
const raw = readFileSync(pkgPath, "utf-8");
|
|
13
|
+
const pkgVersion = JSON.parse(raw).version;
|
|
14
|
+
return typeof pkgVersion === "string" && pkgVersion.length > 0 ? pkgVersion : "unknown";
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return "unknown";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function createProgram() {
|
|
21
|
+
const program = new Command();
|
|
22
|
+
program
|
|
23
|
+
.name("codefast")
|
|
24
|
+
.description("Codefast monorepo developer CLI")
|
|
25
|
+
.version(readVersion())
|
|
26
|
+
.option("--no-color", "Disable ANSI color output")
|
|
27
|
+
.configureHelp({ sortSubcommands: true })
|
|
28
|
+
.showHelpAfterError("(use --help for usage)");
|
|
29
|
+
registerMirrorCommand(program);
|
|
30
|
+
registerArrangeCommand(program);
|
|
31
|
+
return program;
|
|
32
|
+
}
|
|
33
|
+
export async function runCli(argv) {
|
|
34
|
+
const program = createProgram();
|
|
35
|
+
await program.parseAsync(argv, { from: "node" });
|
|
36
|
+
const code = process.exitCode ?? 0;
|
|
37
|
+
return typeof code === "number" ? code : Number(code) || 0;
|
|
38
|
+
}
|
package/package.json
CHANGED
|
@@ -1,88 +1,77 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codefast/cli",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.3.12",
|
|
4
|
+
"description": "Developer CLI for the Codefast monorepo (mirror, arrange)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
7
|
-
"
|
|
8
|
-
"tools",
|
|
9
|
-
"typescript",
|
|
7
|
+
"codefast",
|
|
10
8
|
"monorepo",
|
|
11
|
-
"
|
|
9
|
+
"tailwind",
|
|
10
|
+
"tailwindcss",
|
|
11
|
+
"typescript"
|
|
12
12
|
],
|
|
13
13
|
"homepage": "https://github.com/codefastlabs/codefast/tree/main/packages/cli#readme",
|
|
14
14
|
"bugs": {
|
|
15
15
|
"url": "https://github.com/codefastlabs/codefast/issues"
|
|
16
16
|
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": "Vuong Phan <mr.thevuong@gmail.com>",
|
|
17
19
|
"repository": {
|
|
18
20
|
"type": "git",
|
|
19
21
|
"url": "git+https://github.com/codefastlabs/codefast.git",
|
|
20
22
|
"directory": "packages/cli"
|
|
21
23
|
},
|
|
22
|
-
"license": "MIT",
|
|
23
|
-
"author": "Vuong Phan <mr.thevuong@gmail.com>",
|
|
24
|
-
"sideEffects": false,
|
|
25
|
-
"type": "module",
|
|
26
|
-
"exports": {
|
|
27
|
-
".": {
|
|
28
|
-
"import": {
|
|
29
|
-
"default": "./dist/esm/index.js",
|
|
30
|
-
"types": "./dist/esm/index.d.ts"
|
|
31
|
-
},
|
|
32
|
-
"require": {
|
|
33
|
-
"default": "./dist/cjs/index.cjs",
|
|
34
|
-
"types": "./dist/cjs/index.d.cts"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
"main": "./dist/cjs/index.cjs",
|
|
39
|
-
"module": "./dist/esm/index.js",
|
|
40
|
-
"types": "./dist/esm/index.d.ts",
|
|
41
24
|
"bin": {
|
|
42
|
-
"codefast": "./dist/
|
|
25
|
+
"codefast": "./dist/bin.js"
|
|
43
26
|
},
|
|
44
27
|
"files": [
|
|
45
28
|
"dist",
|
|
46
|
-
"
|
|
29
|
+
"LICENSE",
|
|
47
30
|
"README.md",
|
|
48
|
-
"
|
|
31
|
+
"package.json"
|
|
49
32
|
],
|
|
33
|
+
"type": "module",
|
|
34
|
+
"imports": {
|
|
35
|
+
"#*": [
|
|
36
|
+
"./dist/*.js",
|
|
37
|
+
"./dist/*/index.js",
|
|
38
|
+
"./dist/*",
|
|
39
|
+
"./src/*.ts",
|
|
40
|
+
"./src/*.tsx",
|
|
41
|
+
"./src/*/index.ts",
|
|
42
|
+
"./src/*/index.tsx",
|
|
43
|
+
"./src/*"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
50
49
|
"dependencies": {
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"reflect-metadata": "^0.2.2",
|
|
56
|
-
"ts-morph": "^26.0.0",
|
|
57
|
-
"zod": "^4.0.10"
|
|
50
|
+
"commander": "^14.0.3",
|
|
51
|
+
"picomatch": "^4.0.4",
|
|
52
|
+
"typescript": "^6.0.2",
|
|
53
|
+
"yaml": "^2.8.3"
|
|
58
54
|
},
|
|
59
55
|
"devDependencies": {
|
|
60
|
-
"@
|
|
61
|
-
"@swc/core": "^1.13.2",
|
|
56
|
+
"@swc/core": "^1.15.24",
|
|
62
57
|
"@swc/jest": "^0.2.39",
|
|
63
58
|
"@types/jest": "^30.0.0",
|
|
64
|
-
"@types/node": "^
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"typescript": "^5.8.3",
|
|
70
|
-
"@codefast/eslint-config": "0.3.7-canary.0",
|
|
71
|
-
"@codefast/typescript-config": "0.3.7-canary.0"
|
|
59
|
+
"@types/node": "^25.6.0",
|
|
60
|
+
"@types/picomatch": "^4.0.3",
|
|
61
|
+
"@typescript/native-preview": "7.0.0-dev.20260411.1",
|
|
62
|
+
"jest": "^30.3.0",
|
|
63
|
+
"@codefast/typescript-config": "0.3.12"
|
|
72
64
|
},
|
|
73
|
-
"
|
|
74
|
-
"
|
|
65
|
+
"engines": {
|
|
66
|
+
"node": ">=24.0.0"
|
|
75
67
|
},
|
|
76
68
|
"scripts": {
|
|
77
|
-
"build": "
|
|
69
|
+
"build": "rm -rf dist && tsgo -p tsconfig.build.json",
|
|
70
|
+
"check-types": "tsgo --noEmit",
|
|
78
71
|
"clean": "rm -rf dist",
|
|
79
|
-
"dev": "rslib build --watch",
|
|
80
|
-
"lint": "TIMING=1 eslint --max-warnings 0 .",
|
|
81
|
-
"lint:fix": "TIMING=1 eslint --max-warnings 0 --fix .",
|
|
82
72
|
"test": "jest",
|
|
83
73
|
"test:coverage": "jest --coverage",
|
|
84
74
|
"test:coverage:ci": "jest --coverage --ci",
|
|
85
|
-
"test:watch": "jest --watch"
|
|
86
|
-
"type-check": "tsc --noEmit"
|
|
75
|
+
"test:watch": "jest --watch"
|
|
87
76
|
}
|
|
88
77
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# @codefast/cli
|
|
2
|
-
|
|
3
|
-
## 0.3.7-canary.0
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- [`e66e9ac`](https://github.com/codefastlabs/codefast/commit/e66e9ac1186a94cb30d83d7125d4991ee91c7a41) Thanks [@thevuong](https://github.com/thevuong)! - refactor: improve readability and naming consistency across multiple packages
|
|
8
|
-
|
|
9
|
-
- [`161717d`](https://github.com/codefastlabs/codefast/commit/161717db82457444b793bad252099084ef490085) Thanks [@thevuong](https://github.com/thevuong)! - feat(eslint-config): strengthen unicorn and TypeScript rule configurations
|
|
10
|
-
|
|
11
|
-
- [`dea11de`](https://github.com/codefastlabs/codefast/commit/dea11deef4cab04a9ed2cd411251f6ad939acba6) Thanks [@thevuong](https://github.com/thevuong)! - chore(ui): integrate `tw-animate-css` and enhance animation easing consistency
|
|
12
|
-
|
|
13
|
-
- [`2f0fd79`](https://github.com/codefastlabs/codefast/commit/2f0fd791d1505279a9c8570f8f3fddcf058d64ee) Thanks [@thevuong](https://github.com/thevuong)! - chore: reorder imports for consistency and clarity
|
|
14
|
-
|
|
15
|
-
- [`728b150`](https://github.com/codefastlabs/codefast/commit/728b1503583d1f130c2f0abd503343dd8c802ee6) Thanks [@thevuong](https://github.com/thevuong)! - chore(tests): remove obsolete test files for core use cases and adapters
|
package/dist/cjs/index.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_exports__={};function main(){console.log("Hello, world!")}for(var __webpack_i__ in main(),__webpack_exports__)exports[__webpack_i__]=__webpack_exports__[__webpack_i__];Object.defineProperty(exports,"__esModule",{value:!0});
|
package/dist/cjs/src/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":""}
|
package/dist/esm/index.js
DELETED
package/dist/esm/src/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":""}
|