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

Migrate build tooling to PNPM and NX #246

Open
pavinduLakshan opened this issue Aug 20, 2024 · 13 comments
Open

Migrate build tooling to PNPM and NX #246

pavinduLakshan opened this issue Aug 20, 2024 · 13 comments
Assignees
Labels

Comments

@pavinduLakshan
Copy link
Contributor

pavinduLakshan commented Aug 20, 2024

Is your feature request related to a problem? Please describe.

The current monorepo build tooling relies on Yarn, which, while effective, does not offer the same performance optimizations, workspace management, and task orchestration provided by newer tools like PNPM and NX. Additionally, the current release process lacks automation for managing versioning and changelogs, which can be improved with Changesets. As the project scales, upgrading the tooling will enhance the development workflow and ensure smoother releases.

Describe the solution you would prefer

We propose migrating the build tooling to use PNPM for efficient package management, NX for optimized build performance and task orchestration, and Changesets for automated versioning and changelog generation. The migration will include:

  • Replacing Yarn with PNPM to leverage faster installs and workspace management.
  • Integrating NX for improved build processes and incremental builds across the monorepo.
  • Incorporating Changesets to automate version control and changelog updates.
  • Updating scripts and CI configurations to support the new tooling.
  • Verifying compatibility and functionality across all packages.

Additional context

This migration will involve updating developer documentation and ensuring all workflows operate seamlessly with the new tools. The transition is aimed at improving developer experience, build efficiency, and release management.

@abhiram6121
Copy link

@NipuniBhagya, I would like to work on this issue. Could you please assign it to me?

@pavinduLakshan
Copy link
Contributor Author

@NipuniBhagya, I would like to work on this issue. Could you please assign it to me?

Hi @abhiram6121 , just assigned the issue to you. Please feel free to get back if there's anything to clarify.

@abhiram6121
Copy link

@NipuniBhagya, I would like to work on this issue. Could you please assign it to me?

Hi @abhiram6121 , just assigned the issue to you. Please feel free to get back if there's anything to clarify.

Do we need Lerna after migrating to PNPM?

@pavinduLakshan
Copy link
Contributor Author

@NipuniBhagya, I would like to work on this issue. Could you please assign it to me?

Hi @abhiram6121 , just assigned the issue to you. Please feel free to get back if there's anything to clarify.

Do we need Lerna after migrating to PNPM?

No, we don't.

@pavinduLakshan
Copy link
Contributor Author

@abhiram6121 I updated the issue description to add integrating Changesets[1] to the task list. Please let me know if there are any concerns. Cheers!

[1] https://github.com/changesets/changesets

@abhiram6121
Copy link

abhiram6121 commented Oct 18, 2024

@pavinduLakshan

> cd apps/client && pnpm run build
> [email protected] build /home/armdebug/asgardeo-auth-react-sdk/samples/asgardeo-choreo-react-express/apps/client
> CI=false && react-scripts build

Creating an optimized production build...
Failed to compile.

[eslint] Invalid Options:
- Unknown options: extensions, resolvePluginsRelativeTo
- 'extensions' has been removed.
- 'resolvePluginsRelativeTo' has been removed.

 ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Command failed with exit code 1.

I am facing an error related to ES lint while building samples/asgardeo-choreo-react-express/apps/client. Should I disable ES lint plugin for this repo?

@pavinduLakshan
Copy link
Contributor Author

@pavinduLakshan

> cd apps/client && pnpm run build
> [email protected] build /home/armdebug/asgardeo-auth-react-sdk/samples/asgardeo-choreo-react-express/apps/client
> CI=false && react-scripts build

Creating an optimized production build...
Failed to compile.

[eslint] Invalid Options:
- Unknown options: extensions, resolvePluginsRelativeTo
- 'extensions' has been removed.
- 'resolvePluginsRelativeTo' has been removed.

 ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Command failed with exit code 1.

I am facing an error related to ES lint while building samples/asgardeo-choreo-react-express/apps/client. Should I disable ES lint plugin for this repo?

Did you attempt to update the eslint version? latest eslint version (v9) has some breaking changes that can cause existing eslint configs to break.

Better if you can open a draft PR with your current changes so far, so that I can take a look and help.

@abhiram6121
Copy link

@pavinduLakshan

> cd apps/client && pnpm run build
> [email protected] build /home/armdebug/asgardeo-auth-react-sdk/samples/asgardeo-choreo-react-express/apps/client
> CI=false && react-scripts build

Creating an optimized production build...
Failed to compile.

[eslint] Invalid Options:
- Unknown options: extensions, resolvePluginsRelativeTo
- 'extensions' has been removed.
- 'resolvePluginsRelativeTo' has been removed.

 ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Command failed with exit code 1.

I am facing an error related to ES lint while building samples/asgardeo-choreo-react-express/apps/client. Should I disable ES lint plugin for this repo?

Did you attempt to update the eslint version? latest eslint version (v9) has some breaking changes that can cause existing eslint configs to break.

Better if you can open a draft PR with your current changes so far, so that I can take a look and help.

I tried downgrading the eslint version, but still getting the same error.

PR : #255

@pavinduLakshan
Copy link
Contributor Author

@abhiram6121 I tried with your changes in the draft PR and sample app build worked for me.

Try the following steps and see if it fixes the issue.

  1. Delete all node_modules, dist, build folders in the repo.
  2. Run pnpm install from the project root (from asgardeo-auth-react-sdk directory).
  3. Switch to samples/asgardeo-choreo-react-express and run pnpm build

@abhiram6121
Copy link

abhiram6121 commented Oct 19, 2024

@abhiram6121 I tried with your changes in the draft PR and sample app build worked for me.

Try the following steps and see if it fixes the issue.

  1. Delete all node_modules, dist, build folders in the repo.
  2. Run pnpm install from the project root (from asgardeo-auth-react-sdk directory).
  3. Switch to samples/asgardeo-choreo-react-express and run pnpm build

I am still getting the same error. I even tried recloning the repo from here. I am using Volta to install PNPM and node. Does that cause any issues?

@abhiram6121
Copy link

❯ git clone [email protected]:abhiram6121/asgardeo-auth-react-sdk.git
Cloning into 'asgardeo-auth-react-sdk'...
remote: Enumerating objects: 8374, done.
remote: Counting objects: 100% (1044/1044), done.
remote: Compressing objects: 100% (178/178), done.
remote: Total 8374 (delta 898), reused 957 (delta 865), pack-reused 7330 (from 1)
Receiving objects: 100% (8374/8374), 4.49 MiB | 1.13 MiB/s, done.
Resolving deltas: 100% (5892/5892), done.
❯ cd asgardeo-auth-react-sdk
❯ git checkout "pnpm"
branch 'pnpm' set up to track 'origin/pnpm'.
Switched to a new branch 'pnpm'
❯ pnpm install
Scope: all 5 workspace projects
Lockfile is up to date, resolution step is skipped
Packages: +1581
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 1581, reused 1569, downloaded 0, added 1581, done

devDependencies:
+ @typescript-eslint/eslint-plugin 5.62.0
+ @typescript-eslint/parser 5.62.0
+ eslint 8.57.1
+ eslint-plugin-import 2.31.0
+ rimraf 3.0.2
+ typescript 4.9.5

Done in 2.8s
❯ cd samples/asgardeo-choreo-react-express
❯ pnpm build

> @asgardeo/[email protected] prebuild /home/armdebug/asgardeo-auth-react-sdk/samples/asgardeo-choreo-react-express
> curr_dir=$(pwd) && pnpm run install:client && cd $curr_dir && pnpm run install:server


> @asgardeo/[email protected] install:client /home/armdebug/asgardeo-auth-react-sdk/samples/asgardeo-choreo-react-express
> cd apps/client && CI=false pnpm install

Scope: all 5 workspace projects
Done in 1.4s

> @asgardeo/[email protected] install:server /home/armdebug/asgardeo-auth-react-sdk/samples/asgardeo-choreo-react-express
> cd apps/server && pnpm install

Scope: all 5 workspace projects
Done in 1.4s

> @asgardeo/[email protected] build /home/armdebug/asgardeo-auth-react-sdk/samples/asgardeo-choreo-react-express
> curr_dir=$(pwd) && pnpm run build:client && cd $curr_dir && pnpm run build:server


> @asgardeo/[email protected] build:client /home/armdebug/asgardeo-auth-react-sdk/samples/asgardeo-choreo-react-express
> cd apps/client && pnpm run build


> [email protected] build /home/armdebug/asgardeo-auth-react-sdk/samples/asgardeo-choreo-react-express/apps/client
> CI=false && react-scripts build

Creating an optimized production build...
Failed to compile.

[eslint] Invalid Options:
- Unknown options: extensions, resolvePluginsRelativeTo
- 'extensions' has been removed.
- 'resolvePluginsRelativeTo' has been removed.


 ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Command failed with exit code 1.
❯ 

@abhiram6121
Copy link

@abhiram6121 I tried with your changes in the draft PR and sample app build worked for me.
Try the following steps and see if it fixes the issue.

  1. Delete all node_modules, dist, build folders in the repo.
  2. Run pnpm install from the project root (from asgardeo-auth-react-sdk directory).
  3. Switch to samples/asgardeo-choreo-react-express and run pnpm build

I am still getting the same error. I even tried recloning the repo from here. I am using Volta to install PNPM and node. Does that cause any issues?

❯ pnpm build

> @asgardeo/[email protected] prebuild /home/armdebug/asgardeo-auth-react-sdk/samples/asgardeo-choreo-react-express
> curr_dir=$(pwd) && pnpm run install:client && cd $curr_dir && pnpm run install:server


> @asgardeo/[email protected] install:client /home/armdebug/asgardeo-auth-react-sdk/samples/asgardeo-choreo-react-express
> cd apps/client && CI=false pnpm install

Scope: all 5 workspace projects
Done in 2.5s

> @asgardeo/[email protected] install:server /home/armdebug/asgardeo-auth-react-sdk/samples/asgardeo-choreo-react-express
> cd apps/server && pnpm install

Scope: all 5 workspace projects
Done in 2.6s

> @asgardeo/[email protected] build /home/armdebug/asgardeo-auth-react-sdk/samples/asgardeo-choreo-react-express
> curr_dir=$(pwd) && pnpm run build:client && cd $curr_dir && pnpm run build:server


> @asgardeo/[email protected] build:client /home/armdebug/asgardeo-auth-react-sdk/samples/asgardeo-choreo-react-express
> cd apps/client && pnpm run build


> [email protected] build /home/armdebug/asgardeo-auth-react-sdk/samples/asgardeo-choreo-react-express/apps/client
> CI=false && react-scripts build

Creating an optimized production build...
Failed to compile.

TS2339: Property 'toBeInTheDocument' does not exist on type 'JestMatchers<HTMLElement>'.
    24 |   render(<App />);
    25 |   const linkElement = screen.getByText(/learn react/i);
  > 26 |   expect(linkElement).toBeInTheDocument();
       |                       ^^^^^^^^^^^^^^^^^
    27 | });
    28 |


 ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Command failed with exit code 1.

Resolved eslint error, but getting a new error related to jest.

@abhiram6121
Copy link

@abhiram6121 I tried with your changes in the draft PR and sample app build worked for me.
Try the following steps and see if it fixes the issue.

  1. Delete all node_modules, dist, build folders in the repo.
  2. Run pnpm install from the project root (from asgardeo-auth-react-sdk directory).
  3. Switch to samples/asgardeo-choreo-react-express and run pnpm build

I am still getting the same error. I even tried recloning the repo from here. I am using Volta to install PNPM and node. Does that cause any issues?

❯ pnpm build

> @asgardeo/[email protected] prebuild /home/armdebug/asgardeo-auth-react-sdk/samples/asgardeo-choreo-react-express
> curr_dir=$(pwd) && pnpm run install:client && cd $curr_dir && pnpm run install:server


> @asgardeo/[email protected] install:client /home/armdebug/asgardeo-auth-react-sdk/samples/asgardeo-choreo-react-express
> cd apps/client && CI=false pnpm install

Scope: all 5 workspace projects
Done in 2.5s

> @asgardeo/[email protected] install:server /home/armdebug/asgardeo-auth-react-sdk/samples/asgardeo-choreo-react-express
> cd apps/server && pnpm install

Scope: all 5 workspace projects
Done in 2.6s

> @asgardeo/[email protected] build /home/armdebug/asgardeo-auth-react-sdk/samples/asgardeo-choreo-react-express
> curr_dir=$(pwd) && pnpm run build:client && cd $curr_dir && pnpm run build:server


> @asgardeo/[email protected] build:client /home/armdebug/asgardeo-auth-react-sdk/samples/asgardeo-choreo-react-express
> cd apps/client && pnpm run build


> [email protected] build /home/armdebug/asgardeo-auth-react-sdk/samples/asgardeo-choreo-react-express/apps/client
> CI=false && react-scripts build

Creating an optimized production build...
Failed to compile.

TS2339: Property 'toBeInTheDocument' does not exist on type 'JestMatchers<HTMLElement>'.
    24 |   render(<App />);
    25 |   const linkElement = screen.getByText(/learn react/i);
  > 26 |   expect(linkElement).toBeInTheDocument();
       |                       ^^^^^^^^^^^^^^^^^
    27 | });
    28 |


 ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Command failed with exit code 1.

Resolved eslint error, but getting a new error related to jest.

#Resolved https://stackoverflow.com/a/75245402/23000795

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants