-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(workspace-plugin): make split-lib-in-two shared utils to be used…
… in other related generators
- Loading branch information
Showing
6 changed files
with
40 additions
and
42 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
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
15 changes: 15 additions & 0 deletions
15
tools/workspace-plugin/src/generators/split-library-in-two/shared.ts
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 { joinPathFragments, type ProjectConfiguration, type Tree } from '@nx/devkit'; | ||
|
||
export const isSplitProject = (tree: Tree, project: ProjectConfiguration) => | ||
tree.exists(joinPathFragments(project.root, '../stories/project.json')); | ||
|
||
export function assertStoriesProject(tree: Tree, options: { isSplitProject: boolean; project: ProjectConfiguration }) { | ||
if (options.isSplitProject && options.project.name?.endsWith('-stories')) { | ||
throw new Error( | ||
`This generator can be invoked only against library project. Please run it against "${options.project.name.replace( | ||
'-stories', | ||
'', | ||
)}" library project.`, | ||
); | ||
} | ||
} |