-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): React workspaces that use pnpm & the new TS solution shoul…
…d be declared correctly so that it can be referenced.
- Loading branch information
1 parent
7157e7a
commit 3b4f6b6
Showing
15 changed files
with
477 additions
and
275 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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,33 @@ | ||
import { detectPackageManager, readJson, Tree } from '@nx/devkit'; | ||
|
||
export function addProjectToTsSolutionWorkspace( | ||
tree: Tree, | ||
projectDir: string | ||
) { | ||
if (detectPackageManager() === 'pnpm') { | ||
const { load, dump } = require('@zkochan/js-yaml'); | ||
if (tree.exists('pnpm-workspace.yaml')) { | ||
const workspaceFile = tree.read('pnpm-workspace.yaml', 'utf-8'); | ||
const yamlData = load(workspaceFile); | ||
|
||
if (!yamlData.packages) { | ||
yamlData.packages = []; | ||
} | ||
|
||
if (!yamlData.packages.includes(projectDir)) { | ||
yamlData.packages.push(projectDir); | ||
tree.write('pnpm-workspace.yaml', dump(yamlData, { indent: 2 })); | ||
} | ||
} | ||
} else { | ||
// Update package.json | ||
const packageJson = readJson(tree, 'package.json'); | ||
if (!packageJson.workspaces) { | ||
packageJson.workspaces = []; | ||
} | ||
if (!packageJson.workspaces.includes(projectDir)) { | ||
packageJson.workspaces.push(projectDir); | ||
tree.write('package.json', JSON.stringify(packageJson, null, 2)); | ||
} | ||
} | ||
} |
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