-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "fix(core): fix misc issues (#29114)"
This reverts commit 9ad6b8c.
- Loading branch information
1 parent
b95776e
commit 9a9aa86
Showing
29 changed files
with
165 additions
and
265 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,13 @@ | ||
import { createNodesFromFiles, NxPluginV2 } from '../src/project-graph/plugins'; | ||
import type { NxPluginV2 } from '../src/project-graph/plugins'; | ||
import { workspaceRoot } from '../src/utils/workspace-root'; | ||
import { createNodeFromPackageJson } from '../src/plugins/package-json'; | ||
import { workspaceDataDirectory } from '../src/utils/cache-directory'; | ||
import { join } from 'path'; | ||
import { ProjectConfiguration } from '../src/config/workspace-json-project-json'; | ||
import { readJsonFile, writeJsonFile } from '../src/utils/fileutils'; | ||
|
||
export type PackageJsonConfigurationCache = { | ||
[hash: string]: ProjectConfiguration; | ||
}; | ||
|
||
const cachePath = join(workspaceDataDirectory, 'package-json.hash'); | ||
|
||
export function readPackageJsonConfigurationCache() { | ||
try { | ||
return readJsonFile<PackageJsonConfigurationCache>(cachePath); | ||
} catch (e) { | ||
return {}; | ||
} | ||
} | ||
|
||
function writeCache(cache: PackageJsonConfigurationCache) { | ||
writeJsonFile(cachePath, cache); | ||
} | ||
|
||
const plugin: NxPluginV2 = { | ||
name: 'nx-all-package-jsons-plugin', | ||
createNodesV2: [ | ||
createNodes: [ | ||
'*/**/package.json', | ||
(configFiles, options, context) => { | ||
const cache = readPackageJsonConfigurationCache(); | ||
|
||
const result = createNodesFromFiles( | ||
(f) => createNodeFromPackageJson(f, workspaceRoot, cache), | ||
configFiles, | ||
options, | ||
context | ||
); | ||
|
||
writeCache(cache); | ||
|
||
return result; | ||
}, | ||
(f) => createNodeFromPackageJson(f, workspaceRoot), | ||
], | ||
}; | ||
|
||
module.exports = plugin; | ||
module.exports.readPackageJsonConfigurationCache = | ||
readPackageJsonConfigurationCache; |
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
Oops, something went wrong.