@codefast/cli 0.3.1-canary.1 → 0.3.1-canary.3

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.
Files changed (79) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/dist/index.cjs +430 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.js +397 -0
  5. package/dist/index.js.map +1 -0
  6. package/package.json +17 -10
  7. package/.turbo/turbo-build.log +0 -12
  8. package/dist/cjs/commands/update-exports/analyze-imports.cjs +0 -92
  9. package/dist/cjs/commands/update-exports/analyze-imports.cjs.map +0 -1
  10. package/dist/cjs/commands/update-exports/command.cjs +0 -58
  11. package/dist/cjs/commands/update-exports/command.cjs.map +0 -1
  12. package/dist/cjs/commands/update-exports/config.cjs +0 -113
  13. package/dist/cjs/commands/update-exports/config.cjs.map +0 -1
  14. package/dist/cjs/commands/update-exports/file-utils.cjs +0 -144
  15. package/dist/cjs/commands/update-exports/file-utils.cjs.map +0 -1
  16. package/dist/cjs/commands/update-exports/generate-exports.cjs +0 -76
  17. package/dist/cjs/commands/update-exports/generate-exports.cjs.map +0 -1
  18. package/dist/cjs/commands/update-exports/index.cjs +0 -36
  19. package/dist/cjs/commands/update-exports/process-package.cjs +0 -143
  20. package/dist/cjs/commands/update-exports/process-package.cjs.map +0 -1
  21. package/dist/cjs/commands/update-exports/types.cjs +0 -55
  22. package/dist/cjs/commands/update-exports/types.cjs.map +0 -1
  23. package/dist/cjs/index.cjs +0 -46
  24. package/dist/cjs/index.cjs.map +0 -1
  25. package/dist/cjs/lib/logger.cjs +0 -72
  26. package/dist/cjs/lib/logger.cjs.map +0 -1
  27. package/dist/esm/commands/update-exports/analyze-imports.js +0 -58
  28. package/dist/esm/commands/update-exports/analyze-imports.js.map +0 -1
  29. package/dist/esm/commands/update-exports/command.js +0 -24
  30. package/dist/esm/commands/update-exports/command.js.map +0 -1
  31. package/dist/esm/commands/update-exports/config.js +0 -62
  32. package/dist/esm/commands/update-exports/config.js.map +0 -1
  33. package/dist/esm/commands/update-exports/file-utils.js +0 -81
  34. package/dist/esm/commands/update-exports/file-utils.js.map +0 -1
  35. package/dist/esm/commands/update-exports/generate-exports.js +0 -42
  36. package/dist/esm/commands/update-exports/generate-exports.js.map +0 -1
  37. package/dist/esm/commands/update-exports/index.js +0 -3
  38. package/dist/esm/commands/update-exports/process-package.js +0 -93
  39. package/dist/esm/commands/update-exports/process-package.js.map +0 -1
  40. package/dist/esm/commands/update-exports/types.js +0 -18
  41. package/dist/esm/commands/update-exports/types.js.map +0 -1
  42. package/dist/esm/index.js +0 -18
  43. package/dist/esm/index.js.map +0 -1
  44. package/dist/esm/lib/logger.js +0 -28
  45. package/dist/esm/lib/logger.js.map +0 -1
  46. package/dist/types/src/commands/update-exports/analyze-imports.d.ts +0 -9
  47. package/dist/types/src/commands/update-exports/analyze-imports.d.ts.map +0 -1
  48. package/dist/types/src/commands/update-exports/command.d.ts +0 -7
  49. package/dist/types/src/commands/update-exports/command.d.ts.map +0 -1
  50. package/dist/types/src/commands/update-exports/config.d.ts +0 -16
  51. package/dist/types/src/commands/update-exports/config.d.ts.map +0 -1
  52. package/dist/types/src/commands/update-exports/file-utils.d.ts +0 -47
  53. package/dist/types/src/commands/update-exports/file-utils.d.ts.map +0 -1
  54. package/dist/types/src/commands/update-exports/generate-exports.d.ts +0 -11
  55. package/dist/types/src/commands/update-exports/generate-exports.d.ts.map +0 -1
  56. package/dist/types/src/commands/update-exports/index.d.ts +0 -2
  57. package/dist/types/src/commands/update-exports/index.d.ts.map +0 -1
  58. package/dist/types/src/commands/update-exports/process-package.d.ts +0 -23
  59. package/dist/types/src/commands/update-exports/process-package.d.ts.map +0 -1
  60. package/dist/types/src/commands/update-exports/types.d.ts +0 -83
  61. package/dist/types/src/commands/update-exports/types.d.ts.map +0 -1
  62. package/dist/types/src/index.d.ts +0 -3
  63. package/dist/types/src/index.d.ts.map +0 -1
  64. package/dist/types/src/lib/logger.d.ts +0 -15
  65. package/dist/types/src/lib/logger.d.ts.map +0 -1
  66. package/eslint.config.js +0 -18
  67. package/rslib.config.ts +0 -40
  68. package/src/commands/update-exports/analyze-imports.ts +0 -112
  69. package/src/commands/update-exports/command.ts +0 -38
  70. package/src/commands/update-exports/config.ts +0 -99
  71. package/src/commands/update-exports/file-utils.ts +0 -178
  72. package/src/commands/update-exports/generate-exports.ts +0 -74
  73. package/src/commands/update-exports/index.ts +0 -1
  74. package/src/commands/update-exports/process-package.ts +0 -164
  75. package/src/commands/update-exports/types.ts +0 -94
  76. package/src/index.ts +0 -28
  77. package/src/lib/logger.ts +0 -39
  78. package/tsconfig.build.json +0 -5
  79. package/tsconfig.json +0 -14
@@ -1,94 +0,0 @@
1
- import { z } from "zod";
2
-
3
- // Schema for package configuration, defining output patterns and paths
4
- export const PackageConfigSchema = z.interface({
5
- // Output path pattern for CommonJS (CJS) modules
6
- // Example: "dist/cjs/*.js" specifies where CJS files are emitted
7
- cjsOutputPattern: z.string(),
8
- // Output path pattern for ES Modules (ESM)
9
- // Example: "dist/esm/*.js" specifies where ESM files are emitted
10
- esmOutputPattern: z.string(),
11
- // Path to the package.json file
12
- // Used to read or update package metadata (e.g., version, exports)
13
- packageJsonPath: z.string(),
14
- // Path to the src/index.ts file
15
- // Main entry point for analyzing exports or building the package
16
- srcIndexPath: z.string(),
17
- // Output path pattern for CJS type definitions
18
- // Example: "dist/cjs/*.d.ts" for CJS-compatible type definitions
19
- typesOutputCjsPattern: z.string(),
20
- // General output path pattern for type definitions
21
- // Example: "dist/types/*.d.ts" for type definitions used by both CJS and ESM
22
- typesOutputPattern: z.string(),
23
- // Optional prefixes to strip from export paths
24
- // Example: ["components"] removes "components" from export paths
25
- "exportPathPrefixesToRemove?": z.array(z.string()),
26
- });
27
-
28
- // Schema for script configuration, defining package discovery and defaults
29
- export const ScriptConfigSchema = z.interface({
30
- // Custom configurations for specific packages
31
- // Key is the package name, value is a partial override of defaultPackageConfig
32
- // Example: { "my-package": { cjsOutputPattern: "dist/custom/*.js" } }
33
- customPackageConfigs: z.record(z.string(), PackageConfigSchema.partial()),
34
- // Default configuration applied to all packages
35
- // Ensures consistent settings unless overridden
36
- defaultPackageConfig: PackageConfigSchema,
37
- // Glob pattern to locate packages in the project
38
- // Example: "packages/*" finds all package folders under packages/
39
- packagesGlob: z.string(),
40
- });
41
-
42
- // TypeScript type inferred from schemas for type safety
43
- export type PackageConfig = z.infer<typeof PackageConfigSchema>;
44
- export type ScriptConfig = z.infer<typeof ScriptConfigSchema>;
45
-
46
- // Interface for import path metadata
47
- export interface ImportPath {
48
- // Directory containing the module (e.g., 'components')
49
- directory: string;
50
- // Export path for package.json (e.g., './button')
51
- exportPath: string;
52
- // Module name (e.g., 'Button')
53
- name: string;
54
- // Original import path (e.g., './components/Button')
55
- originalPath: string;
56
- }
57
-
58
- // Interface for import analysis results
59
- export interface AnalysisResult {
60
- // List of analyzed import paths
61
- imports: ImportPath[];
62
- }
63
-
64
- // Interface for module export configuration
65
- export interface ExportConfig {
66
- import: {
67
- default: string; // ESM default file (e.g., "./dist/esm/index.js")
68
- types: string; // ESM type definitions (e.g., "./dist/types/index.d.ts")
69
- };
70
- require: {
71
- default: string; // CJS default file (e.g., "./dist/cjs/index.cjs")
72
- types: string; // CJS type definitions (e.g., "./dist/types/index.d.cts")
73
- };
74
- }
75
-
76
- export type ExportTarget = ExportConfig | string;
77
- export type PackageExports = Record<string, ExportTarget>;
78
-
79
- // Interface for package.json structure
80
- export interface PackageJson {
81
- [key: string]: unknown;
82
- name: string;
83
- version: string;
84
-
85
- exports?: PackageExports;
86
- }
87
-
88
- // Options for processing packages
89
- export interface ProcessOptions {
90
- dryRun: boolean;
91
- verbose: boolean;
92
- configPath?: string;
93
- packageFilter?: string;
94
- }
package/src/index.ts DELETED
@@ -1,28 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { Command } from "commander";
4
-
5
- import { createUpdateExportsCommand } from "@/commands/update-exports";
6
-
7
- import packageJson from "../package.json";
8
-
9
- function main(): void {
10
- const program = new Command();
11
-
12
- program
13
- .name("codefast")
14
- .description("CodeFast CLI - A development toolkit for CodeFast.")
15
- .version(packageJson.version, "-v, --version", "display CLI version");
16
-
17
- createUpdateExportsCommand(program);
18
-
19
- program.action(() => {
20
- console.log('Use "codefast update-exports" to update exports.');
21
- console.log('Run "codefast --help" to see all available commands.');
22
- program.help();
23
- });
24
-
25
- program.parse(process.argv);
26
- }
27
-
28
- main();
package/src/lib/logger.ts DELETED
@@ -1,39 +0,0 @@
1
- import chalk from "chalk";
2
-
3
- interface LoggerOptions {
4
- verbose?: boolean;
5
- }
6
-
7
- export class Logger {
8
- private readonly verbose: boolean;
9
-
10
- constructor(options: LoggerOptions = {}) {
11
- this.verbose = options.verbose ?? false;
12
- }
13
-
14
- info(message: string, ...args: any[]): void {
15
- console.log(chalk.blue(message), ...args);
16
- }
17
-
18
- success(message: string, ...args: any[]): void {
19
- console.log(chalk.green(message), ...args);
20
- }
21
-
22
- warn(message: string, ...args: any[]): void {
23
- console.log(chalk.yellow(message), ...args);
24
- }
25
-
26
- error(message: string, ...args: any[]): void {
27
- console.error(chalk.red(message), ...args);
28
- }
29
-
30
- debug(message: string, ...args: any[]): void {
31
- if (this.verbose) {
32
- console.log(chalk.gray(message), ...args);
33
- }
34
- }
35
-
36
- table(data: any[]): void {
37
- console.table(data);
38
- }
39
- }
@@ -1,5 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "include": ["src/**/*"],
4
- "exclude": ["node_modules", "dist", ".turbo", "coverage", "/**/*.test.*", "**/*.spec.*"]
5
- }
package/tsconfig.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "extends": "@codefast/typescript-config/library.json",
3
- "compilerOptions": {
4
- "baseUrl": ".",
5
- "esModuleInterop": true,
6
- "outDir": "dist",
7
- "paths": {
8
- "@/*": ["./src/*"]
9
- },
10
- "resolveJsonModule": true
11
- },
12
- "include": ["**/*.ts", "**/*.tsx"],
13
- "exclude": ["node_modules", "dist", ".turbo", "coverage"]
14
- }