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

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 +99 -1
  2. package/dist/index.cjs +1011 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.js +978 -0
  5. package/dist/index.js.map +1 -0
  6. package/package.json +19 -12
  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,178 +0,0 @@
1
- import fs from "node:fs";
2
- import path from "node:path";
3
-
4
- import type { AnalysisResult, PackageExports, PackageJson } from "@/commands/update-exports/types";
5
-
6
- // Constants for file operations
7
- const EXPORTS_ANALYSIS_DIR = ".exports-analysis";
8
- const EXPORTS_PREVIEW_FILE = "exports-preview.json";
9
- const EXPORTS_ANALYSIS_FILE = "exports-analysis.json";
10
- const ENCODING = "utf8";
11
- const JSON_INDENT = 2;
12
- /**
13
- * Utility functions for file and directory operations
14
- */
15
- const FileUtils = {
16
- /**
17
- * Checks if a file exists
18
- * @param filePath - Path to check
19
- * @returns True if a file exists
20
- */
21
- exists(filePath: string): boolean {
22
- return fs.existsSync(filePath);
23
- },
24
-
25
- /**
26
- * Creates a directory if it doesn't exist
27
- * @param dirPath - Directory path
28
- */
29
- ensureDirectoryExists(dirPath: string): void {
30
- if (!fs.existsSync(dirPath)) {
31
- fs.mkdirSync(dirPath, { recursive: true });
32
- }
33
- },
34
-
35
- /**
36
- * Reads and parses a JSON file
37
- * @param filePath - Path to JSON file
38
- * @returns Parsed content or null if error
39
- */
40
- readJsonFile<T>(filePath: string): null | T {
41
- try {
42
- const content = fs.readFileSync(filePath, ENCODING);
43
-
44
- return JSON.parse(content) as T;
45
- } catch (error) {
46
- console.error(`Error reading JSON file at ${filePath}:`, error);
47
-
48
- return null;
49
- }
50
- },
51
-
52
- /**
53
- * Writes content to a JSON file
54
- * @param filePath - Path to write
55
- * @param content - Content to write
56
- * @returns True if successful
57
- */
58
- writeJsonFile<T>(filePath: string, content: T): boolean {
59
- try {
60
- fs.writeFileSync(filePath, `${JSON.stringify(content, null, JSON_INDENT)}\n`, ENCODING);
61
-
62
- return true;
63
- } catch (error) {
64
- console.error(`Error writing JSON file at ${filePath}:`, error);
65
-
66
- return false;
67
- }
68
- },
69
-
70
- /**
71
- * Gets the exports analysis directory path
72
- * @param packageDir - Package directory
73
- * @returns Analysis directory path
74
- */
75
- getAnalysisDir(packageDir: string): string {
76
- const outputDir = path.join(packageDir, EXPORTS_ANALYSIS_DIR);
77
-
78
- this.ensureDirectoryExists(outputDir);
79
-
80
- return outputDir;
81
- },
82
-
83
- /**
84
- * Creates a timestamped backup filename
85
- * @param baseFilename - Original filename
86
- * @returns Backup filename with timestamp
87
- */
88
- createBackupFilename(baseFilename: string): string {
89
- const timestamp = new Date().toISOString().replaceAll(/[:.]/g, "-");
90
-
91
- return `${baseFilename}.backup.${timestamp}`;
92
- },
93
- };
94
-
95
- /**
96
- * Checks if a file exists
97
- * @param filePath - Path to check
98
- * @returns True if a file exists
99
- */
100
- export function fileExists(filePath: string): boolean {
101
- return FileUtils.exists(filePath);
102
- }
103
-
104
- /**
105
- * Reads and parses package.json content
106
- * @param filePath - Path to package.json
107
- * @returns Parsed PackageJson or null if error
108
- */
109
- export function readPackageJson(filePath: string): null | PackageJson {
110
- return FileUtils.readJsonFile<PackageJson>(filePath);
111
- }
112
-
113
- /**
114
- * Creates a backup of package.json
115
- * @param filePath - Path to package.json
116
- * @returns True if backup was successful
117
- */
118
- export function backupPackageJson(filePath: string): boolean {
119
- try {
120
- const content = fs.readFileSync(filePath, ENCODING);
121
- const dir = path.dirname(filePath);
122
- const backupDir = path.join(dir, EXPORTS_ANALYSIS_DIR);
123
-
124
- FileUtils.ensureDirectoryExists(backupDir);
125
-
126
- const baseName = path.basename(filePath);
127
- const backupPath = path.join(backupDir, FileUtils.createBackupFilename(baseName));
128
-
129
- fs.writeFileSync(backupPath, content, ENCODING);
130
-
131
- return true;
132
- } catch (error) {
133
- console.error(`Error backing up package.json at ${filePath}:`, error);
134
-
135
- return false;
136
- }
137
- }
138
-
139
- /**
140
- * Saves updated package.json content
141
- * @param filePath - Path to package.json
142
- * @param content - Updated content
143
- * @returns True if save was successful
144
- */
145
- export function savePackageJson(filePath: string, content: PackageJson): boolean {
146
- return FileUtils.writeJsonFile(filePath, content);
147
- }
148
-
149
- /**
150
- * Saves the given JSON content to a specified file within the analysis directory.
151
- *
152
- * @param packageDir - The root directory where the analysis directory resides.
153
- * @param fileName - The name of the file to which the JSON content will be written.
154
- * @param content - The JSON content to save to the file.
155
- */
156
- export function saveJsonToFile<T>(packageDir: string, fileName: string, content: T): void {
157
- const outputDir = FileUtils.getAnalysisDir(packageDir);
158
-
159
- FileUtils.writeJsonFile(path.join(outputDir, fileName), content);
160
- }
161
-
162
- /**
163
- * Saves exports analysis results
164
- * @param packageDir - Package directory
165
- * @param analysis - Analysis results
166
- */
167
- export function saveExportsAnalysis(packageDir: string, analysis: AnalysisResult): void {
168
- saveJsonToFile(packageDir, EXPORTS_ANALYSIS_FILE, analysis);
169
- }
170
-
171
- /**
172
- * Saves preview of generated exports
173
- * @param packageDir - Package directory
174
- * @param exports - Generated exports
175
- */
176
- export function saveExportsPreview(packageDir: string, exports: PackageExports): void {
177
- saveJsonToFile(packageDir, EXPORTS_PREVIEW_FILE, exports);
178
- }
@@ -1,74 +0,0 @@
1
- import type { ImportPath, PackageExports, ScriptConfig } from "@/commands/update-exports/types";
2
-
3
- import { getPackageConfig } from "@/commands/update-exports/config";
4
-
5
- /**
6
- * Formats an output path based on a pattern, directory, and name
7
- * @param pattern - Output pattern
8
- * @param directory - Directory path
9
- * @param name - Module name
10
- * @returns Formatted output path
11
- */
12
- function formatOutputPath(pattern: string, directory: string, name: string): string {
13
- const dirPart = directory === "." ? "" : `${directory}/`;
14
-
15
- return pattern.replace("{dir}/", dirPart).replace("{dir}", directory).replace("{name}", name);
16
- }
17
-
18
- /**
19
- * Generates export structure for package.json
20
- * @param packageName - Name of the package
21
- * @param imports - Analyzed import paths
22
- * @param existingExports - Current exports to preserve
23
- * @param config - Optional ScriptConfig
24
- * @returns Updated PackageExports
25
- */
26
- export function generateExports(
27
- packageName: string,
28
- imports: ImportPath[],
29
- existingExports: PackageExports = {},
30
- config?: ScriptConfig,
31
- ): PackageExports {
32
- const packageConfig = getPackageConfig(packageName, config);
33
-
34
- const exports: PackageExports = {
35
- ".": existingExports["."] ?? {
36
- import: {
37
- types: "./dist/types/index.d.ts",
38
- default: "./dist/esm/index.js",
39
- },
40
- require: {
41
- types: "./dist/types/index.d.cts",
42
- default: "./dist/cjs/index.cjs",
43
- },
44
- },
45
- };
46
-
47
- // Preserve existing CSS exports
48
- if (existingExports["./styles.css"]) {
49
- exports["./styles.css"] = existingExports["./styles.css"];
50
- }
51
-
52
- // Generate exports for each import path
53
- for (const importPath of imports) {
54
- const { directory, name, exportPath } = importPath;
55
-
56
- const esmOutput = formatOutputPath(packageConfig.esmOutputPattern, directory, name);
57
- const cjsOutput = formatOutputPath(packageConfig.cjsOutputPattern, directory, name);
58
- const typesOutput = formatOutputPath(packageConfig.typesOutputPattern, directory, name);
59
- const typesCjsOutput = formatOutputPath(packageConfig.typesOutputCjsPattern, directory, name);
60
-
61
- exports[exportPath] = {
62
- import: {
63
- types: typesOutput,
64
- default: esmOutput,
65
- },
66
- require: {
67
- types: typesCjsOutput,
68
- default: cjsOutput,
69
- },
70
- };
71
- }
72
-
73
- return exports;
74
- }
@@ -1 +0,0 @@
1
- export { createUpdateExportsCommand } from "@/commands/update-exports/command";
@@ -1,164 +0,0 @@
1
- import { glob } from "glob";
2
- import path from "node:path";
3
-
4
- import type { ProcessOptions, ScriptConfig } from "@/commands/update-exports/types";
5
- import type { Logger } from "@/lib/logger";
6
-
7
- import { analyzeImports } from "@/commands/update-exports/analyze-imports";
8
- import { getConfig, getPackageConfig } from "@/commands/update-exports/config";
9
- import {
10
- backupPackageJson,
11
- fileExists,
12
- readPackageJson,
13
- saveExportsAnalysis,
14
- saveExportsPreview,
15
- savePackageJson,
16
- } from "@/commands/update-exports/file-utils";
17
- import { generateExports } from "@/commands/update-exports/generate-exports";
18
-
19
- const DEFAULT_IGNORE_PATTERN = ["**/node_modules/**"];
20
-
21
- /**
22
- * Finds all package.json files in the workspace
23
- * @param config - Optional ScriptConfig
24
- * @returns Array of package.json paths
25
- */
26
- export async function findAllPackages(config?: ScriptConfig): Promise<string[]> {
27
- const configObj = config ?? getConfig();
28
-
29
- return await glob(configObj.packagesGlob, {
30
- ignore: DEFAULT_IGNORE_PATTERN,
31
- });
32
- }
33
-
34
- /**
35
- * Processes a single package
36
- * @param packageJsonPath - Path to package.json
37
- * @param options - Processing options
38
- * @param logger - Logger instance
39
- * @returns True if processing was successful
40
- */
41
- export function processPackage(packageJsonPath: string, options: ProcessOptions, logger: Logger): boolean {
42
- const packageDir = path.dirname(packageJsonPath);
43
- const packageJson = readPackageJson(packageJsonPath);
44
-
45
- if (!packageJson) {
46
- logger.error(`Failed to read ${packageJsonPath}`);
47
-
48
- return false;
49
- }
50
-
51
- const packageName = packageJson.name;
52
-
53
- // Skip if package doesn't match filter
54
- if (options.packageFilter && packageName !== options.packageFilter) {
55
- logger.debug(`Skipping ${packageName} (does not match filter)`);
56
-
57
- return false;
58
- }
59
-
60
- logger.info(`\n📦 Processing package: ${packageName}`);
61
-
62
- const config = getConfig(options.configPath);
63
- const packageConfig = getPackageConfig(packageName, config);
64
- const srcIndexPath = path.join(packageDir, packageConfig.srcIndexPath);
65
-
66
- if (!fileExists(srcIndexPath)) {
67
- logger.error(`Source file not found at ${srcIndexPath}`);
68
-
69
- return false;
70
- }
71
-
72
- // Analyze imports
73
- logger.info(`🔍 Analyzing imports from ${srcIndexPath}...`);
74
- const { imports } = analyzeImports(srcIndexPath, packageConfig);
75
-
76
- if (imports.length === 0) {
77
- logger.warn(`No imports found to analyze in ${packageName}`);
78
-
79
- return false;
80
- }
81
-
82
- logger.success(`Analysis complete. Found ${imports.length} subpath exports.`);
83
-
84
- // Save analysis results
85
- saveExportsAnalysis(packageDir, { imports });
86
-
87
- // Generate new exports
88
- const newExports = generateExports(packageName, imports, packageJson.exports, config);
89
-
90
- // Compare export counts
91
- const currentExportsCount = packageJson.exports ? Object.keys(packageJson.exports).length : 0;
92
- const newExportsCount = Object.keys(newExports).length;
93
-
94
- logger.info(`📊 Exports: ${currentExportsCount} -> ${newExportsCount}`);
95
-
96
- if (options.dryRun) {
97
- saveExportsPreview(packageDir, newExports);
98
- logger.warn(`🧪 📄 Saved exports preview to .exports-analysis`);
99
- logger.warn(`🧪 🚫 Dry run: no changes saved for ${packageName}`);
100
-
101
- return true;
102
- }
103
-
104
- // Backup package.json
105
- if (backupPackageJson(packageJsonPath)) {
106
- logger.success(`Backed up ${packageJsonPath}`);
107
- }
108
-
109
- // Update package.json
110
- const updatedPackageJson = { ...packageJson, exports: newExports };
111
-
112
- if (savePackageJson(packageJsonPath, updatedPackageJson)) {
113
- logger.success(`Updated exports for ${packageName}`);
114
-
115
- return true;
116
- }
117
-
118
- logger.error(`Failed to update ${packageJsonPath}`);
119
-
120
- return false;
121
- }
122
-
123
- /**
124
- * Processes all packages in the workspace
125
- * @param options - Processing options
126
- * @param logger - Logger instance
127
- */
128
- export async function processAllPackages(options: ProcessOptions, logger: Logger): Promise<void> {
129
- try {
130
- logger.info("🔍 Searching for packages...");
131
- const config = getConfig(options.configPath);
132
- const packageJsonPaths = await findAllPackages(config);
133
-
134
- if (packageJsonPaths.length === 0) {
135
- logger.warn("⚠️ No packages found.");
136
-
137
- return;
138
- }
139
-
140
- logger.success(`✅ Found ${packageJsonPaths.length} packages.`);
141
-
142
- let successCount = 0;
143
- let skipCount = 0;
144
- let errorCount = 0;
145
-
146
- for (const packageJsonPath of packageJsonPaths) {
147
- const result = processPackage(packageJsonPath, options, logger);
148
-
149
- if (result) {
150
- successCount++;
151
- } else if (options.packageFilter) {
152
- skipCount++;
153
- } else {
154
- errorCount++;
155
- }
156
- }
157
-
158
- logger.success("\n✅ Completed exports update.");
159
- logger.info(`📊 Stats: ${successCount} succeeded, ${skipCount} skipped, ${errorCount} failed`);
160
- } catch (error) {
161
- logger.error("❌ Error processing packages:", error);
162
- throw error;
163
- }
164
- }
@@ -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
- }