Skip to content

Update the dependency to pnpm style when azureSdkForJs is true #3210

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/autorest.typescript/src/autorestSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ export interface AutorestOptions {
lenientModelDeduplication?: boolean;
useLegacyLro?: boolean;
flavor?: PackageFlavor;
//TODO should remove this after finish the release tool test
shouldUsePnpmDep?: boolean;
}

let host: AutorestExtensionHost;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ function regularAutorestPackage(
clientDetails: ClientDetails,
packageDetails: PackageDetails
) {
//TODO should remove all the shouldUsePnpmDep codes after finish the release tool test
const {
srcPath,
useCoreV2,
Expand All @@ -62,8 +61,7 @@ function regularAutorestPackage(
generateSample,
coreHttpCompatMode,
azureSdkForJs,
isTestPackage,
shouldUsePnpmDep
isTestPackage
} = getAutorestOptions();
const { model } = getSession();
const { addCredentials } = getSecurityInfoFromModel(model.security);
Expand All @@ -89,18 +87,18 @@ function regularAutorestPackage(
node: ">=18.0.0"
},
dependencies: {
...(hasLro && { "@azure/core-lro": shouldUsePnpmDep && azureSdkForJs ? "catalog:corelrov2" : "^2.5.4" }),
...(hasLro && { "@azure/abort-controller": shouldUsePnpmDep && azureSdkForJs ? "workspace:*" : "^2.1.2" }),
...(hasAsyncIterators && { "@azure/core-paging": shouldUsePnpmDep && azureSdkForJs ? "workspace:*" : "^1.6.2" }),
...(useCoreV2 && { "@azure/core-client": shouldUsePnpmDep && azureSdkForJs ? "workspace:*" : "^1.9.2" }),
...(useCoreV2 && addCredentials && { "@azure/core-auth": shouldUsePnpmDep && azureSdkForJs ? "workspace:*" : "^1.9.0" }),
...(hasLro && { "@azure/core-lro": azureSdkForJs ? "catalog:corelrov2" : "^2.5.4" }),
...(hasLro && { "@azure/abort-controller": azureSdkForJs ? "workspace:*" : "^2.1.2" }),
...(hasAsyncIterators && { "@azure/core-paging": azureSdkForJs ? "workspace:*" : "^1.6.2" }),
...(useCoreV2 && { "@azure/core-client": azureSdkForJs ? "workspace:*" : "^1.9.2" }),
...(useCoreV2 && addCredentials && { "@azure/core-auth": azureSdkForJs ? "workspace:*" : "^1.9.0" }),
...(useCoreV2 && {
"@azure/core-rest-pipeline": shouldUsePnpmDep && azureSdkForJs ? "workspace:*" : "^1.19.0"
"@azure/core-rest-pipeline": azureSdkForJs ? "workspace:*" : "^1.19.0"
}),
...(tracingInfo && {
"@azure/core-tracing": shouldUsePnpmDep && azureSdkForJs ? "workspace:*" : "^1.2.0"
"@azure/core-tracing": azureSdkForJs ? "workspace:*" : "^1.2.0"
}),
tslib: shouldUsePnpmDep && azureSdkForJs ? "catalog:" : "^2.8.1"
tslib: azureSdkForJs ? "catalog:" : "^2.8.1"
},
keywords: ["node", "azure", "typescript", "browser", "isomorphic", "cloud"],
license: "MIT",
Expand All @@ -111,9 +109,9 @@ function regularAutorestPackage(
devDependencies: {
"@microsoft/api-extractor": "^7.40.3",
mkdirp: "^3.0.1",
typescript: shouldUsePnpmDep && azureSdkForJs ? "catalog:" : "~5.8.2",
typescript: azureSdkForJs ? "catalog:" : "~5.8.2",
rimraf: "^5.0.0",
dotenv: shouldUsePnpmDep && azureSdkForJs ? "catalog:testing" : "^16.0.0"
dotenv: azureSdkForJs ? "catalog:testing" : "^16.0.0"
},
repository: "github:Azure/azure-sdk-for-js",
bugs: {
Expand Down Expand Up @@ -181,7 +179,7 @@ function regularAutorestPackage(
packageInfo.homepage = `https://github.com/Azure/azure-sdk-for-js/tree/main/${azureOutputDirectory}`;
}
if (azureSdkForJs) {
packageInfo.devDependencies["@azure/dev-tool"] = shouldUsePnpmDep && azureSdkForJs ? "workspace:*" : "^1.0.0";
packageInfo.devDependencies["@azure/dev-tool"] = azureSdkForJs ? "workspace:*" : "^1.0.0";
delete packageInfo.devDependencies["@microsoft/api-extractor"];
delete packageInfo.devDependencies["rimraf"];
delete packageInfo.devDependencies["mkdirp"];
Expand All @@ -205,19 +203,19 @@ function regularAutorestPackage(
}

if (generateTest) {
packageInfo.devDependencies["@azure/identity"] = shouldUsePnpmDep && azureSdkForJs ? "catalog:internal" : "^4.6.0";
packageInfo.devDependencies["@azure/logger"] = shouldUsePnpmDep && azureSdkForJs ? "workspace:*" : "^1.1.4";
packageInfo.devDependencies["@azure/identity"] = azureSdkForJs ? "catalog:internal" : "^4.6.0";
packageInfo.devDependencies["@azure/logger"] = azureSdkForJs ? "workspace:*" : "^1.1.4";
// TODO need unify the version when 4.1.0 released
packageInfo.devDependencies["@azure-tools/test-recorder"] = azureSdkForJs ? shouldUsePnpmDep ? "workspace:*" : "^4.1.0" : "^4.0.0";
packageInfo.devDependencies["@azure-tools/test-credential"] = shouldUsePnpmDep && azureSdkForJs ? "workspace:*" : "^2.0.0";
packageInfo.devDependencies["@azure-tools/test-recorder"] = azureSdkForJs ? "workspace:*" : "^4.0.0";
packageInfo.devDependencies["@azure-tools/test-credential"] = azureSdkForJs ? "workspace:*" : "^2.0.0";
if (azureSdkForJs) {
packageInfo.devDependencies["@azure-tools/test-utils-vitest"] = shouldUsePnpmDep && azureSdkForJs ? "workspace:*" : "^1.0.0";
packageInfo.devDependencies["@azure-tools/test-utils-vitest"] = azureSdkForJs ? "workspace:*" : "^1.0.0";
}
packageInfo.devDependencies["@types/node"] = shouldUsePnpmDep && azureSdkForJs ? "catalog:" : "^18.0.0";
packageInfo.devDependencies["@vitest/browser"] = shouldUsePnpmDep && azureSdkForJs ? "catalog:testing" : "^3.0.9";
packageInfo.devDependencies["@vitest/coverage-istanbul"] = shouldUsePnpmDep && azureSdkForJs ? "catalog:testing" : "^3.0.9";
packageInfo.devDependencies["playwright"] = shouldUsePnpmDep && azureSdkForJs ? "catalog:testing" : "^1.50.1";
packageInfo.devDependencies["vitest"] = shouldUsePnpmDep && azureSdkForJs ? "catalog:testing" : "^3.0.9";
packageInfo.devDependencies["@types/node"] = azureSdkForJs ? "catalog:" : "^18.0.0";
packageInfo.devDependencies["@vitest/browser"] = azureSdkForJs ? "catalog:testing" : "^3.0.9";
packageInfo.devDependencies["@vitest/coverage-istanbul"] = azureSdkForJs ? "catalog:testing" : "^3.0.9";
packageInfo.devDependencies["playwright"] = azureSdkForJs ? "catalog:testing" : "^1.50.1";
packageInfo.devDependencies["vitest"] = azureSdkForJs ? "catalog:testing" : "^3.0.9";

packageInfo.scripts["test"] = "npm run integration-test";
packageInfo.scripts["unit-test"] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export function transformOptions(model: CodeModel): RLCOptions {
azureArm,
flavor,
isTestPackage,
shouldUsePnpmDep
} = getAutorestOptions();
// TODO modulekind is a workaround for codegen test environment, should remove this when the esm test framework supported
const options: RLCOptions = { moduleKind: isTestPackage ? "cjs" : "esm" };
Expand Down Expand Up @@ -48,6 +47,5 @@ export function transformOptions(model: CodeModel): RLCOptions {
options.sourceFrom = "Swagger";
// Always enable operation group prefix for swagger
options.enableOperationGroup = true;
options.shouldUsePnpmDep = shouldUsePnpmDep;
return options;
}
10 changes: 0 additions & 10 deletions packages/autorest.typescript/src/utils/autorestOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ export async function extractAutorestOptions(): Promise<AutorestOptions> {
const azureSdkForJs = await getAzureSdkForJs(host);
const dependencyInfo = await getDependencyInfo(host);
const flavor = await getFlavor(host);
//TODO should remove this after finish the release tool test
const shouldUsePnpmDep = await shouldUsePnpm(host)

return {
azureArm,
Expand Down Expand Up @@ -82,8 +80,6 @@ export async function extractAutorestOptions(): Promise<AutorestOptions> {
dependencyInfo,
useLegacyLro,
flavor,
//TODO should remove this after finish the release tool test
shouldUsePnpmDep
};
}

Expand Down Expand Up @@ -403,9 +399,3 @@ async function getDependencyInfo(
"Invalid dependency-info. Make sure that link and description are defined"
);
}
//TODO should remove this after finish the release tool test
async function shouldUsePnpm(host: AutorestExtensionHost): Promise<boolean> {
const shouldUsePnpmDep = (await host.getValue("should-use-pnpm-dep")) === true;

return shouldUsePnpmDep;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"version": "1.0.0-preview1",
"engines": { "node": ">=18.0.0" },
"dependencies": {
"@azure/core-paging": "^1.6.2",
"@azure/core-client": "^1.9.2",
"@azure/core-rest-pipeline": "^1.19.0",
"tslib": "^2.8.1"
"@azure/core-paging": "workspace:*",
"@azure/core-client": "workspace:*",
"@azure/core-rest-pipeline": "workspace:*",
"tslib": "catalog:"
},
"keywords": ["node", "azure", "typescript", "browser", "isomorphic", "cloud"],
"license": "MIT",
Expand All @@ -18,9 +18,9 @@
"types": "./dist/commonjs/index.d.ts",
"type": "module",
"devDependencies": {
"typescript": "~5.8.2",
"dotenv": "^16.0.0",
"@azure/dev-tool": "^1.0.0"
"typescript": "catalog:",
"dotenv": "catalog:testing",
"@azure/dev-tool": "workspace:*"
},
"repository": "github:Azure/azure-sdk-for-js",
"bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"version": "1.0.0-preview1",
"engines": { "node": ">=18.0.0" },
"dependencies": {
"@azure/core-paging": "^1.6.2",
"@azure/core-client": "^1.9.2",
"@azure/core-rest-pipeline": "^1.19.0",
"tslib": "^2.8.1"
"@azure/core-paging": "workspace:*",
"@azure/core-client": "workspace:*",
"@azure/core-rest-pipeline": "workspace:*",
"tslib": "catalog:"
},
"keywords": ["node", "azure", "typescript", "browser", "isomorphic", "cloud"],
"license": "MIT",
Expand All @@ -18,9 +18,9 @@
"types": "./dist/commonjs/index.d.ts",
"type": "module",
"devDependencies": {
"typescript": "~5.8.2",
"dotenv": "^16.0.0",
"@azure/dev-tool": "^1.0.0"
"typescript": "catalog:",
"dotenv": "catalog:testing",
"@azure/dev-tool": "workspace:*"
},
"repository": "github:Azure/azure-sdk-for-js",
"bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"version": "1.0.0-preview1",
"engines": { "node": ">=18.0.0" },
"dependencies": {
"@azure/core-client": "^1.9.2",
"@azure/core-rest-pipeline": "^1.19.0",
"tslib": "^2.8.1"
"@azure/core-client": "workspace:*",
"@azure/core-rest-pipeline": "workspace:*",
"tslib": "catalog:"
},
"keywords": ["node", "azure", "typescript", "browser", "isomorphic", "cloud"],
"license": "MIT",
Expand All @@ -17,9 +17,9 @@
"types": "./dist/commonjs/index.d.ts",
"type": "module",
"devDependencies": {
"typescript": "~5.8.2",
"dotenv": "^16.0.0",
"@azure/dev-tool": "^1.0.0"
"typescript": "catalog:",
"dotenv": "catalog:testing",
"@azure/dev-tool": "workspace:*"
},
"repository": "github:Azure/azure-sdk-for-js",
"bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"version": "1.0.0-preview1",
"engines": { "node": ">=18.0.0" },
"dependencies": {
"@azure/core-client": "^1.9.2",
"@azure/core-rest-pipeline": "^1.19.0",
"tslib": "^2.8.1"
"@azure/core-client": "workspace:*",
"@azure/core-rest-pipeline": "workspace:*",
"tslib": "catalog:"
},
"keywords": ["node", "azure", "typescript", "browser", "isomorphic", "cloud"],
"license": "MIT",
Expand All @@ -17,9 +17,9 @@
"types": "./dist/commonjs/index.d.ts",
"type": "module",
"devDependencies": {
"typescript": "~5.8.2",
"dotenv": "^16.0.0",
"@azure/dev-tool": "^1.0.0"
"typescript": "catalog:",
"dotenv": "catalog:testing",
"@azure/dev-tool": "workspace:*"
},
"repository": "github:Azure/azure-sdk-for-js",
"bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"version": "1.0.0-preview1",
"engines": { "node": ">=18.0.0" },
"dependencies": {
"@azure/core-client": "^1.9.2",
"@azure/core-rest-pipeline": "^1.19.0",
"tslib": "^2.8.1"
"@azure/core-client": "workspace:*",
"@azure/core-rest-pipeline": "workspace:*",
"tslib": "catalog:"
},
"keywords": ["node", "azure", "typescript", "browser", "isomorphic", "cloud"],
"license": "MIT",
Expand All @@ -17,9 +17,9 @@
"types": "./dist/commonjs/index.d.ts",
"type": "module",
"devDependencies": {
"typescript": "~5.8.2",
"dotenv": "^16.0.0",
"@azure/dev-tool": "^1.0.0"
"typescript": "catalog:",
"dotenv": "catalog:testing",
"@azure/dev-tool": "workspace:*"
},
"repository": "github:Azure/azure-sdk-for-js",
"bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"version": "1.0.0-preview1",
"engines": { "node": ">=18.0.0" },
"dependencies": {
"@azure/core-client": "^1.9.2",
"@azure/core-rest-pipeline": "^1.19.0",
"tslib": "^2.8.1"
"@azure/core-client": "workspace:*",
"@azure/core-rest-pipeline": "workspace:*",
"tslib": "catalog:"
},
"keywords": ["node", "azure", "typescript", "browser", "isomorphic", "cloud"],
"license": "MIT",
Expand All @@ -17,9 +17,9 @@
"types": "./dist/commonjs/index.d.ts",
"type": "module",
"devDependencies": {
"typescript": "~5.8.2",
"dotenv": "^16.0.0",
"@azure/dev-tool": "^1.0.0"
"typescript": "catalog:",
"dotenv": "catalog:testing",
"@azure/dev-tool": "workspace:*"
},
"repository": "github:Azure/azure-sdk-for-js",
"bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"version": "1.0.0-preview1",
"engines": { "node": ">=18.0.0" },
"dependencies": {
"@azure/core-client": "^1.9.2",
"@azure/core-auth": "^1.9.0",
"@azure/core-rest-pipeline": "^1.19.0",
"tslib": "^2.8.1"
"@azure/core-client": "workspace:*",
"@azure/core-auth": "workspace:*",
"@azure/core-rest-pipeline": "workspace:*",
"tslib": "catalog:"
},
"keywords": ["node", "azure", "typescript", "browser", "isomorphic", "cloud"],
"license": "MIT",
Expand All @@ -18,9 +18,9 @@
"types": "./dist/commonjs/index.d.ts",
"type": "module",
"devDependencies": {
"typescript": "~5.8.2",
"dotenv": "^16.0.0",
"@azure/dev-tool": "^1.0.0"
"typescript": "catalog:",
"dotenv": "catalog:testing",
"@azure/dev-tool": "workspace:*"
},
"repository": "github:Azure/azure-sdk-for-js",
"bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"version": "1.0.0-preview1",
"engines": { "node": ">=18.0.0" },
"dependencies": {
"@azure/core-client": "^1.9.2",
"@azure/core-rest-pipeline": "^1.19.0",
"tslib": "^2.8.1"
"@azure/core-client": "workspace:*",
"@azure/core-rest-pipeline": "workspace:*",
"tslib": "catalog:"
},
"keywords": ["node", "azure", "typescript", "browser", "isomorphic", "cloud"],
"license": "MIT",
Expand All @@ -17,9 +17,9 @@
"types": "./dist/commonjs/index.d.ts",
"type": "module",
"devDependencies": {
"typescript": "~5.8.2",
"dotenv": "^16.0.0",
"@azure/dev-tool": "^1.0.0"
"typescript": "catalog:",
"dotenv": "catalog:testing",
"@azure/dev-tool": "workspace:*"
},
"repository": "github:Azure/azure-sdk-for-js",
"bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"version": "1.0.0-preview1",
"engines": { "node": ">=18.0.0" },
"dependencies": {
"@azure/core-client": "^1.9.2",
"@azure/core-rest-pipeline": "^1.19.0",
"tslib": "^2.8.1"
"@azure/core-client": "workspace:*",
"@azure/core-rest-pipeline": "workspace:*",
"tslib": "catalog:"
},
"keywords": ["node", "azure", "typescript", "browser", "isomorphic", "cloud"],
"license": "MIT",
Expand All @@ -17,9 +17,9 @@
"types": "./dist/commonjs/index.d.ts",
"type": "module",
"devDependencies": {
"typescript": "~5.8.2",
"dotenv": "^16.0.0",
"@azure/dev-tool": "^1.0.0"
"typescript": "catalog:",
"dotenv": "catalog:testing",
"@azure/dev-tool": "workspace:*"
},
"repository": "github:Azure/azure-sdk-for-js",
"bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" },
Expand Down
Loading
Loading