Leosvel Pérez Espinosa 58ba1ffc6d
feat(angular): support angular v18.1.0 (#26504)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
<!-- This is the behavior we have today -->

Angular v18.1.0 is not supported.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Angular v18.1.0 should be supported.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2024-07-11 11:17:00 -04:00

54 lines
1.6 KiB
JavaScript

#!/usr/bin/env node
/**
* USAGE:
*
* Run the following command from the root of the workspace.
* Replace the versions with the correct target versions
*
* pnpm ts-node scripts/angular-support-upgrades/init-upgrade.ts --angularVersion=next --targetNxVersion=15.5.0 --targetNxMigrationVersion=15.5.0-beta.0
*
*/
import { execSync } from 'child_process';
import { buildMigrations } from './build-migrations';
import { fetchVersionsFromRegistry } from './fetch-versions-from-registry';
import { updatePackageJsonForAngular } from './update-package-jsons';
import { updateVersionUtils } from './update-version-utils';
const yargs = require('yargs/yargs');
const { hideBin } = require('yargs/helpers');
const argv = yargs(hideBin(process.argv)).argv;
if (
!argv.angularVersion &&
!argv.targetNxVersion &&
!argv.targetNxMigrationVersion
) {
throw new Error(
'You need to provide --angularVersion=(latest|next) and --targetNxVersion=versionString and --targetNxMigrationVersion=versionString'
);
}
async function run() {
const packageVersionMap = await fetchVersionsFromRegistry(
argv.angularVersion
);
await updatePackageJsonForAngular(packageVersionMap);
await buildMigrations(
packageVersionMap,
argv.targetNxVersion,
argv.targetNxMigrationVersion
);
updateVersionUtils(packageVersionMap);
console.log('⏳ - Installing packages...');
execSync('pnpm install', { stdio: 'inherit', encoding: 'utf8' });
console.log('✅ - Finished installing packages!');
console.log('⏳ - Formatting files...');
execSync('pnpm nx format', { stdio: 'inherit', encoding: 'utf8' });
console.log('✅ - Finished creating migrations!');
}
run();