Azure / autorest.typescript

Extension for AutoRest (https://github.com/Azure/autorest) that generates TypeScript code. The transpiled javascript code is isomorphic. It can be run in browser and in node.js environment.
MIT License
178 stars 75 forks source link

[Track 2] dependency version mismatch #1048

Closed dw511214992 closed 3 years ago

dw511214992 commented 3 years ago

I'm setting up an union release pipeline for track2 js sdk. To align with dataplane js sdk, I use rush to manage mgmt plane sdk. However, I encounter dependency version mismatch issue when running rush install.

In my test, I use track2 codegen to generate sdk for RP iotspaces and add it to the end of file rush.json:

    {
      "packageName": "@azure/arm-iotspaces",
      "projectFolder": "sdk/iotspaces/arm-iotspaces",
      "versionPolicyName": "mgmt"
    }

When I run rush install, the following error I encounter:

@azure/core-rest-pipeline
  ^1.0.3
   - @azure-rest/agrifood-farming
   - @azure-rest/ai-document-translator
   - @azure-rest/confidential-ledger
   - @azure-rest/core-client
   - @azure-rest/purview-catalog
   - @azure-rest/purview-scanning
   - @azure-tests/perf-storage-blob
   - @azure/ai-text-analytics
   - @azure/attestation
   - @azure/core-client
   - @azure/cosmos
   - @azure/data-tables
   - @azure/eventgrid
   - @azure/iot-modelsrepository
   - @azure/storage-blob
  1.0.0-beta.2
   - @azure/arm-iotspaces

tslib
  ^2.2.0
   - @azure-rest/agrifood-farming
   - @azure-rest/ai-document-translator
   - @azure-rest/confidential-ledger
   - @azure-rest/core-client
   - @azure-rest/purview-catalog
   - @azure-rest/purview-scanning
   - @azure-tests/perf-ai-form-recognizer
   - @azure-tests/perf-ai-metrics-advisor
   - @azure-tests/perf-ai-text-analytics
   - @azure-tests/perf-core-rest-pipeline
   - @azure-tests/perf-eventgrid
   - @azure-tests/perf-identity
   - @azure-tests/perf-keyvault-certificates
   - @azure-tests/perf-keyvault-keys
   - @azure-tests/perf-keyvault-secrets
   - @azure-tests/perf-search-documents
   - @azure-tests/perf-storage-blob
   - @azure-tests/perf-storage-file-datalake
   - @azure-tests/perf-storage-file-share
   - @azure/abort-controller
   - @azure/ai-anomaly-detector
   - @azure/ai-form-recognizer
   - @azure/ai-metrics-advisor
   - @azure/ai-text-analytics
   - @azure/app-configuration
   - @azure/attestation
   - @azure/communication-chat
   - @azure/communication-common
   - @azure/communication-identity
   - @azure/communication-network-traversal
   - @azure/communication-phone-numbers
   - @azure/communication-sms
   - @azure/container-registry
   - @azure/core-amqp
   - @azure/core-auth
   - @azure/core-client
   - @azure/core-crypto
   - @azure/core-http
   - @azure/core-lro
   - @azure/core-rest-pipeline
   - @azure/core-tracing
   - @azure/core-util
   - @azure/core-xml
   - @azure/cosmos
   - @azure/data-tables
   - @azure/dev-tool
   - @azure/digital-twins-core
   - @azure/eslint-plugin-azure-sdk
   - @azure/event-hubs
   - @azure/event-processor-host
   - @azure/eventgrid
   - @azure/eventhubs-checkpointstore-blob
   - @azure/identity
   - @azure/iot-device-update
   - @azure/iot-modelsrepository
   - @azure/keyvault-admin
   - @azure/keyvault-certificates
   - @azure/keyvault-common
   - @azure/keyvault-keys
   - @azure/keyvault-secrets
   - @azure/logger
   - @azure/mixedreality-authentication
   - @azure/mock-hub
   - @azure/monitor-opentelemetry-exporter
   - @azure/monitor-query
   - @azure/quantum-jobs
   - @azure/schema-registry
   - @azure/schema-registry-avro
   - @azure/search-documents
   - @azure/service-bus
   - @azure/storage-blob
   - @azure/storage-blob-changefeed
   - @azure/storage-file-datalake
   - @azure/storage-file-share
   - @azure/storage-internal-avro
   - @azure/storage-queue
   - @azure/synapse-access-control
   - @azure/synapse-artifacts
   - @azure/synapse-managed-private-endpoints
   - @azure/synapse-monitoring
   - @azure/synapse-spark
   - @azure/template
   - @azure/test-utils
   - @azure/test-utils-perfstress
   - @azure/test-utils-recorder
   - @azure/video-analyzer-edge
   - @azure/web-pubsub
   - @azure/web-pubsub-express
  ^1.9.3
   - @azure/arm-iotspaces

typescript
  ~4.2.0
   - @azure-rest/agrifood-farming
   - @azure-rest/ai-document-translator
   - @azure-rest/confidential-ledger
   - @azure-rest/core-client
   - @azure-rest/purview-catalog
   - @azure-rest/purview-scanning
   - @azure-tests/perf-ai-form-recognizer
   - @azure-tests/perf-ai-metrics-advisor
   - @azure-tests/perf-ai-text-analytics
   - @azure-tests/perf-core-rest-pipeline
   - @azure-tests/perf-eventgrid
   - @azure-tests/perf-identity
   - @azure-tests/perf-keyvault-certificates
   - @azure-tests/perf-keyvault-keys
   - @azure-tests/perf-keyvault-secrets
   - @azure-tests/perf-search-documents
   - @azure-tests/perf-storage-blob
   - @azure-tests/perf-storage-file-datalake
   - @azure-tests/perf-storage-file-share
   - @azure/abort-controller
   - @azure/ai-anomaly-detector
   - @azure/ai-form-recognizer
   - @azure/ai-metrics-advisor
   - @azure/ai-text-analytics
   - @azure/app-configuration
   - @azure/attestation
   - @azure/communication-chat
   - @azure/communication-common
   - @azure/communication-identity
   - @azure/communication-network-traversal
   - @azure/communication-phone-numbers
   - @azure/communication-sms
   - @azure/container-registry
   - @azure/core-amqp
   - @azure/core-asynciterator-polyfill
   - @azure/core-auth
   - @azure/core-client
   - @azure/core-crypto
   - @azure/core-http
   - @azure/core-lro
   - @azure/core-paging
   - @azure/core-rest-pipeline
   - @azure/core-tracing
   - @azure/core-util
   - @azure/core-xml
   - @azure/cosmos
   - @azure/data-tables
   - @azure/dev-tool
   - @azure/dev-tool
   - @azure/digital-twins-core
   - @azure/eslint-plugin-azure-sdk
   - @azure/eslint-plugin-azure-sdk
   - @azure/event-hubs
   - @azure/event-processor-host
   - @azure/eventgrid
   - @azure/eventhubs-checkpointstore-blob
   - @azure/identity
   - @azure/iot-device-update
   - @azure/iot-modelsrepository
   - @azure/keyvault-admin
   - @azure/keyvault-certificates
   - @azure/keyvault-common
   - @azure/keyvault-keys
   - @azure/keyvault-secrets
   - @azure/logger
   - @azure/mixedreality-authentication
   - @azure/mock-hub
   - @azure/monitor-opentelemetry-exporter
   - @azure/monitor-query
   - @azure/quantum-jobs
   - @azure/schema-registry
   - @azure/schema-registry-avro
   - @azure/search-documents
   - @azure/service-bus
   - @azure/storage-blob
   - @azure/storage-blob-changefeed
   - @azure/storage-file-datalake
   - @azure/storage-file-share
   - @azure/storage-internal-avro
   - @azure/storage-queue
   - @azure/synapse-access-control
   - @azure/synapse-artifacts
   - @azure/synapse-managed-private-endpoints
   - @azure/synapse-monitoring
   - @azure/synapse-spark
   - @azure/template
   - @azure/test-utils
   - @azure/test-utils-perfstress
   - @azure/test-utils-recorder
   - @azure/video-analyzer-edge
   - @azure/web-pubsub
   - @azure/web-pubsub-express
  ^3.1.1
   - @azure/arm-iotspaces

@microsoft/api-extractor
  7.7.11
   - @azure/abort-controller
   - @azure/ai-anomaly-detector
   - @azure/ai-form-recognizer
   - @azure/ai-metrics-advisor
   - @azure/ai-text-analytics
   - @azure/app-configuration
   - @azure/attestation
   - @azure/communication-chat
   - @azure/communication-common
   - @azure/communication-identity
   - @azure/communication-network-traversal
   - @azure/communication-phone-numbers
   - @azure/communication-sms
   - @azure/container-registry
   - @azure/core-amqp
   - @azure/core-auth
   - @azure/core-client
   - @azure/core-crypto
   - @azure/core-http
   - @azure/core-lro
   - @azure/core-rest-pipeline
   - @azure/core-tracing
   - @azure/core-util
   - @azure/core-xml
   - @azure/cosmos
   - @azure/data-tables
   - @azure/digital-twins-core
   - @azure/event-hubs
   - @azure/event-processor-host
   - @azure/eventgrid
   - @azure/eventhubs-checkpointstore-blob
   - @azure/identity
   - @azure/iot-device-update
   - @azure/iot-modelsrepository
   - @azure/keyvault-admin
   - @azure/keyvault-certificates
   - @azure/keyvault-keys
   - @azure/keyvault-secrets
   - @azure/logger
   - @azure/mixedreality-authentication
   - @azure/monitor-opentelemetry-exporter
   - @azure/monitor-query
   - @azure/quantum-jobs
   - @azure/schema-registry
   - @azure/schema-registry-avro
   - @azure/search-documents
   - @azure/service-bus
   - @azure/storage-blob
   - @azure/storage-blob-changefeed
   - @azure/storage-file-datalake
   - @azure/storage-file-share
   - @azure/storage-internal-avro
   - @azure/storage-queue
   - @azure/synapse-access-control
   - @azure/synapse-artifacts
   - @azure/synapse-managed-private-endpoints
   - @azure/synapse-monitoring
   - @azure/synapse-spark
   - @azure/template
   - @azure/test-utils
   - @azure/video-analyzer-edge
   - @azure/web-pubsub
   - @azure/web-pubsub-express
  7.9.10
   - @azure/arm-iotspaces

@azure/core-lro
  ^1.0.2
   - @azure/ai-form-recognizer
   - @azure/ai-metrics-advisor
   - @azure/ai-text-analytics
   - @azure/communication-identity
   - @azure/communication-phone-numbers
   - @azure/keyvault-admin
   - @azure/keyvault-certificates
   - @azure/keyvault-keys
   - @azure/keyvault-secrets
   - @azure/storage-blob
   - @azure/storage-blob-changefeed
   - @azure/synapse-artifacts
  ^1.0.5
   - @azure/arm-iotspaces

@azure/core-client
  ^1.0.0
   - @azure/ai-text-analytics
   - @azure/attestation
   - @azure/container-registry
   - @azure/data-tables
   - @azure/eventgrid
   - @azure/iot-modelsrepository
  ^1.1.2
   - @azure/arm-iotspaces

Found 6 mis-matching dependencies!

@ramya-rao-a @sarangan12

sarangan12 commented 3 years ago

@dw511214992 In order to fix these errors, you need to modify the dependency version of the above packages. I have generated a reference for you at https://github.com/sarangan12/azure-sdk-for-js/tree/0aff2071d193eb3d32063cba2b8f6fb81214bcca. (This is not final. You still need to modify the rollup config file. You could use the files from generator repo as reference for that).

Please let me know if you have any more questions. Thanks

dw511214992 commented 3 years ago

hi @sarangan12 I have reviewed your codes and still feel confusion about it. I think the dependency version of generated code by track2 codegen should keep consistent with dataplane's dependency version. So we shouldn't change it manually.

sarangan12 commented 3 years ago

The generator uses fixed versions for packages such as core-client, core-auth, core-lro`, etc. But, these packages are getting released independently and will have updated versions.

Our JS repo uses a mono repo model (with rush). So, we need to adjust the dependencies of the packages accordingly. So, this part (and also the rollup config in some instances) need manual intervention for the first time.

dw511214992 commented 3 years ago

@sarangan12 So the depended packages should be changed to the same version in all sdks. I think you can discuss with your team and change the depended packages' version of dataplane sdk to latest ones. Also, you can change the codegen and make the depended packages of generated codes use the latest ones. I'm not sure whether I'm correct. Please take this method in consider. thanks

sarangan12 commented 3 years ago

@dw511214992 I understand it would be easier on devs to handle the update automatically. But, it might be very difficult to achieve this because we do not control the release of the core packages. Also, after the first time, we do not generate the metadata. I will keep checking if there us any way to achieve this. I have opened a seperate issue https://github.com/Azure/autorest.typescript/issues/1054 for tracking this issue. I will be keeping it in Backlog for now and closing this issue for now. Thanks