Skip to content

Commit

Permalink
chore(core): change retrieveProjectConfigurationPaths to async (#18717)
Browse files Browse the repository at this point in the history
(cherry picked from commit 7d4e2fe)
  • Loading branch information
FrozenPandaz committed Aug 21, 2023
1 parent add8424 commit d168926
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import { retrieveProjectConfigurationPaths } from '../../project-graph/utils/ret

export default async function (tree: Tree) {
const nxJson = readNxJson(tree);
const projectFiles = retrieveProjectConfigurationPaths(tree.root, nxJson);
const projectFiles = await retrieveProjectConfigurationPaths(
tree.root,
nxJson
);
const projectJsons = projectFiles.filter((f) => f.endsWith('project.json'));

for (let f of projectJsons) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ describe('retrieveProjectConfigurationPaths', () => {
name: 'project-1',
})
);
expect(retrieveProjectConfigurationPaths(fs.tempDir, {})).not.toContain(
'not-projects/project.json'
);
expect(retrieveProjectConfigurationPaths(fs.tempDir, {})).toContain(
expect(
await retrieveProjectConfigurationPaths(fs.tempDir, {})
).not.toContain('not-projects/project.json');
expect(await retrieveProjectConfigurationPaths(fs.tempDir, {})).toContain(
'projects/project.json'
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,13 @@ function _retrieveProjectConfigurations(
};
}

export function retrieveProjectConfigurationPaths(
export async function retrieveProjectConfigurationPaths(
root: string,
nxJson: NxJsonConfiguration
): string[] {
): Promise<string[]> {
const projectGlobPatterns = configurationGlobs(
root,
loadNxPluginsSync(nxJson?.plugins ?? [], getNxRequirePaths(root), root)
await loadNxPlugins(nxJson?.plugins ?? [], getNxRequirePaths(root), root)
);
const { getProjectConfigurationFiles } =
require('../../native') as typeof import('../../native');
Expand Down

0 comments on commit d168926

Please # to comment.