Skip to content

Commit a2ca120

Browse files
authored
[eventgrid] Migrate @azure/eventgrid to ESM/vitest (Azure#31989)
### Packages impacted by this PR - `@azure/eventgrid` ### Issues associated with this PR - Azure#31338 ### Describe the problem that is addressed by this PR Migrates the @azure/eventgrid package to ESM/vitest via automation. ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? ### Are there test cases added in this PR? _(If not, why?)_ ### Provide a list of related PRs _(if any)_ ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ ### Checklists - [ ] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [ ] Added a changelog (if necessary)
1 parent 95e0d51 commit a2ca120

31 files changed

+283
-365
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 22 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/eventgrid/eventgrid/.nycrc

Lines changed: 0 additions & 10 deletions
This file was deleted.

sdk/eventgrid/eventgrid/api-extractor.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3-
"mainEntryPointFilePath": "types/src/index.d.ts",
3+
"mainEntryPointFilePath": "dist/esm/index.d.ts",
44
"docModel": {
55
"enabled": true
66
},
@@ -11,7 +11,7 @@
1111
"dtsRollup": {
1212
"enabled": true,
1313
"untrimmedFilePath": "",
14-
"publicTrimmedFilePath": "./types/eventgrid.d.ts"
14+
"publicTrimmedFilePath": "dist/eventgrid.d.ts"
1515
},
1616
"messages": {
1717
"tsdocMessageReporting": {

sdk/eventgrid/eventgrid/karma.conf.js

Lines changed: 0 additions & 123 deletions
This file was deleted.

sdk/eventgrid/eventgrid/package.json

Lines changed: 64 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
"cloud"
1414
],
1515
"license": "MIT",
16-
"main": "./dist/index.js",
17-
"module": "./dist-esm/src/index.js",
18-
"types": "./types/eventgrid.d.ts",
16+
"main": "./dist/commonjs/index.js",
17+
"module": "./dist/esm/index.js",
18+
"types": "./dist/commonjs/index.d.ts",
1919
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/eventgrid/eventgrid/README.md",
2020
"repository": "github:Azure/azure-sdk-for-js",
2121
"bugs": {
@@ -26,8 +26,6 @@
2626
},
2727
"files": [
2828
"dist/",
29-
"dist-esm/src/",
30-
"types/eventgrid.d.ts",
3129
"README.md",
3230
"LICENSE"
3331
],
@@ -59,78 +57,93 @@
5957
}
6058
]
6159
},
62-
"browser": {
63-
"./dist-esm/src/cryptoHelpers.js": "./dist-esm/src/cryptoHelpers.browser.js"
64-
},
60+
"browser": "./dist/browser/index.js",
6561
"scripts": {
66-
"build": "npm run clean && tsc -p . && dev-tool run bundle && dev-tool run extract-api",
67-
"build:browser": "tsc -p . && dev-tool run bundle",
68-
"build:node": "tsc -p . && dev-tool run bundle",
62+
"build": "npm run clean && dev-tool run build-package && dev-tool run extract-api",
6963
"build:samples": "echo Obsolete",
70-
"build:test": "tsc -p . && dev-tool run bundle",
64+
"build:test": "echo Obsolete",
7165
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
7266
"clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm dist-test temp types *.tgz *.log",
7367
"execute:samples": "dev-tool samples run samples-dev",
74-
"extract-api": "tsc -p . && dev-tool run extract-api",
68+
"extract-api": "dev-tool run build-package && dev-tool run extract-api",
7569
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
7670
"generate:client": "autorest --typescript ./swagger/README.md && node ./scripts/setPathToEmpty.js",
7771
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
78-
"integration-test:browser": "dev-tool run test:browser",
79-
"integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 \"dist-esm/test/**/*.spec.js\"",
72+
"integration-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser",
73+
"integration-test:node": "dev-tool run test:vitest",
8074
"lint": "eslint package.json api-extractor.json README.md src test",
8175
"lint:fix": "eslint package.json api-extractor.json README.md src test --fix --fix-type [problem,suggestion]",
8276
"pack": "npm pack 2>&1",
8377
"test": "npm run clean && npm run build:test && npm run unit-test",
8478
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser",
8579
"test:node": "npm run clean && npm run build:test && npm run unit-test:node",
8680
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
87-
"unit-test:browser": "dev-tool run test:browser",
88-
"unit-test:node": "dev-tool run test:node-tsx-ts -- --timeout 1200000 'test/**/*.spec.ts'",
81+
"unit-test:browser": "npm run clean && dev-tool run build-package && dev-tool run build-test && dev-tool run test:vitest --browser",
82+
"unit-test:node": "dev-tool run test:vitest",
8983
"update-snippets": "echo skipped"
9084
},
9185
"sideEffects": false,
9286
"autoPublish": false,
9387
"dependencies": {
94-
"@azure/core-auth": "^1.3.0",
95-
"@azure/core-client": "^1.5.0",
96-
"@azure/core-rest-pipeline": "^1.1.0",
97-
"@azure/core-tracing": "^1.0.0",
98-
"@azure/logger": "^1.0.0",
99-
"tslib": "^2.2.0",
100-
"uuid": "^8.3.0"
88+
"@azure/core-auth": "^1.9.0",
89+
"@azure/core-client": "^1.9.2",
90+
"@azure/core-rest-pipeline": "^1.18.0",
91+
"@azure/core-tracing": "^1.2.0",
92+
"@azure/core-util": "^1.11.0",
93+
"@azure/logger": "^1.1.4",
94+
"tslib": "^2.8.1"
10195
},
10296
"devDependencies": {
103-
"@azure-tools/test-credential": "^1.0.0",
104-
"@azure-tools/test-recorder": "^3.0.0",
105-
"@azure-tools/test-utils": "^1.0.1",
106-
"@azure/core-util": "^1.9.0",
97+
"@azure-tools/test-credential": "^2.0.0",
98+
"@azure-tools/test-recorder": "^4.1.0",
99+
"@azure-tools/test-utils-vitest": "^1.0.0",
107100
"@azure/dev-tool": "^1.0.0",
108101
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
109-
"@azure/service-bus": "^7.0.0",
110-
"@types/chai": "^4.1.6",
111-
"@types/chai-as-promised": "^7.1.0",
112-
"@types/mocha": "^10.0.0",
102+
"@azure/service-bus": "^7.9.5",
113103
"@types/node": "^18.0.0",
114-
"@types/sinon": "^17.0.0",
115-
"@types/uuid": "^8.0.0",
116-
"chai": "^4.2.0",
117-
"chai-as-promised": "^7.1.1",
104+
"@vitest/browser": "^2.1.6",
105+
"@vitest/coverage-istanbul": "^2.1.6",
118106
"dotenv": "^16.0.0",
119107
"eslint": "^9.9.0",
120-
"karma": "^6.2.0",
121-
"karma-chrome-launcher": "^3.0.0",
122-
"karma-coverage": "^2.0.0",
123-
"karma-env-preprocessor": "^0.1.1",
124-
"karma-firefox-launcher": "^2.1.3",
125-
"karma-junit-reporter": "^2.0.1",
126-
"karma-mocha": "^2.0.1",
127-
"karma-mocha-reporter": "^2.2.5",
128-
"karma-sourcemap-loader": "^0.3.8",
129-
"mocha": "^10.0.0",
130-
"nyc": "^17.0.0",
131-
"sinon": "^17.0.0",
132-
"source-map-support": "^0.5.9",
133-
"tsx": "^4.7.1",
134-
"typescript": "~5.6.2"
108+
"playwright": "^1.49.0",
109+
"typescript": "~5.6.2",
110+
"vitest": "^2.1.6"
111+
},
112+
"type": "module",
113+
"tshy": {
114+
"exports": {
115+
"./package.json": "./package.json",
116+
".": "./src/index.ts"
117+
},
118+
"dialects": [
119+
"esm",
120+
"commonjs"
121+
],
122+
"esmDialects": [
123+
"browser",
124+
"react-native"
125+
],
126+
"selfLink": false
127+
},
128+
"exports": {
129+
"./package.json": "./package.json",
130+
".": {
131+
"browser": {
132+
"types": "./dist/browser/index.d.ts",
133+
"default": "./dist/browser/index.js"
134+
},
135+
"react-native": {
136+
"types": "./dist/react-native/index.d.ts",
137+
"default": "./dist/react-native/index.js"
138+
},
139+
"import": {
140+
"types": "./dist/esm/index.d.ts",
141+
"default": "./dist/esm/index.js"
142+
},
143+
"require": {
144+
"types": "./dist/commonjs/index.d.ts",
145+
"default": "./dist/commonjs/index.js"
146+
}
147+
}
135148
}
136149
}

0 commit comments

Comments
 (0)