Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ionic-react): fix build target + fix e2e tests #1111

Merged
merged 8 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions e2e/ionic-react-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"projectType": "application",
"sourceRoot": "e2e/ionic-react-e2e/tests",
"targets": {
"e2e": {},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
Expand Down
10 changes: 4 additions & 6 deletions e2e/ionic-react-e2e/tests/ionic-react.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { runNxCommandAsync, uniq } from '@nx/plugin/testing';
import { createTestProject, installPlugin } from '@nxext/e2e-utils';
import { createTestProject, installPlugin, stripAnsi } from '@nxext/e2e-utils';
import { rmSync } from 'fs';

const ansiEscapeCodeRegex = /\x1B\[[0-?]*[ -/]*[@-~]/g;

describe('ionic-react-project e2e', () => {
let projectDirectory: string;
const app = uniq('ionic-react');
Expand All @@ -13,7 +11,7 @@ describe('ionic-react-project e2e', () => {
installPlugin(projectDirectory, 'ionic-react');

await runNxCommandAsync(
`generate @nx/react:application ${app} --style=css --minimal --e2eTestRunner=none --linter=none --projectNameAndRootFormat=derived --skipFormat=true`
`generate @nx/react:application ${app} --style=css --bundler=vite --unitTestRunner=vitest --minimal --e2eTestRunner=none --linter=none --projectNameAndRootFormat=derived --skipFormat=true`
);
await runNxCommandAsync(
`generate @nxext/ionic-react:configuration --project=${app} --appName=test --appId=test --skipFormat=true`
Expand All @@ -30,14 +28,14 @@ describe('ionic-react-project e2e', () => {

it('should build successfully', async () => {
const buildResults = await runNxCommandAsync(`build ${app}`);
expect(buildResults.stdout.replace(ansiEscapeCodeRegex, '')).toContain(
expect(stripAnsi(buildResults.stdout)).toContain(
`Successfully ran target build for project ${app}`
);
});

it('should run tests successfully', async () => {
const testResults = await runNxCommandAsync(`test ${app}`);
expect(testResults.stdout.replace(ansiEscapeCodeRegex, '')).toContain(
expect(stripAnsi(testResults.stdout)).toContain(
`Successfully ran target test for project ${app}`
);
});
Expand Down
7 changes: 3 additions & 4 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"cache": true
},
"nx-release-publish": {
"dependsOn": ["build"],
"dependsOn": ["^build"],
"options": {
"packageRoot": "dist/{projectRoot}"
}
Expand All @@ -116,11 +116,10 @@
"projects": ["packages/*", "!common"],
"projectsRelationship": "independent",
"version": {
"conventionalCommits": true,
"generatorOptions": {
"currentVersionResolver": "git-tag",
"fallbackCurrentVersionResolver": "disk",
"updateDependents": "auto",
"specifierSource": "conventional-commits"
"updateDependents": "auto"
}
},
"changelog": {
Expand Down
9 changes: 5 additions & 4 deletions packages/capacitor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nxext/capacitor",
"version": "19.1.1",
"version": "0.0.0-e2e",
"description": "An Nx plugin for developing cross-platform applications using Capacitor",
"homepage": "https://nxext.github.io/nx-extensions/docs/capacitor/getting-started.html",
"repository": {
Expand All @@ -18,10 +18,11 @@
"schematics": "./generators.json",
"builders": "./executors.json",
"dependencies": {
"@nx/devkit": "^19.0.0",
"nx": "^19.0.0",
"ignore": "^5.3.1",
"tslib": "^2.3.0"
},
"peerDependencies": {}
"peerDependencies": {
"@nx/devkit": "^19.0.0",
"nx": "^19.0.0"
}
}
11 changes: 6 additions & 5 deletions packages/ionic-angular/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@nxext/ionic-angular",
"description": "An Nx plugin for developing Ionic Angular applications",
"version": "19.1.1",
"version": "0.0.0-e2e",
"homepage": "https://nxext.github.io/nx-extensions/docs/ionic-angular/overview.html",
"repository": {
"type": "git",
Expand All @@ -20,12 +20,13 @@
"schematics": "./generators.json",
"builders": "./executors.json",
"dependencies": {
"@nxext/capacitor": "^19.1.1",
"@nx/devkit": "^19.0.0",
"@nx/angular": "^19.0.0",
"@nxext/capacitor": "^0.0.0-e2e",
"tslib": "^2.3.0",
"typescript": "5.5.4",
"@phenomnomnominal/tsquery": "~5.0.1"
},
"peerDependencies": {}
"peerDependencies": {
"@nx/devkit": "^19.0.0",
"@nx/angular": "^19.0.0"
}
}
9 changes: 5 additions & 4 deletions packages/ionic-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nxext/ionic-react",
"version": "19.1.1",
"version": "0.0.0-e2e",
"description": "An Nx plugin for developing Ionic React applications and libraries",
"homepage": "https://nxext.github.io/nx-extensions/docs/ionic-react/overview.html",
"repository": {
Expand All @@ -20,9 +20,10 @@
"schematics": "./generators.json",
"builders": "./executors.json",
"dependencies": {
"@nxext/capacitor": "^19.1.1",
"@nx/devkit": "^19.0.0",
"@nxext/capacitor": "^0.0.0-e2e",
"tslib": "^2.3.0"
},
"peerDependencies": {}
"peerDependencies": {
"@nx/devkit": "^19.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import {
ionicReactRouterVersion,
ionicReactVersion,
ionIconsVersion,
reactRouterVersion,
capacitorPluginsVersion,
reactRouterDomTypesVersion,
reactRouterTypesVersion,
} from '../../../utils/versions';

export function addDependencies(host: Tree) {
Expand All @@ -12,7 +16,18 @@ export function addDependencies(host: Tree) {
'@ionic/react': ionicReactVersion,
'@ionic/react-router': ionicReactRouterVersion,
ionicons: ionIconsVersion,
'@capacitor/haptics': capacitorPluginsVersion,
'@capacitor/keyboard': capacitorPluginsVersion,
'@capacitor/status-bar': capacitorPluginsVersion,
/**
* Following deps are overwrite because React Router v6 is not compatible with Ionic React Router
*/
'react-router': reactRouterVersion,
'react-router-dom': reactRouterVersion,
},
{}
{
'@types/react-router': reactRouterTypesVersion,
'@types/react-router-dom': reactRouterDomTypesVersion,
}
);
}
8 changes: 8 additions & 0 deletions packages/ionic-react/src/utils/versions.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
export const ionicReactVersion = '^8.0.0';
export const ionicReactRouterVersion = '^8.0.0';
export const ionIconsVersion = '^7.0.0';
export const capacitorPluginsVersion = '^6.0.0';
/**
* React Router v6 is not compatible with Ionic React Router, so we force using the v5
* See: https://github.com/ionic-team/ionic-framework/issues/24177, https://github.com/ionic-team/ionic-framework/blob/main/packages/react-router/package.json#L46
*/
export const reactRouterVersion = '^5.3.4';
export const reactRouterTypesVersion = '^5.1.20';
export const reactRouterDomTypesVersion = '^5.3.3';
2 changes: 1 addition & 1 deletion packages/preact/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nxext/preact",
"version": "19.0.1",
"version": "0.0.0-e2e",
"license": "MIT",
"author": "Jordan Hall",
"description": "Nx plugin for preact",
Expand Down
2 changes: 1 addition & 1 deletion packages/solid/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nxext/solid",
"version": "19.0.1",
"version": "0.0.0-e2e",
"license": "MIT",
"author": "Dominik Pieper",
"description": "Nx plugin for solid",
Expand Down
2 changes: 1 addition & 1 deletion packages/stencil/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nxext/stencil",
"version": "19.0.1",
"version": "0.0.0-e2e",
"license": "MIT",
"author": "Dominik Pieper",
"description": "Nx plugin for stenciljs",
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nxext/svelte",
"version": "19.0.1",
"version": "0.0.0-e2e",
"license": "MIT",
"author": "Dominik Pieper",
"description": "Nx plugin for Svelte",
Expand Down
2 changes: 1 addition & 1 deletion packages/sveltekit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nxext/sveltekit",
"version": "19.0.1",
"version": "0.0.0-e2e",
"license": "MIT",
"author": "Dominik Pieper",
"description": "Nx plugin for Sveltekit",
Expand Down
10 changes: 10 additions & 0 deletions tools/scripts/start-local-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* It is meant to be called in jest's globalSetup.
*/
import { startLocalRegistry } from '@nx/js/plugins/jest/local-registry';
import { execFileSync } from 'child_process';
import { releasePublish, releaseVersion } from 'nx/release';

export default async () => {
Expand Down Expand Up @@ -30,6 +31,15 @@ export default async () => {
},
});

execFileSync('pnpm', [
'nx',
'run-many',
'-t',
'build',
'--exclude',
'docs,common',
]);

await releasePublish({
tag: 'e2e',
firstRelease: true,
Expand Down