Skip to content

Commit

Permalink
feat(core): support nx v13 (#226)
Browse files Browse the repository at this point in the history
Co-authored-by: AgentEnder <craigorycoppola@gmail.com>
Co-authored-by: benpsnyder <ben@snyder.tech>
  • Loading branch information
benpsnyder and AgentEnder authored Oct 22, 2021
1 parent 6c75c73 commit 3524ef9
Show file tree
Hide file tree
Showing 10 changed files with 3,647 additions and 5,634 deletions.
20 changes: 0 additions & 20 deletions migrations.json

This file was deleted.

4 changes: 3 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
}
}
},
"projects": {},
"workspaceLayout": {
"appsDir": "",
"libsDir": "packages"
Expand All @@ -38,5 +37,8 @@
"projects": "dependencies"
}
]
},
"cli": {
"defaultCollection": "@nrwl/workspace"
}
}
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
"private": false,
"dependencies": {
"@algolia/client-search": "^4.10.5",
"@docusaurus/core": "^2.0.0-beta.1",
"@docusaurus/preset-classic": "^2.0.0-beta.6",
"@docusaurus/theme-search-algolia": "^2.0.0-beta.6",
"@docusaurus/core": "^2.0.0-beta.8",
"@docusaurus/preset-classic": "^2.0.0-beta.8",
"@docusaurus/theme-search-algolia": "^2.0.0-beta.8",
"@mdx-js/react": "^1.6.21",
"@types/xmldoc": "^1.1.6",
"chokidar": "^3.5.2",
"clsx": "^1.1.1",
"eslint": "^7.22.0",
"eslint": "7.32.0",
"glob": "^7.2.0",
"inquirer": "^8.2.0",
"prism-react-renderer": "^1.2.1",
Expand All @@ -60,16 +60,16 @@
"@commitlint/cli": "^13.2.1",
"@commitlint/config-conventional": "^13.2.0",
"@commitlint/types": "^13.2.0",
"@nrwl/cli": "12.9.0",
"@nrwl/devkit": "12.9.0",
"@nrwl/eslint-plugin-nx": "12.9.0",
"@nrwl/jest": "12.9.0",
"@nrwl/linter": "12.9.0",
"@nrwl/node": "12.9.0",
"@nrwl/nx-cloud": "12.3.14",
"@nrwl/nx-plugin": "12.9.0",
"@nrwl/tao": "12.9.0",
"@nrwl/workspace": "12.9.0",
"@nrwl/cli": "13.0.1",
"@nrwl/devkit": "13.0.1",
"@nrwl/eslint-plugin-nx": "13.0.1",
"@nrwl/jest": "13.0.1",
"@nrwl/linter": "13.0.1",
"@nrwl/node": "13.0.1",
"@nrwl/nx-cloud": "12.5.0",
"@nrwl/nx-plugin": "13.0.1",
"@nrwl/tao": "13.0.1",
"@nrwl/workspace": "13.0.1",
"@nx-dotnet/nxdoc": "latest",
"@nx-plus/docusaurus": "^12.2.0",
"@semantic-release/changelog": "^6.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/executors/build/executor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ describe('Build Executor', () => {
},
},
},
npmScope: 'unit-tests',
},
isVerbose: false,
};
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/executors/format/executor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ describe('Format Executor', () => {
},
},
},
npmScope: 'unit-tests',
},
isVerbose: false,
};
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/executors/publish/executor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ describe('Publish Executor', () => {
},
},
},
npmScope: 'unit-tests',
},
isVerbose: false,
};
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/executors/test/executor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe('Test Executor', () => {
},
},
},
npmScope: 'unit-tests',
},
isVerbose: false,
};
Expand Down
34 changes: 15 additions & 19 deletions packages/core/src/tasks/check-module-boundaries.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { appRootPath } from '@nrwl/tao/src/utils/app-root';
import {
ProjectConfiguration,
WorkspaceJsonConfiguration,
Workspaces,
} from '@nrwl/tao/src/shared/workspace';
import { Workspaces } from '@nrwl/tao/src/shared/workspace';

import { ESLint } from 'eslint';

Expand All @@ -13,24 +9,21 @@ import {
readConfig,
} from '@nx-dotnet/utils';
import {
NxJsonConfiguration,
NxJsonProjectConfiguration,
WorkspaceJsonConfiguration,
readJsonFile,
Tree,
NxJsonConfiguration,
ProjectConfiguration,
} from '@nrwl/devkit';

type ExtendedWorkspaceJson = WorkspaceJsonConfiguration & {
projects: Record<string, ProjectConfiguration & NxJsonProjectConfiguration>;
};
import { join } from 'path';

export async function checkModuleBoundariesForProject(
project: string,
workspace: ExtendedWorkspaceJson,
workspace: WorkspaceJsonConfiguration,
): Promise<string[]> {
const projectRoot = workspace.projects[project].root;
const tags = workspace.projects[project].tags ?? [];
if (!tags.length) {
//
return [];
}
const configuredConstraints = await loadModuleBoundaries(projectRoot);
Expand Down Expand Up @@ -101,20 +94,23 @@ async function main() {
},
});
const workspace = new Workspaces(appRootPath);
const workspaceJson: ExtendedWorkspaceJson =
const workspaceJson: WorkspaceJsonConfiguration =
workspace.readWorkspaceConfiguration();
const nxJsonProjects = readJsonFile<NxJsonConfiguration>(
`${appRootPath}/nx.json`,
).projects;
if (nxJsonProjects) {
Object.entries(nxJsonProjects).forEach(([name, config]) => {

// Nx v12 support
const nxJson: NxJsonConfiguration & Record<string, ProjectConfiguration> =
readJsonFile(join(appRootPath, 'nx.json'));
if (nxJson.projects) {
Object.entries(nxJson.projects).forEach(([name, config]) => {
const existingTags = workspaceJson.projects[name]?.tags ?? [];
workspaceJson.projects[name].tags = [
...existingTags,
...(config.tags ?? []),
];
});
}
// End Nx v12 support

console.log(`Checking module boundaries for ${project}`);
const violations = await checkModuleBoundariesForProject(
project,
Expand Down
3 changes: 0 additions & 3 deletions workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,5 @@
"typescript": "packages/typescript",
"typescript-e2e": "e2e/typescript-e2e",
"utils": "packages/utils"
},
"cli": {
"defaultCollection": "@nrwl/workspace"
}
}
Loading

0 comments on commit 3524ef9

Please sign in to comment.