Class JScriptProjectLayout
java.lang.Object
org.machanism.machai.project.layout.ProjectLayout
org.machanism.machai.project.layout.JScriptProjectLayout
A project layout utility for JavaScript/TypeScript-based projects.
Scans for workspace modules defined in package.json, and
determines project sources, documents, and test directories.
- Since:
- 0.0.2
- Author:
- Viktor Tovstyi
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of the JS/TS project model file used to detect this layout. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a list of conventional documentation directories for JS/TS projects.Returns workspace modules listed inpackage.jsonunder theworkspaceskey.Returns the package name frompackage.json.Returns a list of conventional source directories for JS/TS projects.getTests()Returns a list of conventional test directories for JS/TS projects.static booleanisPackageJsonPresent(File projectDir) Checks if the specified directory contains apackage.jsonfile, indicating a JS/TS project.projectDir(File projectDir) Sets the project directory and narrows the return type for fluent usage.Methods inherited from class org.machanism.machai.project.layout.ProjectLayout
findDirectories, findFiles, getExcludeDirs, getParentId, getProjectDir, getProjectLayoutType, getProjectName, getRelativePath, getRelativePath, getRelativePath
-
Field Details
-
PROJECT_MODEL_FILE_NAME
Name of the JS/TS project model file used to detect this layout.- See Also:
-
-
Constructor Details
-
JScriptProjectLayout
public JScriptProjectLayout()
-
-
Method Details
-
isPackageJsonPresent
Checks if the specified directory contains apackage.jsonfile, indicating a JS/TS project.- Parameters:
projectDir- directory to check- Returns:
trueifpackage.jsonis present; otherwisefalse
-
getModules
Returns workspace modules listed inpackage.jsonunder theworkspaceskey.When
workspacesis an array of glob patterns, this method searches directories under the configured project root and returns those that match a workspace pattern and contain apackage.json.- Overrides:
getModulesin classProjectLayout- Returns:
- list of relative module paths, or empty list when the project does not define workspaces
- Throws:
IllegalArgumentException- ifpackage.jsoncannot be read or parsed
-
getSources
Returns a list of conventional source directories for JS/TS projects.- Specified by:
getSourcesin classProjectLayout- Returns:
- empty list; not currently implemented
-
getDocuments
Returns a list of conventional documentation directories for JS/TS projects.- Specified by:
getDocumentsin classProjectLayout- Returns:
- empty list; not currently implemented
-
getTests
Returns a list of conventional test directories for JS/TS projects.- Specified by:
getTestsin classProjectLayout- Returns:
- empty list; not currently implemented
-
projectDir
Sets the project directory and narrows the return type for fluent usage.- Overrides:
projectDirin classProjectLayout- Parameters:
projectDir- project root directory- Returns:
- this layout instance
-
getProjectId
Returns the package name frompackage.json.- Overrides:
getProjectIdin classProjectLayout- Returns:
- package name
-