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(release): workaround nx bug in release script #375

Merged
merged 2 commits into from
Oct 4, 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
2 changes: 1 addition & 1 deletion apps/wallet/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ watch(
return;
}

const newId = Array.isArray(queryParam) ? queryParam?.[0] ?? '' : queryParam;
const newId = Array.isArray(queryParam) ? (queryParam?.[0] ?? '') : queryParam;

if (newId !== stationId.value) {
stationId.value = newId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ watch(
requestId.value = null;
}

const id = Array.isArray(queryParam) ? queryParam?.[0] ?? '' : queryParam;
const id = Array.isArray(queryParam) ? (queryParam?.[0] ?? '') : queryParam;

requestId.value = isValidUUID(`${id}`) ? id : null;
},
Expand Down
22 changes: 22 additions & 0 deletions cli/src/release/prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,28 @@ command.action(async options => {

console.log('Generating changelogs...');

// TODO: Remove this workaround when the issue is fixed in NX CLI.
//
// NX has a bug that is not removing dependent projects from the list of dependent projects when they are ignored.
// This is a workaround for that issue.
const ignoredProjects = new Set([
'integration-tests',
'orbit-essentials-macros-tests',
'test_canister',
]);
Object.entries(projectsVersionData).forEach(([projectName, projectVersionData]) => {
if (projectVersionData.dependentProjects.length) {
projectsVersionData[projectName].dependentProjects =
projectVersionData.dependentProjects.filter(dependentProject => {
if (dependentProject.source) {
return !ignoredProjects.has(dependentProject.source);
}

return true;
});
}
});

const { projectChangelogs } = await releaseChangelog({
versionData: projectsVersionData,
verbose: options.verbose,
Expand Down
5 changes: 2 additions & 3 deletions cli/src/release/publish.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { execSync } from 'child_process';
import { createCommand } from 'commander';
import { readFileSync } from 'fs';
import { fileExists } from 'nx/src/utils/fileutils';
import { existsSync, readFileSync } from 'fs';
import { isAbsolute, join } from 'path';
import configuration from '../config';
import { capitalize, gitTagExists, targetExists } from '../utils';
Expand Down Expand Up @@ -30,7 +29,7 @@ command.action(async options => {
throw new Error('Invalid release file path. Must be a JSON file.');
}

if (!fileExists(releaseFilePath)) {
if (!existsSync(releaseFilePath)) {
console.warn(`The release file at ${releaseFilePath} does not exist. Skipping release.`);

return;
Expand Down
5 changes: 2 additions & 3 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@
"releaseTagPattern": "@orbit/{projectName}-v{version}",
"projects": [
"libs/*",
"!libs/orbit-essentials-macros-tests",
"core/**",
"apps/**",
"tools/**",
"tests/**",
"!tests/integration"
"!libs/orbit-essentials-macros-tests",
"!tests/**"
]
},
"namedInputs": {
Expand Down
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,18 @@
"packageManager": "[email protected]",
"devDependencies": {
"@monodon/rust": "2.0.0",
"nx": "19.8.3",
"@nx/devkit": "19.8.3",
"@nx/js": "19.8.3",
"@nx/workspace": "19.8.3",
"@swc-node/register": "1.9.1",
"@swc/core": "1.5.5",
"@swc/helpers": "0.5.13",
"@types/node": "20.11.25",
"@typescript-eslint/eslint-plugin": "7.9.0",
"@typescript-eslint/parser": "7.9.0",
"@vitest/coverage-v8": "1.6.0",
"concurrently": "8.2.2",
"eslint-config-prettier": "9.1.0",
"prettier": "3.2.5",
"typescript": "5.4.5",
"nx": "19.8.3",
"prettier": "3.3.3",
"typescript": "5.6.2",
"vite": "5.2.11",
"vitest": "1.6.0",
"vue-tsc": "2.1.6"
Expand Down
Loading
Loading