Skip to content

Commit

Permalink
feat(qwik-nx): nx 19 support (#231)
Browse files Browse the repository at this point in the history
* feat(qwik-nx): nx 19 support

* feat(qwik-nx): bump deps

* chore(repo): use jest as e2e executor
  • Loading branch information
dmitry-stepanenko authored May 23, 2024
1 parent 425230e commit a821e76
Show file tree
Hide file tree
Showing 15 changed files with 583 additions and 436 deletions.
19 changes: 5 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,11 @@ 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, ^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].
| qwik-nx version | Nx version |
| --------------- | ------------------------- |
| ^2.0.0 | ^17.0.0, ^18.0.0, ^19.0.0 |
| ^1.1.0 | ^16.8.0 |
| ^1.0.0 | ^16.0.0 |

## ROADMAP:

Expand Down
6 changes: 3 additions & 3 deletions e2e/qwik-nx-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"sourceRoot": "e2e/qwik-nx-e2e/src",
"targets": {
"e2e": {
"executor": "@nx/plugin:e2e",
"executor": "@nx/jest:jest",
"options": {
"target": "qwik-nx:build",
"jestConfig": "e2e/qwik-nx-e2e/jest.config.ts",
"maxWorkers": 1
}
},
"dependsOn": ["^build"]
},
"lint": {
"executor": "@nx/eslint:lint",
Expand Down
8 changes: 4 additions & 4 deletions e2e/qwik-nx-e2e/tests/chore.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ describe('misc checks', () => {
expect(packageJson.dependencies).toBeUndefined();
expect(packageJson.devDependencies).toBeUndefined();
expect(packageJson.peerDependencies).toEqual({
'@nx/devkit': '^17.0.0 || ^18.0.0',
'@nx/js': '^17.0.0 || ^18.0.0',
'@nx/eslint': '^17.0.0 || ^18.0.0',
'@nx/vite': '^17.0.0 || ^18.0.0',
'@nx/devkit': '^17.0.0 || ^18.0.0 || ^19.0.0',
'@nx/js': '^17.0.0 || ^18.0.0 || ^19.0.0',
'@nx/eslint': '^17.0.0 || ^18.0.0 || ^19.0.0',
'@nx/vite': '^17.0.0 || ^18.0.0 || ^19.0.0',
});
},
DEFAULT_E2E_TIMEOUT
Expand Down
3 changes: 2 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@
"appsDir": "e2e",
"libsDir": "packages"
},
"nxCloudAccessToken": "MmI5MzJhMDctNGYwMi00OTI1LWJiZjUtNWIwNTQ4NmY2ZjhjfHJlYWQtd3JpdGU="
"nxCloudAccessToken": "MmI5MzJhMDctNGYwMi00OTI1LWJiZjUtNWIwNTQ4NmY2ZjhjfHJlYWQtd3JpdGU=",
"useInferencePlugins": false
}
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,36 @@
"@commitlint/config-angular": "^17.8.1",
"@commitlint/config-conventional": "^17.8.1",
"@jscutlery/semver": "^4.2.0",
"@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",
"@nx/cypress": "19.0.6",
"@nx/devkit": "19.0.6",
"@nx/eslint": "19.0.6",
"@nx/eslint-plugin": "19.0.6",
"@nx/jest": "19.0.6",
"@nx/js": "19.0.6",
"@nx/playwright": "19.0.6",
"@nx/plugin": "19.0.6",
"@nx/storybook": "19.0.6",
"@nx/vite": "19.0.6",
"@nx/workspace": "19.0.6",
"@swc-node/register": "1.8.0",
"@swc/cli": "0.3.12",
"@swc/core": "^1.4.1",
"@types/fs-extra": "11.0.1",
"@types/jest": "29.4.0",
"@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": "6.21.0",
"@typescript-eslint/parser": "6.21.0",
"@typescript-eslint/eslint-plugin": "7.9.0",
"@typescript-eslint/parser": "7.9.0",
"all-contributors-cli": "^6.26.1",
"chalk": "^4.1.2",
"commitizen": "^4.3.0",
"commitlint": "^17.8.1",
"create-nx-workspace": "17.0.3",
"cz-conventional-changelog": "^3.3.0",
"enquirer": "2.3.6",
"eslint": "8.48.0",
"eslint": "8.57.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.4.0",
"kill-port": "2.0.1",
"ngx-deploy-npm": "8.0.1",
"nx": "17.3.0",
"nx": "19.0.6",
"prettier": "^2.8.8",
"pretty-quick": "^3.3.1",
"semver": "7.6.0",
Expand Down
17 changes: 17 additions & 0 deletions packages/qwik-nx/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,23 @@
"version": "^1.0.0"
}
}
},
"2.3.0": {
"version": "2.3.0",
"packages": {
"@builder.io/qwik": {
"version": "~1.5.5"
},
"@builder.io/qwik-city": {
"version": "~1.5.5"
},
"eslint-plugin-qwik": {
"version": "~1.5.5"
},
"vite": {
"version": "~5.2.0"
}
}
}
}
}
8 changes: 4 additions & 4 deletions packages/qwik-nx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"generators": "./generators.json",
"executors": "./executors.json",
"peerDependencies": {
"@nx/devkit": "^17.0.0 || ^18.0.0",
"@nx/js": "^17.0.0 || ^18.0.0",
"@nx/vite": "^17.0.0 || ^18.0.0",
"@nx/eslint": "^17.0.0 || ^18.0.0"
"@nx/devkit": "^17.0.0 || ^18.0.0 || ^19.0.0",
"@nx/js": "^17.0.0 || ^18.0.0 || ^19.0.0",
"@nx/vite": "^17.0.0 || ^18.0.0 || ^19.0.0",
"@nx/eslint": "^17.0.0 || ^18.0.0 || ^19.0.0"
},
"nx-migrations": {
"migrations": "./migrations.json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ export async function appGeneratorInternal(
);

if (normalizedOptions.linter === Linter.EsLint) {
tasks.push(configureEslint(tree, normalizedOptions.projectName, true));
tasks.push(
await configureEslint(tree, normalizedOptions.projectName, true)
);
}

if (normalizedOptions.styleExtension) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,7 @@ exports[`host generator should run successfully 3`] = `
\\"$schema\\": \\"../../node_modules/nx/schemas/project-schema.json\\",
\\"projectType\\": \\"application\\",
\\"sourceRoot\\": \\"apps/myhostapp/src\\",
\\"tags\\": [],
\\"targets\\": {
\\"build\\": {
\\"executor\\": \\"qwik-nx:build\\",
Expand Down Expand Up @@ -1097,8 +1098,7 @@ exports[`host generator should run successfully 3`] = `
\\"cwd\\": \\"apps/myhostapp\\"
}
}
},
\\"tags\\": []
}
}
"
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function libraryGeneratorInternal(
tasks.push(await configureVite(tree, options));

if (options.linter === Linter.EsLint) {
tasks.push(configureEslint(tree, options.projectName, true));
tasks.push(await configureEslint(tree, options.projectName, true));
}

tasks.push(addCommonQwikDependencies(tree));
Expand Down
13 changes: 11 additions & 2 deletions packages/qwik-nx/src/utils/add-common-qwik-dependencies.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,22 @@ describe('init generator', () => {
expect(devDependencies['@builder.io/qwik']).toBe('my-version');
});

it('should override existing versions if they are listed in "unsupportedPackageVersions"', async () => {
it('should override existing versions if they are listed in "unsupportedPackageVersions" 1', async () => {
updateJson(appTree, 'package.json', (json) => {
(json.devDependencies ??= {})['vite'] = '5.1.1';
return json;
});
await addCommonQwikDependencies(appTree);
const { devDependencies } = readJson(appTree, 'package.json');
expect(devDependencies['vite']).toBe('~5.0.0');
expect(devDependencies['vite']).toBe('~5.2.0');
});
it('should not override existing versions if they are listed in "unsupportedPackageVersions" and have proper version', async () => {
updateJson(appTree, 'package.json', (json) => {
(json.devDependencies ??= {})['vite'] = '5.2.1';
return json;
});
await addCommonQwikDependencies(appTree);
const { devDependencies } = readJson(appTree, 'package.json');
expect(devDependencies['vite']).toBe('5.2.1');
});
});
2 changes: 1 addition & 1 deletion packages/qwik-nx/src/utils/add-common-qwik-dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function addCommonQwikDependencies(tree: Tree): GeneratorCallback {

const unsupportedPackageVersions = new Map<string, string>([
// https://github.com/vitejs/vite/issues/15870
['vite', '<5.1.0'],
['vite', '<5.1.0 || >=5.2.0'],
]);
let hasChanges = false;
for (const [dep, versionRange] of unsupportedPackageVersions.entries()) {
Expand Down
6 changes: 3 additions & 3 deletions packages/qwik-nx/src/utils/configure-eslint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import {
import { lintProjectGenerator, Linter } from '@nx/eslint';
import { qwikEslintPluginVersion } from './versions';

export function configureEslint(
export async function configureEslint(
tree: Tree,
project: string,
skipLibsEslintConfig = false
): GeneratorCallback {
): Promise<GeneratorCallback> {
const cfg = readProjectConfiguration(tree, project);

const existingLibEslintConfigPath = joinPathFragments(
Expand All @@ -26,7 +26,7 @@ export function configureEslint(
existingLibEslintConfig = tree.read(existingLibEslintConfigPath);
}

lintProjectGenerator(tree, {
await lintProjectGenerator(tree, {
project: project,
linter: Linter.EsLint,
skipFormat: true,
Expand Down
13 changes: 4 additions & 9 deletions packages/qwik-nx/src/utils/versions.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// qwik packages
export const qwikVersion = '~1.4.4';
export const qwikCityVersion = '~1.4.4';
export const qwikEslintPluginVersion = '~1.4.4';
export const qwikVersion = '~1.5.5';
export const qwikCityVersion = '~1.5.5';
export const qwikEslintPluginVersion = '~1.5.5';

// css preprocessors
export const sassVersion = '~1.56.1';
export const lessVersion = '~4.1.3';
export const stylusVersion = '~0.59.0';

export const undiciVersion = '^5.22.0';
export const viteVersion = '~5.0.0';
export const viteVersion = '~5.2.0';
export const viteTsconfigPathsVersion = '~4.2.0';
export const vitestVersion = '^1.0.0';

Expand Down Expand Up @@ -45,11 +45,6 @@ export const vitePluginAngularVersion = '~0.2.0';
export const qwikAngularVersion = '~0.2.0';

// other
export const eslintVersion = '~8.36.0';
export const tsEslintVersion = '~5.43.0';
export const prettierVersion = '~2.8.7';
export const typescriptVersion = '~5.0.2';
export const nodeFetchVersion = '~3.3.0';
export const typesNodeVersion = '^18.16.1';
export const typesEslint = '~8.37.0';
export const tsMorphVersion = '^17.0.0';
Loading

0 comments on commit a821e76

Please sign in to comment.