nstudio / xplat

Cross-platform (xplat) tools for Nx workspaces.
MIT License
366 stars 52 forks source link

feat(core): Nx 11 compatibility with new lib separation for xplat #232

Closed NathanWalker closed 3 years ago

NathanWalker commented 3 years ago

closes https://github.com/nstudio/xplat/issues/226

NathanWalker commented 3 years ago

A webpack.config adjustment is needed to support the new setup for {N} - We will be publishing some updates on Friday and once the @nativescript/webpack update is out we can get at least an rc going of this if not the final version.

This is one of biggest updates to xplat since the beginning. It reigns in sweeping consistency with the "Nx way" organizing xplat architecture in libs all separated as distinct Nx libs with ability to be fully involved with dep-graph, linting, affected scripts, tests. This also improves TS resolution and IDE speed with intellisense.

Most likely an initial 11.0.0 will be released and I'll add a migration to auto update existing workspaces in a 11.0.1 or .2 patch by early next week.

NathanWalker commented 3 years ago

11.0.0 is published now ~ To create new workspaces with the new xplat lib separation:

npx create-nx-workspace@latest
npm i @nstudio/xplat -D
nx g app

I'll keep this PR open until I have the 11.0.1 migration complete which will provide a way to auto migrate existing Nx+xplat workspaces.

NathanWalker commented 3 years ago

For those looking to update existing Nx workspaces with xplat v10 to v11, we have published a release that you can run this migration - we have tested this against several large workspaces internally with great results. Please try it and let us know:

nx migrate latest
npm install
nx migrate --run-migrations=migrations.json
nx migrate @nstudio/xplat@latest

npm install

IMPORTANT: Don't forget to run npm install at the end.

Now that the latest versions are installed, kick off the xplat architecture init to add the new xplat lib separations.

You will want to pass just the platforms which you currently use in your workspace. The prefix you use can be the same your workspace is currently configured to use. This can be found in package.json under the xplat key.

nx g @nstudio/xplat:init --prefix=abc --platforms=web,nativescript --framework=angular

With the new architecture in place, you can now kick off the xplat workspace migration:

nx migrate --run-migrations=migrations.json

This will handle a lot of laborious manual update tasks like:

Lastly do a full clean of your workspace to ensure you're in good updated shape now:

npm run clean

We will publish a blog about this update and instructions soon but would greatly appreciate those looking to migrate existing workspaces and let us know.