-
Notifications
You must be signed in to change notification settings - Fork 77
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
build: add @esri/calcite-components-angular package #8084
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great, @benelan!
I was curious about the projects/component-library/
folders. Is this required for 👇?
All of the build/CI stuff is working correctly. The outputs of lerna version and npm --workspace @esri/calcite-components-angular pack are both correct. It was a bit wonky at first because we need an angular workspace just to build a single component library.
"clean": "rimraf dist node_modules .turbo .angular projects/component-library/dist" | ||
}, | ||
"dependencies": { | ||
"@angular/animations": "^16.2.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we pin these deps and have renovate handle them?
Applies to all package.json
files in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @benelan! What's your plan for updating Angular deps, e.g. each Calcite release? Mainly wondering how Calcite, Components and @arcgis/core can stay roughly in sync. For example, Angular 17 is being released next week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @andygup! Yeah renovate will submit a PR to bump the angular dependencies when new versions come out.
And yes, a next
release will be deployed automatically once there are "deployable" changes. I'll let you know when one goes out. Like the react wrapper, the angular wrapper's version will always match CC's to prevent confusion.
Yup, that's related to using an Angular workspace, which is how the Stencil doc says to do it and how the ArcGIS Web Components monorepo does it. There may be a way to set this up without using an Angular workspace, but as someone who has never used Angular I wouldn't be the one to do it. I just followed the doc 🤷♂️ |
Here is Angular's doc about their workspace file structure: https://angular.io/guide/file-structure It doesn't seem like there are any other options for developing "shareable libraries", which is what we are doing.
Here is the Angular doc about creating libraries: https://angular.io/guide/creating-libraries And the doc about library file structure: https://angular.io/guide/file-structure#library-project-files |
406311b
to
aab1c68
Compare
Using an Angular workspace is the recommended, but non-intuitive, way to go. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐
📐🎁📐📐📐🎁📐📐🎁🎁📐📐🎁🎁🎁📐📐🎁🎁🎁📐🎁🎁🎁🎁📐🎁📐
📐🎁🎁📐📐🎁📐🎁📐📐🎁📐📐🎁📐📐🎁📐📐📐📐🎁📐📐📐📐🎁📐
📐🎁📐🎁📐🎁📐🎁📐📐🎁📐📐🎁📐📐🎁📐📐📐📐🎁🎁🎁📐📐🎁📐
📐🎁📐📐🎁🎁📐🎁📐📐🎁📐📐🎁📐📐🎁📐📐📐📐🎁📐📐📐📐📐📐
📐🎁📐📐📐🎁📐📐🎁🎁📐📐🎁🎁🎁📐📐🎁🎁🎁📐🎁🎁🎁🎁📐🎁📐
📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐📐
packages/calcite-components-angular/projects/component-library/README.md
Outdated
Show resolved
Hide resolved
"@esri/calcite-components": "1.10.0" | ||
}, | ||
"dependencies": { | ||
"tslib": "2.3.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed by Angular or can we update the tsconfig.json
target to avoid this dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is added by the angular cli so I'm pretty sure it's required
…wrapper * origin/main: chore: release next fix(input-number): prevent mutating value when pointerUp is emitted. (#8077)
Change the angular example to use the new `@esri/calcite-components-angular` package once it is installed in Esri/calcite-design-system#8084 and published to NPM.
…m the entry point (#8177) **Related Issue:** #8084 ## Summary I ran into build errors related to event detail types when adding the Angular output target to the monorepo. Stencil's auto-generated Angular code expected the types to be exported from the `@esri/calcite-components` entry point, but they were not. Here is one of the error messages: ``` angular-workspace:build: projects/component-library/src/lib/stencil-generated/components.ts:1014:15 - error TS2459: Module '"@esri/calcite-components"' declares 'HandleNudge' locally, but it is not exported. angular-workspace:build: angular-workspace:build: 1014 import type { HandleNudge as ICalciteHandleHandleNudge } from '@esri/calcite-components'; angular-workspace:build: ~~~~~~~~~~~ angular-workspace:build: angular-workspace:build: ../calcite-components/dist/types/components.d.ts:42:24 angular-workspace:build: 42 import { HandleChange, HandleNudge } from "./components/handle/interfaces"; angular-workspace:build: ~~~~~~~~~~~ angular-workspace:build: 'HandleNudge' is declared here. ``` To resolve the errors, I added a prebuild patch to the Angular output target that fixed the import paths for the three event detail types. As a result, a Calcite Components fix/feat that added a new event detail would create an unrelated entry in the Angular changelog. This is because the new event detail would need to be added to the patch, which lived in the Angular package's directory. This came up in: #8123 (comment) This pull request exports the event detail types from the entry point, so the patch can be removed. **When adding a new event detail, it must be exported from [`packages/calcite-components/src/index.ts`](https://github.com/Esri/calcite-design-system/blob/main/packages/calcite-components/src/index.ts) to prevent build errors.**
…m the entry point (#8177) **Related Issue:** #8084 ## Summary I ran into build errors related to event detail types when adding the Angular output target to the monorepo. Stencil's auto-generated Angular code expected the types to be exported from the `@esri/calcite-components` entry point, but they were not. Here is one of the error messages: ``` angular-workspace:build: projects/component-library/src/lib/stencil-generated/components.ts:1014:15 - error TS2459: Module '"@esri/calcite-components"' declares 'HandleNudge' locally, but it is not exported. angular-workspace:build: angular-workspace:build: 1014 import type { HandleNudge as ICalciteHandleHandleNudge } from '@esri/calcite-components'; angular-workspace:build: ~~~~~~~~~~~ angular-workspace:build: angular-workspace:build: ../calcite-components/dist/types/components.d.ts:42:24 angular-workspace:build: 42 import { HandleChange, HandleNudge } from "./components/handle/interfaces"; angular-workspace:build: ~~~~~~~~~~~ angular-workspace:build: 'HandleNudge' is declared here. ``` To resolve the errors, I added a prebuild patch to the Angular output target that fixed the import paths for the three event detail types. As a result, a Calcite Components fix/feat that added a new event detail would create an unrelated entry in the Angular changelog. This is because the new event detail would need to be added to the patch, which lived in the Angular package's directory. This came up in: #8123 (comment) This pull request exports the event detail types from the entry point, so the patch can be removed. **When adding a new event detail, it must be exported from [`packages/calcite-components/src/index.ts`](https://github.com/Esri/calcite-design-system/blob/main/packages/calcite-components/src/index.ts) to prevent build errors.**
…m the entry point (#8177) **Related Issue:** #8084 I ran into build errors related to event detail types when adding the Angular output target to the monorepo. Stencil's auto-generated Angular code expected the types to be exported from the `@esri/calcite-components` entry point, but they were not. Here is one of the error messages: ``` angular-workspace:build: projects/component-library/src/lib/stencil-generated/components.ts:1014:15 - error TS2459: Module '"@esri/calcite-components"' declares 'HandleNudge' locally, but it is not exported. angular-workspace:build: angular-workspace:build: 1014 import type { HandleNudge as ICalciteHandleHandleNudge } from '@esri/calcite-components'; angular-workspace:build: ~~~~~~~~~~~ angular-workspace:build: angular-workspace:build: ../calcite-components/dist/types/components.d.ts:42:24 angular-workspace:build: 42 import { HandleChange, HandleNudge } from "./components/handle/interfaces"; angular-workspace:build: ~~~~~~~~~~~ angular-workspace:build: 'HandleNudge' is declared here. ``` To resolve the errors, I added a prebuild patch to the Angular output target that fixed the import paths for the three event detail types. As a result, a Calcite Components fix/feat that added a new event detail would create an unrelated entry in the Angular changelog. This is because the new event detail would need to be added to the patch, which lived in the Angular package's directory. This came up in: #8123 (comment) This pull request exports the event detail types from the entry point, so the patch can be removed. **When adding a new event detail, it must be exported from [`packages/calcite-components/src/index.ts`](https://github.com/Esri/calcite-design-system/blob/main/packages/calcite-components/src/index.ts) to prevent build errors.**
…m the entry point (#8177) **Related Issue:** #8084 I ran into build errors related to event detail types when adding the Angular output target to the monorepo. Stencil's auto-generated Angular code expected the types to be exported from the `@esri/calcite-components` entry point, but they were not. Here is one of the error messages: ``` angular-workspace:build: projects/component-library/src/lib/stencil-generated/components.ts:1014:15 - error TS2459: Module '"@esri/calcite-components"' declares 'HandleNudge' locally, but it is not exported. angular-workspace:build: angular-workspace:build: 1014 import type { HandleNudge as ICalciteHandleHandleNudge } from '@esri/calcite-components'; angular-workspace:build: ~~~~~~~~~~~ angular-workspace:build: angular-workspace:build: ../calcite-components/dist/types/components.d.ts:42:24 angular-workspace:build: 42 import { HandleChange, HandleNudge } from "./components/handle/interfaces"; angular-workspace:build: ~~~~~~~~~~~ angular-workspace:build: 'HandleNudge' is declared here. ``` To resolve the errors, I added a prebuild patch to the Angular output target that fixed the import paths for the three event detail types. As a result, a Calcite Components fix/feat that added a new event detail would create an unrelated entry in the Angular changelog. This is because the new event detail would need to be added to the patch, which lived in the Angular package's directory. This came up in: #8123 (comment) This pull request exports the event detail types from the entry point, so the patch can be removed. **When adding a new event detail, it must be exported from [`packages/calcite-components/src/index.ts`](https://github.com/Esri/calcite-design-system/blob/main/packages/calcite-components/src/index.ts) to prevent build errors.**
Related Issue: #7860
Summary
Add a package of angular components that wrap the web component library following Stencil's documentation.
There were a lot of type related build errors and I ended up adding three patches:
@stencil/angular-output-target
. Not sure if this one is an issue on our end or theirs.All of the build/CI stuff is working correctly. It was a bit wonky at first because we need an angular workspace just to build a single component library.
I still need to do some testing in an example app, but I don't foresee any issues so the PR is ready for review. I'll add setup steps to the package's README after I walk through them while setting up the example.