Skip to content

Commit

Permalink
chore(core): migrate nx
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder committed Jul 27, 2024
1 parent 49d5589 commit 2ec85a2
Show file tree
Hide file tree
Showing 28 changed files with 17,252 additions and 28,219 deletions.
9 changes: 7 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,18 @@
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"rules": {
"eqeqeq": ["error", "smart"]
"eqeqeq": ["error", "smart"],
"@typescript-eslint/no-extra-semi": "error",
"no-extra-semi": "off"
}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
"rules": {
"@typescript-eslint/no-extra-semi": "error",
"no-extra-semi": "off"
}
},
{
"files": "*.json",
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ Thumbs.db
**/obj

.vs
.nx/cache
.nx/cache
.nx/workspace-data
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
/coverage
.docusaurus/
.yarn/
/.nx/cache
/.nx/cache
/.nx/workspace-data
19 changes: 14 additions & 5 deletions e2e/core-e2e/tests/nx-dotnet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
getPackageManagerCommand,
joinPathFragments,
names,
normalizePath,
} from '@nx/devkit';
import {
checkFilesExist,
Expand All @@ -22,6 +23,7 @@ import { ensureDirSync } from 'fs-extra';
import { join } from 'path';
import { XmlDocument } from 'xmldoc';
import * as logger from 'console';
import stripAnsi from 'strip-ansi';

import { readDependenciesFromNxDepGraph } from '@nx-dotnet/utils/e2e';

Expand Down Expand Up @@ -199,11 +201,18 @@ describe('nx-dotnet e2e', () => {
),
);
const projectXml = new XmlDocument(config);
const projectReference = projectXml
.childrenNamed('ItemGroup')[1]
?.childNamed('ProjectReference');

expect(projectReference).toBeDefined();
const projectReferences = projectXml
.childrenNamed('ItemGroup')
.flatMap((x) => x.childrenNamed('ProjectReference'));

expect(
projectReferences.some(
(ref) =>
normalizePath(ref.attr['Include']) ===
`../${app}/Proj.${names(app).className}.csproj`,
),
).toBe(true);
});

it('should create test project using suffix', async () => {
Expand Down Expand Up @@ -346,7 +355,7 @@ describe('nx-dotnet e2e', () => {
`generate @nx-dotnet/core:app ${app} --language="C#" --template="webapi" --skip-swagger-lib --solutionFile --dry-run`,
);

expect(output.stdout).toContain('CREATE proj.nx-dotnet.sln');
expect(stripAnsi(output.stdout)).toContain('CREATE proj.nx-dotnet.sln');
expect(() => checkFilesExist(`apps/${app}`)).toThrow();
expect(listFiles('.').filter((x) => x.endsWith('.sln'))).toHaveLength(0);
});
Expand Down
7 changes: 7 additions & 0 deletions e2e/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,13 @@ export function getPackageManagerCommand({
addDev: `pnpm add -D`,
list: 'npm ls --depth 10',
},
bun: {
createWorkspace: `bunx create-nx-workspace@${process.env.PUBLISHED_VERSION}`,
runNx: `bunx nx`,
runNxSilent: `bunx nx`,
addDev: 'bun install -D',
list: 'bun pm ls',
},
}[packageManager];
}

Expand Down
1 change: 1 addition & 0 deletions jest.preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ module.exports = {
...nxPreset,
testEnvironment: 'node',
prettierPath: require.resolve('prettier-2'),
forceExit: true,
};
96 changes: 0 additions & 96 deletions migrations.json

This file was deleted.

40 changes: 21 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"@docusaurus/preset-classic": "^2.4.0",
"@docusaurus/theme-search-algolia": "^2.4.0",
"@mdx-js/react": "^1.6.21",
"@nx/devkit": "19.0.4",
"@swc/helpers": "0.5.2",
"@nx/devkit": "19.5.3",
"@swc/helpers": "0.5.12",
"@trumbitta/nx-plugin-openapi": "^1.12.1",
"@types/xmldoc": "^1.1.6",
"clsx": "^1.1.1",
Expand Down Expand Up @@ -53,17 +53,17 @@
"@commitlint/config-conventional": "^17.1.0",
"@commitlint/types": "^17.4.4",
"@nx-plus/docusaurus": "15.0.0-rc.0",
"@nx/cypress": "19.0.4",
"@nx/eslint": "19.0.4",
"@nx/eslint-plugin": "19.0.4",
"@nx/jest": "19.0.4",
"@nx/js": "19.0.4",
"@nx/node": "19.0.4",
"@nx/plugin": "19.0.4",
"@nx/react": "19.0.4",
"@nx/web": "19.0.4",
"@nx/webpack": "19.0.4",
"@nx/workspace": "19.0.4",
"@nx/cypress": "19.5.3",
"@nx/eslint": "19.5.3",
"@nx/eslint-plugin": "19.5.3",
"@nx/jest": "19.5.3",
"@nx/js": "19.5.3",
"@nx/node": "19.5.3",
"@nx/plugin": "19.5.3",
"@nx/react": "19.5.3",
"@nx/web": "19.5.3",
"@nx/webpack": "19.5.3",
"@nx/workspace": "19.5.3",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/commit-analyzer": "^9.0.2",
Expand All @@ -87,11 +87,11 @@
"@types/tmp": "^0.2.3",
"@types/yargs": "^17.0.29",
"@types/yargs-parser": "^21.0.0",
"@typescript-eslint/eslint-plugin": "7.9.0",
"@typescript-eslint/parser": "7.9.0",
"@typescript-eslint/eslint-plugin": "7.17.0",
"@typescript-eslint/parser": "7.17.0",
"babel-jest": "28.1.3",
"css-loader": "^6.7.3",
"cypress": "^13.6.6",
"cypress": "13.13.1",
"dotenv": "^16.0.3",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-cypress": "2.15.1",
Expand All @@ -108,21 +108,22 @@
"lint-staged": "^13.0.3",
"memfs": "3.4.13",
"node-fetch": "3.3.0",
"nx": "19.0.4",
"nx": "19.5.3",
"openapi-types": "^12.1.0",
"prettier": "^3.0.3",
"prettier-2": "npm:prettier@^2",
"react-refresh": "^0.10.0",
"run-p": "*",
"semantic-release": "^19.0.5",
"strip-ansi": "^7.1.0",
"style-loader": "^3.3.0",
"stylus": "0.59.0",
"stylus-loader": "^7.1.0",
"tree-kill": "^1.2.2",
"ts-jest": "29.1.1",
"ts-node": "10.9.1",
"tslib": "^2.5.0",
"typescript": "5.4.5",
"typescript": "5.5.4",
"url-loader": "^4.1.1",
"verdaccio": "^5.24.1",
"webpack": "^5.81.0",
Expand All @@ -136,5 +137,6 @@
"version": "2.2.0",
"nx": {
"includedScripts": []
}
},
"packageManager": "yarn@1.22.22"
}
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"@nx-dotnet/dotnet": "*",
"@nx-dotnet/utils": "*",
"@nx/devkit": "19.0.4",
"@nx/devkit": "19.5.3",
"fast-glob": "3.2.12",
"inquirer": "^8.2.0",
"minimatch": "3.1.2",
Expand Down
7 changes: 1 addition & 6 deletions packages/core/src/generators/init/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ import {
} from '@nx/devkit';

import { DotNetClient, dotnetFactory } from '@nx-dotnet/dotnet';
import {
CONFIG_FILE_PATH,
isDryRun,
NxDotnetConfig,
resolve,
} from '@nx-dotnet/utils';
import { CONFIG_FILE_PATH, NxDotnetConfig, resolve } from '@nx-dotnet/utils';
import * as path from 'path';
import { major } from 'semver';
import { runDotnetNew } from '../utils/dotnet-new';
Expand Down
15 changes: 15 additions & 0 deletions packages/core/src/generators/test/generator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,20 @@ describe('nx-dotnet test project generator', () => {
}
`);
});

it('should handle dotnet pathschemes with directory', () => {
expect(
calculateTestTargetNameAndRoot(
'dotnet',
'Domain.Existing.App',
'apps/domain/Existing.App',
),
).toMatchInlineSnapshot(`
{
"name": "Domain.Existing.App.Test",
"root": "apps/domain/Existing.App.Test",
}
`);
});
});
});
Loading

0 comments on commit 2ec85a2

Please sign in to comment.