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

Provide ability to detect Calcite version at runtime #8848

Closed
5 of 9 tasks
geospatialem opened this issue Feb 28, 2024 · 10 comments
Closed
5 of 9 tasks

Provide ability to detect Calcite version at runtime #8848

geospatialem opened this issue Feb 28, 2024 · 10 comments
Assignees
Labels
4 - verified Issues that have been released and confirmed resolved. ArcGIS Maps SDK for JavaScript Issues logged by ArcGIS SDK for JavaScript team members. Calcite (dev) Issues logged by Calcite developers. calcite-components Issues specific to the @esri/calcite-components package. enhancement Issues tied to a new feature or request. estimate - 3 A day or two of work, likely requires updates to tests. impact - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone p - high Issue should be addressed in the current milestone, impacts component or core functionality spike complete Issues that have a research spike completed and dev work can proceed

Comments

@geospatialem
Copy link
Member

geospatialem commented Feb 28, 2024

Check existing issues

Description

To assist with client issue troubleshooting, the user is seeking to display the Esri JavaScript API version in a simple popup using something similar to the Maps SDK's Kernel.version.

Customers have applications that include a mapping experience with Maps SDK for JS and Calcite Design System and it is known that Calcite updates are independent of the JS updates. The enhancement request, ENH-000165422, would like to include the Calcite Design System version in the information window.

Acceptance Criteria

  • Allow users the ability to check the current version of Calcite
  • Allow users the ability to add the version to their own custom informational window
  • Ensure that context is provided if another product, such as Maps SDK for JS, also uses Calcite has a version
    • Messaging is provided for the Calcite version
    • Messaging is provided for the product (optional)

Relevant Info

ENH-000165422 requested on 02/27/2024

Which Component

N/A - applies to the design system.

Example Use Case

For a user to check the current version of Esri libraries, similar to what is provided in the Maps SDK for JS with Kernel.version for Calcite, where an informational window can provide context to the Calcite version used.

Priority impact

p3 - want for upcoming milestone

Calcite package

  • @esri/calcite-components
  • @esri/calcite-components-angular
  • @esri/calcite-components-react
  • @esri/calcite-design-tokens
  • @esri/eslint-plugin-calcite-components

Esri team

Calcite (dev)

@geospatialem geospatialem added enhancement Issues tied to a new feature or request. p - high Issue should be addressed in the current milestone, impacts component or core functionality 0 - new New issues that need assignment. needs triage Planning workflow - pending design/dev review. labels Feb 28, 2024
@github-actions github-actions bot added p3 - want for upcoming milestone calcite-components Issues specific to the @esri/calcite-components package. Calcite (dev) Issues logged by Calcite developers. labels Feb 28, 2024
@geospatialem geospatialem added the ArcGIS Maps SDK for JavaScript Issues logged by ArcGIS SDK for JavaScript team members. label Feb 28, 2024
@driskull
Copy link
Member

It would also be helpful to include a version comment in the distribution files.

The Maps SDK includes the following in their files:

// All material copyright Esri, All Rights Reserved, unless otherwise specified.
// See https://js.arcgis.com/4.29/esri/copyright.txt for details.

It would be useful to have a copyright and version like that in ours. Especially in the CSS files since they won't be able to log anything.

@jcfranco jcfranco added estimate - 5 A few days of work, definitely requires updates to tests. spike Issues that cannot be estimated well enough until the team has done further research needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. and removed needs triage Planning workflow - pending design/dev review. labels Feb 29, 2024
@jcfranco
Copy link
Member

@driskull We do provide similar info in the source files:

https://unpkg.com/browse/@esri/calcite-components@2.6.0/dist/components/index.js
https://unpkg.com/browse/@esri/calcite-components@2.6.0/dist/calcite/calcite.esm.js

As discussed in our triage session, we might be able to use a similar module or the global config to provide this at runtime.

@geospatialem Is this needed for both the lazy-loaded (dist) and tree-shakeable (components) builds?

@geospatialem geospatialem added this to the 2024-04-23 - Apr Release milestone Mar 19, 2024
@geospatialem geospatialem removed the needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. label Mar 19, 2024
@jcfranco jcfranco self-assigned this Apr 15, 2024
@jcfranco jcfranco added 1 - assigned Issues that are assigned to a sprint and a team member. and removed 0 - new New issues that need assignment. labels Apr 15, 2024
@jcfranco jcfranco added 2 - in development Issues that are actively being worked on. and removed 1 - assigned Issues that are assigned to a sprint and a team member. labels May 3, 2024
@jcfranco
Copy link
Member

jcfranco commented May 8, 2024

Explored a few options:

1. component version prop

pros

  • allows checking the version at runtime
  • each component is versioned
  • helps distinguish components defined by different lazy-loading scripts (not too common, but it does happen)
  • works for both the lazy-loaded (dist) and tree-shakeable (components) output targets

cons

  • adds an extra prop to all components
  • increases output size (impact might be mitigated with compression + bundling, and if Stencil ever adds support for a base class or mixin)
    • dist increased ~28kb
    • components increased ~44k (including doc and types)
  • need to ensure all components add this property (custom ESLint rule can help here)

2. version export from index.ts (components output target)

pros

  • allows consumers to pull in the bundled version and expose wherever needed

cons

  • would not be accurate if components are defined by more than one source
  • puts burden of exposing the version on developers
  • would only work for the components output target

3. adding a version field to a global config object

pros

  • simple way to check version for all components
  • would only requires updates to the config module

cons

  • relies on adding a global
  • would not be accurate if components are defined by more than one source as the global would be overridden

@driskull
Copy link
Member

would not be accurate if components are defined by more than one source

Is this one a showstopper? Seems like it could be. 🤔

@jcfranco
Copy link
Member

For that use case, quite possibly. 😞 Just an idea, but for that particular option, we could add a check for a global version and log a warning message with info on subsequent versions vs overriding.

@dasa Is there an option that would work best from the Maps SDK perspective?

FWIW, @geospatialem has reached out for more info regarding the original request.

@dasa
Copy link
Member

dasa commented May 13, 2024

Is there an option that would work best from the Maps SDK perspective?

Probably 3 since the version the API is compiled against may not be the version that ends up getting used if the lazy-loaded script is used.

@jcfranco jcfranco added the spike complete Issues that have a research spike completed and dev work can proceed label May 13, 2024
@github-actions github-actions bot removed the spike Issues that cannot be estimated well enough until the team has done further research label May 13, 2024
@github-actions github-actions bot added the needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. label May 13, 2024
@github-actions github-actions bot removed this from the 2024-05-28 - May Main Release milestone May 13, 2024
Copy link
Contributor

cc @geospatialem, @brittneytewks

@jcfranco
Copy link
Member

[Belated] I think we could proceed w/ option 3 for the next milestone and consider option 1 if Stencil adds support for extending classes (or similar).

@jcfranco jcfranco added estimate - 3 A day or two of work, likely requires updates to tests. and removed estimate - 5 A few days of work, definitely requires updates to tests. labels May 14, 2024
@geospatialem geospatialem removed the needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. label May 14, 2024
@geospatialem geospatialem added impact - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone and removed p3 - want for upcoming milestone labels May 21, 2024
@jcfranco jcfranco self-assigned this Jun 3, 2024
@jcfranco jcfranco added 1 - assigned Issues that are assigned to a sprint and a team member. and removed 0 - new New issues that need assignment. labels Jun 3, 2024
@jcfranco jcfranco added 2 - in development Issues that are actively being worked on. and removed 1 - assigned Issues that are assigned to a sprint and a team member. labels Jun 10, 2024
jcfranco added a commit that referenced this issue Jun 11, 2024
**Related Issue:** #8848

## Summary

This updates the globalScript to stamp the version onto an existing
global calciteConfig var and will create one if not defined.
@jcfranco jcfranco added 3 - installed Issues that have been merged to master branch and are ready for final confirmation. and removed 2 - in development Issues that are actively being worked on. labels Jun 11, 2024
@github-actions github-actions bot assigned geospatialem and DitwanP and unassigned jcfranco Jun 11, 2024
Copy link
Contributor

Installed and assigned for verification.

@DitwanP
Copy link
Contributor

DitwanP commented Jun 18, 2024

🍡 Verified locally on dev

Any app using calcite should have access to the new calciteConfig global.

https://codepen.io/Ditwan-Price/pen/bGyKpbm?editors=1010

@DitwanP DitwanP closed this as completed Jun 18, 2024
@DitwanP DitwanP added 4 - verified Issues that have been released and confirmed resolved. and removed 3 - installed Issues that have been merged to master branch and are ready for final confirmation. labels Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - verified Issues that have been released and confirmed resolved. ArcGIS Maps SDK for JavaScript Issues logged by ArcGIS SDK for JavaScript team members. Calcite (dev) Issues logged by Calcite developers. calcite-components Issues specific to the @esri/calcite-components package. enhancement Issues tied to a new feature or request. estimate - 3 A day or two of work, likely requires updates to tests. impact - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone p - high Issue should be addressed in the current milestone, impacts component or core functionality spike complete Issues that have a research spike completed and dev work can proceed
Projects
None yet
Development

No branches or pull requests

5 participants