Skip to content

Commit

Permalink
chore(qwik-nx): nx 17.3 support (#224)
Browse files Browse the repository at this point in the history
* chore(repo): update dependencies

* chore(repo): [nx migration] simplify-eslint-patterns

* chore(repo): [nx migration] move-options-to-target-defaults

* chore(repo): [nx migration] move-options-to-target-defaults

* chore(qwik-nx): additional updates
  • Loading branch information
dmitry-stepanenko authored Feb 13, 2024
1 parent 9efc0b5 commit b740703
Show file tree
Hide file tree
Showing 18 changed files with 872 additions and 689 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"unused-imports/no-unused-imports": "error",
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,18 @@ This plugin supports Nx migrations and provides necessary version and code updat

## qwik-nx & Nx Compatibility Chart

| qwik-nx version | Nx version |
| ------------------ | ---------- |
| ^2.0.0 | ^17.0.0 |
| ^1.1.0 | ^16.8.0 |
| ^1.0.0 | ^16.0.0 |
| ^0.16.0 | ^16.0.0 |
| >= 0.12.0 < 0.16.0 | ^15.8.0 |
| ~0.10.0, ~0.11.0 | ~15.7.2 |
| >= 0.6.0 < 0.10.0 | ~15.6.0 |
| ~0.5.0 | ~15.5.0 |
| ~0.4.0 | ~15.4.0 |
| <=0.4.0 | ^15.0.0 |
| qwik-nx version | Nx version |
| ------------------ | ---------------- |
| ^2.0.0 | ^17.0.0, ^18.0.0 |
| ^1.1.0 | ^16.8.0 |
| ^1.0.0 | ^16.0.0 |
| ^0.16.0 | ^16.0.0 |
| >= 0.12.0 < 0.16.0 | ^15.8.0 |
| ~0.10.0, ~0.11.0 | ~15.7.2 |
| >= 0.6.0 < 0.10.0 | ~15.6.0 |
| ~0.5.0 | ~15.5.0 |
| ~0.4.0 | ~15.4.0 |
| <=0.4.0 | ^15.0.0 |

We will provide support for Nx 15 with critical bug fixes and minor features for a while. If you're using [email protected] or higher, you can stick to [email protected].

Expand Down
5 changes: 1 addition & 4 deletions e2e/qwik-nx-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["e2e/qwik-nx-e2e/**/*.ts"]
}
"outputs": ["{options.outputFile}"]
}
},
"tags": [],
Expand Down
1 change: 1 addition & 0 deletions jest.preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ module.exports = {
* More info: https://jestjs.io/docs/upgrading-to-jest29#snapshot-format
*/
snapshotFormat: { escapeString: true, printBasicPrototype: true },
testTimeout: 10000,
};
21 changes: 15 additions & 6 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,25 @@
"version": {
"dependsOn": ["build"]
},
"lint": {
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"],
"e2e": {
"cache": true
},
"test": {
"inputs": ["default", "^default", "{workspaceRoot}/jest.preset.js"],
"@nx/eslint:lint": {
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"],
"cache": true
},
"e2e": {
"cache": true
"@nx/jest:jest": {
"inputs": ["default", "^default", "{workspaceRoot}/jest.preset.js"],
"cache": true,
"options": {
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
}
},
"workspaceLayout": {
Expand Down
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,41 @@
"pnpm": "^8.0.0"
},
"devDependencies": {
"@builder.io/qwik": "^1.2.12",
"@builder.io/qwik": "~1.4.4",
"@commitlint/cli": "^17.3.0",
"@commitlint/config-angular": "^17.3.0",
"@commitlint/config-conventional": "^17.3.0",
"@jscutlery/semver": "^4.0.0",
"@nx/cypress": "17.0.3",
"@nx/devkit": "17.0.3",
"@nx/eslint": "17.0.3",
"@nx/eslint-plugin": "17.0.3",
"@nx/jest": "17.0.3",
"@nx/js": "17.0.3",
"@nx/playwright": "17.0.3",
"@nx/plugin": "17.0.3",
"@nx/storybook": "17.0.3",
"@nx/vite": "17.0.3",
"@nx/workspace": "17.0.3",
"@nx/cypress": "17.3.0",
"@nx/devkit": "17.3.0",
"@nx/eslint": "17.3.0",
"@nx/eslint-plugin": "17.3.0",
"@nx/jest": "17.3.0",
"@nx/js": "17.3.0",
"@nx/playwright": "17.3.0",
"@nx/plugin": "17.3.0",
"@nx/storybook": "17.3.0",
"@nx/vite": "17.3.0",
"@nx/workspace": "17.3.0",
"@swc-node/register": "1.6.8",
"@swc/cli": "0.1.62",
"@swc/core": "^1.3.95",
"@types/fs-extra": "11.0.1",
"@types/jest": "29.4.0",
"@types/node": "16.11.7",
"@types/node": "18.19.15",
"@types/semver": "7.5.6",
"@types/tcp-port-used": "1.0.1",
"@types/yargs": "17.0.24",
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "5.62.0",
"@typescript-eslint/eslint-plugin": "6.21.0",
"@typescript-eslint/parser": "6.21.0",
"all-contributors-cli": "^6.24.0",
"chalk": "^4.1.0",
"commitizen": "^4.2.5",
"commitlint": "^17.3.0",
"create-nx-workspace": "17.0.3",
"cz-conventional-changelog": "^3.3.0",
"enquirer": "2.3.6",
"eslint": "8.46.0",
"eslint": "8.48.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-unused-imports": "2.0.0",
"fs-extra": "11.1.0",
Expand All @@ -65,7 +65,7 @@
"jsonc-eslint-parser": "^2.1.0",
"kill-port": "2.0.1",
"ngx-deploy-npm": "^6.0.0",
"nx": "17.0.3",
"nx": "17.3.0",
"prettier": "^2.8.0",
"pretty-quick": "^3.1.3",
"semver": "7.6.0",
Expand All @@ -76,7 +76,7 @@
"ts-node": "10.9.1",
"typescript": "4.9.5",
"verdaccio": "5.21.1",
"vite": "~4.4.11",
"vite": "~5.0.0",
"yargs": "17.7.1"
},
"dependencies": {
Expand Down
8 changes: 2 additions & 6 deletions packages/add-nx-to-qwik/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
"projectType": "library",
"targets": {
"lint": {
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": ["packages/add-nx-to-qwik/**/*.ts"]
}
"executor": "@nx/eslint:lint"
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/packages/add-nx-to-qwik"],
"options": {
"jestConfig": "packages/add-nx-to-qwik/jest.config.ts",
"passWithNoTests": true
"jestConfig": "packages/add-nx-to-qwik/jest.config.ts"
}
},
"build-base": {
Expand Down
2 changes: 1 addition & 1 deletion packages/add-nx-to-qwik/src/add-nx-to-qwik.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function createNxJsonFile(
repoRoot: string,
targetDefaults: string[],
cacheableOperations: string[],
scriptOutputs: { [name: string]: string }
scriptOutputs: Record<string, string>
) {
const nxJsonPath = joinPathFragments(repoRoot, 'nx.json');
let nxJson = {} as any;
Expand Down
11 changes: 0 additions & 11 deletions packages/create-qwik-nx/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,6 @@
},
"lint": {
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": [
"packages/create-qwik-nx/**/*.ts",
"packages/create-qwik-nx/**/*.spec.ts",
"packages/create-qwik-nx/**/*_spec.ts",
"packages/create-qwik-nx/**/*.spec.tsx",
"packages/create-qwik-nx/**/*.spec.js",
"packages/create-qwik-nx/**/*.spec.jsx",
"packages/create-qwik-nx/**/*.d.ts"
]
},
"outputs": ["{options.outputFile}"]
},
"version": {
Expand Down
14 changes: 2 additions & 12 deletions packages/qwik-nx/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,13 @@
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"packages/qwik-nx/**/*.ts",
"packages/qwik-nx/generators.json",
"packages/qwik-nx/executors.json",
"packages/qwik-nx/package.json",
"packages/qwik-nx/migrations.json"
]
}
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "packages/qwik-nx/jest.config.ts",
"passWithNoTests": true
"jestConfig": "packages/qwik-nx/jest.config.ts"
}
},
"version": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,16 @@ export async function appGeneratorInternal(

addFiles(tree, normalizedOptions);

// TODO: keeping them for compatibility with nx <17.3.0
const deprecatedOptions = {
includeLib: false,
uiFramework: 'none',
testEnvironment: 'node',
};
tasks.push(
await initGenerator(tree, {
includeLib: false,
uiFramework: 'none',
testEnvironment: 'node',
...deprecatedOptions,
keepExistingVersions: true,
})
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ import {
import { normalizePath } from 'vite';
import { ComponentGeneratorSchema, NormalizedSchema } from '../schema';

type GenerationPaths = {
interface GenerationPaths {
directory: string;
name: string;
};
}

type NameInfo = { name: string; path: string };
interface NameInfo {
name: string;
path: string;
}

function parseNameWithPath(rawName: string): NameInfo {
const parsedName = normalizePath(rawName).split('/');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ Object {
"libs/shared/mylib/**/*.{ts,tsx,js,jsx}",
],
},
"outputs": Array [
"{options.outputFile}",
],
},
"test": Object {
"executor": "@nx/vite:test",
Expand Down Expand Up @@ -50,9 +47,6 @@ Object {
"packages/mylib/**/*.{ts,tsx,js,jsx}",
],
},
"outputs": Array [
"{options.outputFile}",
],
},
"test": Object {
"executor": "@nx/vite:test",
Expand Down Expand Up @@ -84,9 +78,6 @@ Object {
"packages/shared/mylib/**/*.{ts,tsx,js,jsx}",
],
},
"outputs": Array [
"{options.outputFile}",
],
},
"test": Object {
"executor": "@nx/vite:test",
Expand Down Expand Up @@ -118,9 +109,6 @@ Object {
"libs/shared/mylib/**/*.{ts,tsx,js,jsx}",
],
},
"outputs": Array [
"{options.outputFile}",
],
},
"test": Object {
"executor": "@nx/vite:test",
Expand Down Expand Up @@ -152,9 +140,6 @@ Object {
"libs/mylib/**/*.{ts,tsx,js,jsx}",
],
},
"outputs": Array [
"{options.outputFile}",
],
},
"test": Object {
"executor": "@nx/vite:test",
Expand Down Expand Up @@ -186,9 +171,6 @@ Object {
"libs/shared/mylib/**/*.{ts,tsx,js,jsx}",
],
},
"outputs": Array [
"{options.outputFile}",
],
},
"test": Object {
"executor": "@nx/vite:test",
Expand Down Expand Up @@ -220,9 +202,6 @@ Object {
"libs/mylib/**/*.{ts,tsx,js,jsx}",
],
},
"outputs": Array [
"{options.outputFile}",
],
},
"test": Object {
"executor": "@nx/vite:test",
Expand Down Expand Up @@ -364,9 +343,6 @@ Object {
"libs/mylib/**/*.{ts,tsx,js,jsx}",
],
},
"outputs": Array [
"{options.outputFile}",
],
},
"test": Object {
"executor": "@nx/vite:test",
Expand Down
Loading

0 comments on commit b740703

Please sign in to comment.