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

chore: add migration scripts for bootstrap dependency removal #19926

Merged
merged 29 commits into from
Feb 4, 2025

Conversation

kpawelczak
Copy link
Contributor

@kpawelczak kpawelczak commented Jan 23, 2025

closes: CXSPA-9283

The migration.json file will likely need to be updated. Currently, the changes made are only intended to enable testing.

QA (installation script):

  • change version of all packages to 2211.35.0 (temporary test value)
  • run npm run config:update and then npm run generate:deps
  • ts-node ./tools/schematics/testing.ts in the SPA root folder
  • build all libraries and publish
  • create new app npx @angular/cli@17 new my-app --standalone=false --style=scss --routing=false
  • go to the project's directory and install latest SPA 2211.x ng add @spartacus/schematics, e.g. from RBSC (.npmrc is needed)
  • migrate to Angualr 18, then 19 (following migration docs
  • add any bootsrap import in any of the scss files e.g. 'bootstrap/scss/grid'
  • run ng update @spartacus/schematics
  • verify if migration runs (logs in console)

@kpawelczak kpawelczak requested a review from a team as a code owner January 23, 2025 15:49
@github-actions github-actions bot marked this pull request as draft January 23, 2025 15:49
@kpawelczak kpawelczak marked this pull request as ready for review January 24, 2025 11:21
@github-actions github-actions bot marked this pull request as draft January 24, 2025 11:24
projects/schematics/src/migrations/migrations.json Outdated Show resolved Hide resolved
Comment on lines 28 to 44
export function uninstallBootstrap(): Rule {
return (tree: Tree, context: SchematicContext) => {
// Execute the npm uninstall command
exec('npm uninstall bootstrap', (error, stdout, stderr) => {
if (error) {
context.logger.error(`Error uninstalling Bootstrap: ${error.message}`);
return;
}
if (stderr) {
context.logger.warn(`Warnings during uninstall: ${stderr}`);
}
context.logger.info(`Bootstrap uninstalled successfully:\n${stdout}`);
});

return tree;
};
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM]

  1. Some customers might be using yarn or pnpm. So we should not execute the npm command directly, but instead rely on some more universal mechanisms for dependency management.
  2. Don't we already have a logic for removing Bootstrap in this file: .../2212_32/dependency-management/dependency-management.ts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried using dependecy-management but it doesnt remove bootstrap and as far as I remember, the code I think doesnt have any functions that would remove bootstrap. All it does is show a message about bootstrap.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After second look it does filter out the libraries from the package json and runs installation. However, in my testing it never removed bootstrap.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm that the dependency manager is aimed only at spartacus libraries

@kpawelczak kpawelczak marked this pull request as ready for review February 3, 2025 09:19
Copy link
Contributor

github-actions bot commented Feb 3, 2025

Merge Checks Failed

Please push a commit to re-trigger the build. 
To push an empty commit you can use `git commit --allow-empty -m "Trigger Build"`

@github-actions github-actions bot marked this pull request as draft February 3, 2025 09:29
@kpawelczak kpawelczak marked this pull request as ready for review February 3, 2025 09:44
Copy link

cypress bot commented Feb 3, 2025

spartacus    Run #46950

Run Properties:  status check passed Passed #46950  •  git commit c592740b6d ℹ️: Merge 6e5088ed5d0bd86508aa9f15428fd949226fd622 into 397395fa34802b247c97f655112a...
Project spartacus
Branch Review feature/CXSPA-9283
Run status status check passed Passed #46950
Run duration 12m 00s
Commit git commit c592740b6d ℹ️: Merge 6e5088ed5d0bd86508aa9f15428fd949226fd622 into 397395fa34802b247c97f655112a...
Committer kpawelczak
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 3
Tests that did not run due to a developer annotating a test with .skip  Pending 2
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 125
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.
View all changes introduced in this branch ↗︎

Platonn
Platonn previously approved these changes Feb 3, 2025
@github-actions github-actions bot marked this pull request as draft February 3, 2025 12:10
@kpawelczak kpawelczak marked this pull request as ready for review February 4, 2025 10:11
@github-actions github-actions bot marked this pull request as draft February 4, 2025 12:13
@kpawelczak kpawelczak marked this pull request as ready for review February 4, 2025 12:27
@kpawelczak kpawelczak merged commit d8eaa8b into develop Feb 4, 2025
28 checks passed
@kpawelczak kpawelczak deleted the feature/CXSPA-9283 branch February 4, 2025 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants