@bemoje/monorepo 1.2.1 → 1.2.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.
- package/README.md +38 -60
- package/lib/index.cjs +32 -5223
- package/lib/index.d.cts +2765 -26
- package/lib/index.d.ts +2765 -26
- package/lib/index.js +27 -5221
- package/package.json +27 -437
- package/lib/MonoRepo.cjs +0 -7370
- package/lib/MonoRepo.d.cts +0 -10
- package/lib/MonoRepo.d.ts +0 -10
- package/lib/MonoRepo.js +0 -7361
- package/lib/code/AbstractCode.cjs +0 -5568
- package/lib/code/AbstractCode.d.cts +0 -30
- package/lib/code/AbstractCode.d.ts +0 -30
- package/lib/code/AbstractCode.js +0 -5562
- package/lib/code/CodeBlock.cjs +0 -5614
- package/lib/code/CodeBlock.d.cts +0 -22
- package/lib/code/CodeBlock.d.ts +0 -22
- package/lib/code/CodeBlock.js +0 -5608
- package/lib/code/TsCode.cjs +0 -7370
- package/lib/code/TsCode.d.cts +0 -10
- package/lib/code/TsCode.d.ts +0 -10
- package/lib/code/TsCode.js +0 -7361
- package/lib/code/imports/ImportKeywords.cjs +0 -5652
- package/lib/code/imports/ImportKeywords.d.cts +0 -10
- package/lib/code/imports/ImportKeywords.d.ts +0 -10
- package/lib/code/imports/ImportKeywords.js +0 -5646
- package/lib/code/imports/ImportSpecifiers.cjs +0 -5708
- package/lib/code/imports/ImportSpecifiers.d.cts +0 -10
- package/lib/code/imports/ImportSpecifiers.d.ts +0 -10
- package/lib/code/imports/ImportSpecifiers.js +0 -5702
- package/lib/code/imports/ImportStatement.cjs +0 -7372
- package/lib/code/imports/ImportStatement.d.cts +0 -10
- package/lib/code/imports/ImportStatement.d.ts +0 -10
- package/lib/code/imports/ImportStatement.js +0 -7363
- package/lib/code/imports/ModuleSpecifier.cjs +0 -7372
- package/lib/code/imports/ModuleSpecifier.d.cts +0 -10
- package/lib/code/imports/ModuleSpecifier.d.ts +0 -10
- package/lib/code/imports/ModuleSpecifier.js +0 -7363
- package/lib/common/AbstractBase.cjs +0 -638
- package/lib/common/AbstractBase.d.cts +0 -3
- package/lib/common/AbstractBase.d.ts +0 -3
- package/lib/common/AbstractBase.js +0 -634
- package/lib/file/File.cjs +0 -5496
- package/lib/file/File.d.cts +0 -10
- package/lib/file/File.d.ts +0 -10
- package/lib/file/File.js +0 -5490
- package/lib/file/TestFile.cjs +0 -7368
- package/lib/file/TestFile.d.cts +0 -10
- package/lib/file/TestFile.d.ts +0 -10
- package/lib/file/TestFile.js +0 -7359
- package/lib/file/TsFile.cjs +0 -7368
- package/lib/file/TsFile.d.cts +0 -10
- package/lib/file/TsFile.d.ts +0 -10
- package/lib/file/TsFile.js +0 -7359
- package/lib/methods/findWorkspacePackageName.cjs +0 -86
- package/lib/methods/findWorkspacePackageName.d.cts +0 -6
- package/lib/methods/findWorkspacePackageName.d.ts +0 -6
- package/lib/methods/findWorkspacePackageName.js +0 -78
- package/lib/methods/getAllImports.cjs +0 -20
- package/lib/methods/getAllImports.d.cts +0 -17
- package/lib/methods/getAllImports.d.ts +0 -17
- package/lib/methods/getAllImports.js +0 -18
- package/lib/methods/getAllWorkspacePackageJsonPaths.cjs +0 -57
- package/lib/methods/getAllWorkspacePackageJsonPaths.d.cts +0 -6
- package/lib/methods/getAllWorkspacePackageJsonPaths.d.ts +0 -6
- package/lib/methods/getAllWorkspacePackageJsonPaths.js +0 -49
- package/lib/methods/getAllWorkspacePackageJsons.cjs +0 -66
- package/lib/methods/getAllWorkspacePackageJsons.d.cts +0 -6
- package/lib/methods/getAllWorkspacePackageJsons.d.ts +0 -6
- package/lib/methods/getAllWorkspacePackageJsons.js +0 -58
- package/lib/methods/getAllWorkspacePackageNames.cjs +0 -75
- package/lib/methods/getAllWorkspacePackageNames.d.cts +0 -6
- package/lib/methods/getAllWorkspacePackageNames.d.ts +0 -6
- package/lib/methods/getAllWorkspacePackageNames.js +0 -67
- package/lib/methods/getAllWorkspacePaths.cjs +0 -50
- package/lib/methods/getAllWorkspacePaths.d.cts +0 -6
- package/lib/methods/getAllWorkspacePaths.d.ts +0 -6
- package/lib/methods/getAllWorkspacePaths.js +0 -42
- package/lib/methods/getImportsRecursively.cjs +0 -7577
- package/lib/methods/getImportsRecursively.d.cts +0 -37
- package/lib/methods/getImportsRecursively.d.ts +0 -37
- package/lib/methods/getImportsRecursively.js +0 -7566
- package/lib/methods/getRepoPackageJson.cjs +0 -40
- package/lib/methods/getRepoPackageJson.d.cts +0 -6
- package/lib/methods/getRepoPackageJson.d.ts +0 -6
- package/lib/methods/getRepoPackageJson.js +0 -32
- package/lib/methods/getRepoPackageJsonPath.cjs +0 -34
- package/lib/methods/getRepoPackageJsonPath.d.cts +0 -6
- package/lib/methods/getRepoPackageJsonPath.d.ts +0 -6
- package/lib/methods/getRepoPackageJsonPath.js +0 -26
- package/lib/repo/Workspace.cjs +0 -7370
- package/lib/repo/Workspace.d.cts +0 -10
- package/lib/repo/Workspace.d.ts +0 -10
- package/lib/repo/Workspace.js +0 -7361
- package/lib/util/SemanticExtnamePrefix.cjs +0 -13
- package/lib/util/SemanticExtnamePrefix.d.cts +0 -14
- package/lib/util/SemanticExtnamePrefix.d.ts +0 -14
- package/lib/util/SemanticExtnamePrefix.js +0 -11
- package/lib/util/SemanticExtnamePrefixDescriptions.cjs +0 -13
- package/lib/util/SemanticExtnamePrefixDescriptions.d.cts +0 -15
- package/lib/util/SemanticExtnamePrefixDescriptions.d.ts +0 -15
- package/lib/util/SemanticExtnamePrefixDescriptions.js +0 -11
- package/lib/util/SemanticExtnamePrefixes.cjs +0 -18
- package/lib/util/SemanticExtnamePrefixes.d.cts +0 -97
- package/lib/util/SemanticExtnamePrefixes.d.ts +0 -97
- package/lib/util/SemanticExtnamePrefixes.js +0 -14
- package/lib/util/getRepoRootDirpath.cjs +0 -30
- package/lib/util/getRepoRootDirpath.d.cts +0 -6
- package/lib/util/getRepoRootDirpath.d.ts +0 -6
- package/lib/util/getRepoRootDirpath.js +0 -22
- package/lib/util/getWorkspaceDirpaths.cjs +0 -42
- package/lib/util/getWorkspaceDirpaths.d.cts +0 -6
- package/lib/util/getWorkspaceDirpaths.d.ts +0 -6
- package/lib/util/getWorkspaceDirpaths.js +0 -34
- package/lib/util/hasExtnamePrefix.cjs +0 -27
- package/lib/util/hasExtnamePrefix.d.cts +0 -38
- package/lib/util/hasExtnamePrefix.d.ts +0 -38
- package/lib/util/hasExtnamePrefix.js +0 -25
- package/lib/util/resolveModuleImportPath.cjs +0 -51
- package/lib/util/resolveModuleImportPath.d.cts +0 -8
- package/lib/util/resolveModuleImportPath.d.ts +0 -8
- package/lib/util/resolveModuleImportPath.js +0 -42
- package/lib/util/semverVersionBump.cjs +0 -30
- package/lib/util/semverVersionBump.d.cts +0 -22
- package/lib/util/semverVersionBump.d.ts +0 -22
- package/lib/util/semverVersionBump.js +0 -28
package/README.md
CHANGED
|
@@ -2,15 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
Monorepo workspace management, package discovery, and TypeScript code processing utilities.
|
|
4
4
|
|
|
5
|
-
[](https://www.typescriptlang.org/)
|
|
6
|
-
|
|
5
|
+
[](https://www.typescriptlang.org/) [](https://nodejs.org/api/esm.html)
|
|
6
|
+
|
|
7
|
+
## Exports
|
|
8
|
+
|
|
9
|
+
<!-- EXPORTS_START -->
|
|
10
|
+
|
|
11
|
+
- **AbstractBase**: Abstract base class that provides common functionality for monorepo management including parenting and inspection capabilities.
|
|
12
|
+
- **AbstractCode**: Abstract base class for representing code structures in the monorepo with inspection and preview capabilities.
|
|
13
|
+
- **CodeBlock**: Represents a block of code within a larger code structure, defined by an index range.
|
|
14
|
+
- **File**: Represents a file in a workspace with various utility methods to check file types and read contents.
|
|
15
|
+
- **ImportKeywords**: Represents the imported keywords/specifiers in an import statement.
|
|
16
|
+
- **ImportSpecifiers**: Represents and analyzes import specifiers in TypeScript/JavaScript code. This class parses and categorizes different types of import statements such as default imports, named imports, namespace imports, mixed imports, and side effect imports. It provides methods to retrieve specific parts of import statements and to manipulate them.
|
|
17
|
+
- **ImportStatement**: Represents an import statement in TypeScript code with parsing and manipulation capabilities.
|
|
18
|
+
- **ModuleSpecifier**: Represents a module specifier in an import statement. Module specifiers are the strings that indicate where to import from, such as './path/to/file', '
|
|
19
|
+
- **MonoRepo**: Represents a monorepo with workspace management, TypeScript configuration, and dependency analysis capabilities.
|
|
20
|
+
- **SemanticExtnamePrefix**: Constants for semantic filename prefixes used to categorize files by their purpose.
|
|
21
|
+
- **SemanticExtnamePrefixDescriptions**
|
|
22
|
+
- **TestFile**: Represents a test file in the monorepo with TypeScript code analysis capabilities.
|
|
23
|
+
- **TsCode**: Represents TypeScript code with import parsing and manipulation capabilities.
|
|
24
|
+
- **TsFile**: Represents a TypeScript file in the monorepo with code analysis and dependency tracking capabilities.
|
|
25
|
+
- **Workspace**: Represents a workspace within a monorepo, providing functionality to analyze and manage workspace dependencies. A workspace is a directory containing a package.json file and typically source code files. This class provides methods and properties for analyzing: - Source and test files in the workspace - Dependencies declared in package.json - Dependencies imported in source and test files - Missing, unused, and incorrectly imported dependencies
|
|
26
|
+
- **findWorkspacePackageName**: Finds the full package name for a workspace given a partial name.
|
|
27
|
+
- **getAllImports**: Retrieves all import statements from TypeScript source files across all workspaces in the monorepo.
|
|
28
|
+
- **getAllWorkspacePackageJsonPaths**: Gets all workspace package.json file paths.
|
|
29
|
+
- **getAllWorkspacePackageJsons**: Gets all workspace package.json contents.
|
|
30
|
+
- **getAllWorkspacePackageNames**: Gets all workspace package names.
|
|
31
|
+
- **getAllWorkspacePaths**: Returns an array of all workspace directory paths.
|
|
32
|
+
- **getImportsRecursively**: Recursively retrieves all imports for the given entry points, categorizing them into external, builtin, and internal dependencies.
|
|
33
|
+
- **getRepoPackageJson**: Reads the repository's root package.json file.
|
|
34
|
+
- **getRepoPackageJsonPath**: Gets the absolute path to the repository's package.json file.
|
|
35
|
+
- **getRepoRootDirpath**: Get the root directory path of the monorepo by finding the package.json with workspaces configuration.
|
|
36
|
+
- **getWorkspaceDirpaths**: Get all workspace directory paths by reading the workspace patterns from the root package.json.
|
|
37
|
+
- **hasExtnamePrefix**.
|
|
38
|
+
- **resolveModuleImportPath**
|
|
39
|
+
- **semverVersionBump** of a given version string or array based on the specified level. The function supports 'major', 'minor', and 'patch' levels.
|
|
40
|
+
|
|
41
|
+
<!-- EXPORTS_END -->
|
|
7
42
|
|
|
8
43
|
## Usage
|
|
9
44
|
|
|
10
45
|
### Managing the Repository & Workspaces
|
|
11
46
|
|
|
12
|
-
The `MonoRepo` class allows structured, automated tasks against packages and workspaces in a typical monorepo
|
|
13
|
-
environment (e.g. yarn, npm, pnpm workspaces).
|
|
47
|
+
The `MonoRepo` class allows structured, automated tasks against packages and workspaces in a typical monorepo environment (e.g. yarn, npm, pnpm workspaces).
|
|
14
48
|
|
|
15
49
|
```ts
|
|
16
50
|
import { MonoRepo } from '@mono/monorepo'
|
|
@@ -41,59 +75,3 @@ const imports = tsFile.imports
|
|
|
41
75
|
// Use utility functions independently of classes
|
|
42
76
|
const packageName = findWorkspacePackageName('libs/my-feature')
|
|
43
77
|
```
|
|
44
|
-
|
|
45
|
-
## API Reference
|
|
46
|
-
|
|
47
|
-
### Core Repository
|
|
48
|
-
|
|
49
|
-
| Export | Description |
|
|
50
|
-
| -------------- | ---------------------------------------------------------- |
|
|
51
|
-
| `MonoRepo` | Central class governing the structure of an open monorepo |
|
|
52
|
-
| `Workspace` | Model structure for an individual project/package |
|
|
53
|
-
| `AbstractBase` | Foundational primitive used for components mapping classes |
|
|
54
|
-
|
|
55
|
-
### Code & Imports Parsing
|
|
56
|
-
|
|
57
|
-
| Export | Description |
|
|
58
|
-
| ------------------ | ---------------------------------------------------------- |
|
|
59
|
-
| `AbstractCode` | Model providing baseline AST context matching |
|
|
60
|
-
| `TsCode` | Encapsulates structural elements found in Typescript code |
|
|
61
|
-
| `CodeBlock` | Abstraction representing code blocks and nested structures |
|
|
62
|
-
| `ImportStatement` | Comprehensive model for evaluating module imports |
|
|
63
|
-
| `ImportKeywords` | Parsed model mapping distinct words injected |
|
|
64
|
-
| `ImportSpecifiers` | Parsed model resolving named exports inside imports |
|
|
65
|
-
| `ModuleSpecifier` | Model resolving targeted module representations |
|
|
66
|
-
|
|
67
|
-
### File Operations
|
|
68
|
-
|
|
69
|
-
| Export | Description |
|
|
70
|
-
| ---------- | ---------------------------------------------------------- |
|
|
71
|
-
| `File` | Generic cross-platform file wrapper providing baseline IO |
|
|
72
|
-
| `TsFile` | File abstraction built specifically for `.ts` processing |
|
|
73
|
-
| `TestFile` | Standard test-execution tracking class wrapping code types |
|
|
74
|
-
|
|
75
|
-
### Discovery Methods
|
|
76
|
-
|
|
77
|
-
| Export | Description |
|
|
78
|
-
| --------------------------------- | --------------------------------------------------------- |
|
|
79
|
-
| `getRepoRootDirpath` | Find the repository's root execution configuration index |
|
|
80
|
-
| `getRepoPackageJsonPath` | Absolute path to root `package.json` |
|
|
81
|
-
| `getRepoPackageJson` | Full structurally parsed data for root `package.json` |
|
|
82
|
-
| `getWorkspaceDirpaths` | Retrieve array of directories containing active packages |
|
|
83
|
-
| `getAllWorkspacePaths` | Return specific mapped configurations of standard domains |
|
|
84
|
-
| `getAllWorkspacePackageJsonPaths` | Array returning strictly active `package.json` paths |
|
|
85
|
-
| `getAllWorkspacePackageJsons` | Extract parsing configuration objects for children pkgs |
|
|
86
|
-
| `getAllWorkspacePackageNames` | Map name attributes found from all workspace directories |
|
|
87
|
-
| `findWorkspacePackageName` | Discover closest named active project bound to child path |
|
|
88
|
-
|
|
89
|
-
### Utilities
|
|
90
|
-
|
|
91
|
-
| Export | Description |
|
|
92
|
-
| ----------------------------------- | ---------------------------------------------------------- |
|
|
93
|
-
| `getAllImports` | Collect import arrays across scopes / boundaries |
|
|
94
|
-
| `resolveModuleImportPath` | Convert abstract module statements into absolute locations |
|
|
95
|
-
| `semverVersionBump` | Upgrade semantics targeting specific boundaries semver |
|
|
96
|
-
| `hasExtnamePrefix` | Matching abstraction targeting specific semantic models |
|
|
97
|
-
| `SemanticExtnamePrefix` | Types identifying standard TS suffix standards (`.test`) |
|
|
98
|
-
| `SemanticExtnamePrefixes` | Array evaluation tracking suffixes expected across modules |
|
|
99
|
-
| `SemanticExtnamePrefixDescriptions` | Readable text models matching semantic prefix usages |
|