nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
22.72k stars 2.27k forks source link

Repackaging for Nx 8.0 #1256

Closed FrozenPandaz closed 5 years ago

FrozenPandaz commented 5 years ago

Plan for Nx 8.0 Package Structure

We are making some changes to our packaging structure for Nx 8.0 and wanted to have a public plan so everyone knew what the upcoming changes will be and understands why they are happening. Please let us know if you have questions or concerns.

Background

Nx is a general purpose tool that allows you to develop Angular applications, React applications, Web Components, Node applications. All of these are currently implemented by two large packages: @nrwl/schematics and @nrwl/builders.

Problem

Adding functionality to our monolithic packages makes it hard to extend Nx from the outside and also provide catered experiences to specific audiences. While a team which uses Angular and a team which uses React can both use Nx today, they are both using the lowest common multiple of the options which makes the tool more complex for both teams. Same is true about our node support.

Solution

Repackage the existing functionality into domain-specific packages. For instance, jest functionality will be contained in @nrwl/jest.

Dev Experience

A workspace will still be created the same way using create-nx-workspace. We will add the ability to select capabilities when creating a new workspace. Capabilities can be added later on via ng add. For example, to add support for NestJS to an existing workspace: ng add @nrwl/nest. All the functionality available today will be available after the repackaging.

Packaging Structure

Migration

We will upgrade existing workspaces without breaking them. We will look at the package.json dependencies to bring in the new packages automatically.

Implementation Plan

We will have a long-running beta for Nx 8.0. We estimate that this refactoring will be complete before May 2019. Meanwhile, we will stop adding features to Nx 7. We may still release patches if necessary.

xmlking commented 5 years ago

will Angular CLI 8.0.0-beta-x support targeted for nx 8.0 or will be add to nx 7.8.x ?

FrozenPandaz commented 5 years ago

CLI 8.0 support is also be targetted for Nx 8.0. We will repackage first and then migrate to the new Architect API. As far as I know, the new Architect API is the only breaking change in CLI 8.0 so far.

emilio-martinez commented 5 years ago

This sounds great! @nrwl/ng-workspace perhaps should be @nrwl/nx-workspace, i.e., following the convention of create-nx-workspace? Does @nrwl/web refer to Web Components?

dherges commented 5 years ago

Or just @nrwl/workspace!

FrozenPandaz commented 5 years ago

Renamed to @nrwl/workspace :)

@emilio-martinez @nrwl/web refers to the following:

juristr commented 5 years ago

sounds good. If you need someone to test the beta, happy to help :)

bcabanes commented 5 years ago

We will update the documentation accordingly, and find a way to show dependencies between each package.

gperdomor commented 5 years ago

would be great if solve #1098 before 8.0 release :D

emilio-martinez commented 5 years ago

@FrozenPandaz would love to test this out if everything's getting to be in a good testing place! Is the latest beta representative of the current master?

perjerz commented 5 years ago

Any plan Apollo Client integrate with Nx?

FrozenPandaz commented 5 years ago

@emilio-martinez Yes @nrwl/workspace@next has this. Please try it out and let us know what you find!

@perjerz3434 No concrete plans at the moment but we would love to have Apollo setup perhaps through Nest. The integration there is really nice and we use it in Angular Console.

Destreyf commented 5 years ago

@FrozenPandaz could we get a quick "How To" for switching from nrwl/nx to nrwl/workspace, or however it's going to move. I would like to start testing some of my tooling with angular-cli 8 and angular 8 as the release is just around the corner.

I haven't tried this as of yet, but i'm guessing i should be able to ng update @nrwl/schematics@next possibly?

Jordan-Hall commented 5 years ago

@FrozenPandaz How far is NX 8 being ready? We have an issue with node-sass which has been resolved in version 8

"@angular-devkit/build-angular": "~0.800.0",
"@angular-devkit/build-ng-packagr": "~0.800.0", 
juristr commented 5 years ago

@Jordan-Hall guess it's out 😉 https://blog.nrwl.io/nxs-new-look-in-v8-25d7325260d

Jordan-Hall commented 5 years ago

Sorry, I know it's a bit late for the suggestion. But for @nrwl/web wouldn't it be better to move the builders to individual packages e.g. @nrwl/react would have its own builder?

emilio-martinez commented 5 years ago

@Jordan-Hall if I'm understanding what you're saying correctly, that's exactly what the change was for Nx 8, i.e., @nrwl/react has it's own builder separate from the other distributed packages

FrozenPandaz commented 5 years ago

Thanks for the suggestion!

@Jordan-Hall @emilio-martinez

@nrwl/react actually uses the @nrwl/web builders. We did not want to duplicate the code across both packages. I think the benefit in duplicating the code would be so that @nrwl/react users can save a download but @nrwl/web is pretty light and most of their dependencies can be hoisted if you're using yarn. We can also address that as a separate issue.

vsavkin commented 5 years ago

Closing this issue because we released Nx 8 with the repackaging.

This is a guide outlining how to move from Nx 7 to Nx 8. https://nx.dev/guides/nx7-to-nx8

jostendorf commented 5 years ago

Is there a way to exclude cypress when creating a react application? I've tried creating an empty workspace as shown above, but when I add a react application is adds the cypress library by default.

github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.