Financial-Times / x-dash

:x::heavy_minus_sign::newspaper: shared front-end components for FT.com and the FT Apps
https://financial-times.github.io/x-dash
38 stars 6 forks source link

CPP-1250: Migrate *mostly* to npm workspaces #697

Closed joelcarr closed 1 year ago

joelcarr commented 1 year ago

Removing the use of Athloi for managing tasks in each package of this monorepo and replacing it with npm workspaces. This allows us to have a package-lock.json for the root of the project and makes installing dependencies for all packages a lot faster. This will allow us to migrate this repo to Tool Kit when it supports monorepos.

This PR removes any reference to the tools/ directory. It was removed a few years ago in https://github.com/Financial-Times/x-dash/commit/bf3342971bb1dc001856a4c8c3f5cd9388f46101.

Update

A refactor for how we resolve webpack for the x-engine webpack plugin was needed to be able to run the e2e tests. This refactor should aline how npm expects to resolve dependencies whether it is linked to a local version of x-engine or downloaded as a module dependency.

joelcarr commented 1 year ago

There is unfortunately a bug with how packages/x-engine/src/webpack.js works with the workspace link in e2e. It tries to resolve the dependency webpack by getting the version of webpack from the current working directory. But now workspaces is handling all the dependencies, it doesn't install a executable webpack to e2e/node_modules so it cannot be found. I think we can now rely on setting webpack as a peer dependency for @financial-times/x-engine and removing the need for resolvePeer. Does this sound reasonable?

joelcarr commented 1 year ago

I have tested this locally with next-myft-page and everything seems to be working as expected. I did make build and make run and looked through each link of the myft subnavigation.