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

feat: make nx plugin work without angular preset and add tailwind option #370

Merged
merged 3 commits into from
May 5, 2023

Conversation

goetzrobin
Copy link
Member

The nx plugin now works without any manual addition of @nx/angular. You can create an empty workspace and simply add the @analogjs/platform dependency. After installing it you can run one command: nx g @analogjs/platform:app. This will automatically install all angular and analog dependencies. This plugin should also work as a preset for npx create-workspace. Since e2e testing for nx plugins is still a bit messy I tested this manually for now. It worked as expected for an empty package based and an empty integrated workspace as well as for an already preconfigured angular workspace.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Which package are you modifying?

  • vite-plugin-angular
  • vite-plugin-nitro
  • astro-angular
  • create-analog
  • router
  • platform
  • content

What is the current behavior?

Nx plugin required you to have your workspace already configured with angular.

Issue Number: #320

What is the new behavior?

This PR makes the analog plugin take care of all the config. It also makes the Nx plugin
compatible with npx create-nx-workspace presets. (need to verify this after publishing to npm)
It also adds support for setting up tailwind

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

I wouldn't consider this completing #320 because we still need to update the Docs and integrate a SPARTAN setup.
I'd like to have all this working before writing the docs to make them be in sync from the get go :)

@netlify
Copy link

netlify bot commented May 4, 2023

Deploy Preview for analog-blog ready!

Name Link
🔨 Latest commit ebe1873
🔍 Latest deploy log https://app.netlify.com/sites/analog-blog/deploys/64553529ffbf010008cfef13
😎 Deploy Preview https://deploy-preview-370--analog-blog.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented May 4, 2023

Deploy Preview for analog-docs ready!

Name Link
🔨 Latest commit ebe1873
🔍 Latest deploy log https://app.netlify.com/sites/analog-docs/deploys/64553529bcf589000847373d
😎 Deploy Preview https://deploy-preview-370--analog-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented May 4, 2023

Deploy Preview for analog-app ready!

Name Link
🔨 Latest commit ebe1873
🔍 Latest deploy log https://app.netlify.com/sites/analog-app/deploys/645535296164d60008bc2190
😎 Deploy Preview https://deploy-preview-370--analog-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

const parsedTags = options.tags
? options.tags.split(',').map((s) => s.trim())
: [];
const offsetFromRoot = determineOffsetFromRoot(projectRoot);

const nxPackageNamespace = major(nxVersion) >= 16 ? '@nx' : '@nrwl';
Copy link
Member

Choose a reason for hiding this comment

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

Let's just use @nx as we'll pin everything to Nx 16.1.0 to support Angular >= v15

Copy link
Member Author

Choose a reason for hiding this comment

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

The one thing I want to mention is that this is version comes from the user's Nx workspace. If I understand this correctly removing this logic would mean that we do not support workspaces that have an Nx version of 15

Copy link
Member

Choose a reason for hiding this comment

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

Good point. Let's keep them separate

Copy link
Member Author

Choose a reason for hiding this comment

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

I tested with a v15.9.2 workspace and the current approach & versions for V15 worked 👍

The nx plugin now works without any manual addition of @nx/angular.
You can create an empty workspace and simply add the @analogjs/platform
dependency. After installing it you can run one command:
nx g @analogjs/platform:app. This will automatically install all angular
and analog dependencies. This plugin should also work as a preset for
npx create-workspace. Since e2e testing for nx plugins is still a bit messy
I tested this manually for now. It worked as expected for an empty package
based and an empty integrated workspace as well as for an already
preconfigured angular workspace.
@goetzrobin goetzrobin merged commit c8ee37c into main May 5, 2023
@goetzrobin goetzrobin deleted the improve-nx-plugin branch May 5, 2023 17:05
Villanuevand pushed a commit to Villanuevand/analog that referenced this pull request Sep 12, 2023
Villanuevand pushed a commit to Villanuevand/analog that referenced this pull request Sep 12, 2023
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.

2 participants