-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support package.json projects (#1287)
- Loading branch information
Showing
12 changed files
with
202 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { join } from 'path'; | ||
import { fileExists, readAndCacheJsonFile } from './utils/utils'; | ||
|
||
export async function checkIsNxWorkspace( | ||
workspacePath: string | ||
): Promise<boolean> { | ||
let isNxWorkspace = await fileExists(join(workspacePath, 'nx.json')); | ||
|
||
if (!isNxWorkspace) { | ||
const lerna = await readAndCacheJsonFile('lerna.json', workspacePath); | ||
isNxWorkspace = lerna.json.useNx ?? false; | ||
} | ||
|
||
return isNxWorkspace; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
import { join } from 'path'; | ||
import { fileExists } from './utils'; | ||
|
||
/** | ||
* Builds the project path from the given project name. | ||
* @param workspacePath The full path to the configured workspace | ||
* @param projectPath The path to the project relative to the workspace | ||
* @returns The full path to the project.json file | ||
*/ | ||
export function buildProjectPath( | ||
export async function buildProjectPath( | ||
workspacePath: string, | ||
projectPath: string | ||
): string { | ||
return join(workspacePath, projectPath, 'project.json'); | ||
): Promise<string | undefined> { | ||
const basePath = join(workspacePath, projectPath); | ||
|
||
const projectJsonPath = join(basePath, 'project.json'); | ||
const packageJsonPath = join(basePath, 'package.json'); | ||
if (await fileExists(projectJsonPath)) { | ||
return projectJsonPath; | ||
} else if (await fileExists(packageJsonPath)) { | ||
return packageJsonPath; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.