Skip to content

Migration of SDK Client Packages from CADL Ranch to Typespec & Typespec

Sarangan Rajamanickam edited this page Nov 21, 2024 · 2 revisions

With reference to migrating the CADL Ranch packages (Issue #4015), the packages have been migrated from cadl-ranch repository to Typespec Azure and Typespec repositories.

Now, the dependent client and SDK packages should start using the new packages and move away from the CADL Ranch packages. This wiki page details the steps to be taken for the migration.

Step 1: Dependency Migration

The following dependencies must be modified in the client and SDK packages

No Old Package New Package
1 cadl-ranch spector
2 cadl-ranch-coverage-sdk spec-coverage-sdk
3 cadl-ranch-expect spector
4 cadl-ranch-api spec-api
5 cadl-ranch-specs Pure Typespec: http-specs, Azure Typespec: azure-http-specs
6 cadl-ranch-dashboard Pure Typespec: spec-dashboard, Azure Typespec: azure-spec-dashboard

Step 2: Script Name Change

With the old packages, the script cadl-ranch had been used. With the new changes, the script name must be changed to tsp-spector. Please take a look at the following example for reference:

Old Script

npx cadl-ranch serve ./node_modules/@azure-tools/cadl-ranch-specs/http --port 3002 --coverageFile ./coverage/cadl-ranch-coverage-typescript-modular-azure.json

New Script

npx tsp-spector serve ./node_modules/@azure-tools/http-specs/specs --port 3002 --coverageFile ./coverage/cadl-ranch-coverage-typescript-modular-azure.json

Note: The above example is used only for reference. All scripts which use cadl-ranch must be changed to tsp-spector.

Step 3: Storage Account Name change

With the old packages, the storage account name azuresdkcadlranch had been used. With the new changes, the storage account name must be changed to typespec. Please take a look at the following example for reference:

Old Script

npx cadl-ranch upload-coverage --coverageFile $(TypeSpec_TESTSERVER_COVERAGE_RLC_AZURE_REPORT) --generatorName typescript/rlc --storageAccountName azuresdkcadlranch --generatorVersion $(node -p -e "require('./package.json').version") --generatorMode azure

New Script

npx tsp-spector upload-coverage --coverageFile $(TypeSpec_TESTSERVER_COVERAGE_RLC_AZURE_REPORT) --generatorName typescript/rlc --storageAccountName typespec --generatorVersion $(node -p -e "require('./package.json').version") --generatorMode azure

Step 4: Verify the changes in the dashboard

Once the coverage files have been uploaded to typespec storage account, You could verify the changes in the spec-dashboard and azure-spec-dashboard packages. Execute pnpm start from the packages and view the dashboard.