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

[monitor] Migrate monitor-opentelmetry to ESM and vitest #32819

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Migration: Update package.json, tsconfig.json, and api-extractor.json
  • Loading branch information
maorleger committed Jan 31, 2025
commit 84b4f777d58ec817f1fc9b17c062bef01053005c
4 changes: 2 additions & 2 deletions sdk/monitor/monitor-opentelemetry/api-extractor.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"mainEntryPointFilePath": "types/src/index.d.ts",
"mainEntryPointFilePath": "dist/esm/index.d.ts",
"docModel": {
"enabled": true
},
Expand All @@ -11,7 +11,7 @@
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "",
"publicTrimmedFilePath": "./types/monitor-opentelemetry.d.ts"
"publicTrimmedFilePath": "dist/monitor-opentelemetry.d.ts"
},
"messages": {
"tsdocMessageReporting": {
Expand Down
51 changes: 28 additions & 23 deletions sdk/monitor/monitor-opentelemetry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
"module": "dist-esm/src/index.js",
"types": "types/monitor-opentelemetry.d.ts",
"scripts": {
"build": "npm run build:node && npm run build:browser && dev-tool run extract-api",
"build": "npm run clean && dev-tool run build-package && dev-tool run extract-api",
"build:browser": "echo skipped",
"build:node": "tsc -p . && dev-tool run bundle --browser-test=false",
"build:node": "dev-tool run build-package && dev-tool run bundle --browser-test=false",
"build:samples": "echo Obsolete.",
"build:test": "tsc -p . && dev-tool run bundle --browser-test=false",
"build:test": "dev-tool run build-package && dev-tool run bundle --browser-test=false",
"check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
"clean": "dev-tool run vendored rimraf --glob dist dist-* temp types *.tgz *.log",
"execute:samples": "dev-tool samples run samples-dev",
"extract-api": "tsc -p . && dev-tool run extract-api",
"extract-api": "dev-tool run build-package && dev-tool run extract-api",
"format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
"generate:client": "autorest --typescript ./swagger/README.md",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
Expand All @@ -31,19 +31,15 @@
"test:node": "npm run clean && npm run build:test && npm run unit-test:node",
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
"unit-test:browser": "echo skipped",
"unit-test:node": "dev-tool run test:node-tsx-ts --no-test-proxy -- --timeout 1200000 \"test/internal/unit/**/*.test.ts\"",
"unit-test:node": "dev-tool run test:vitest",
"update-snippets": "echo skipped"
},
"engines": {
"node": ">=18.0.0"
},
"files": [
"dist-esm/src/",
"dist/src/",
"browser/src/",
"types/monitor-opentelemetry.d.ts",
"dist/",
"README.md",
"SECURITY.md",
"LICENSE"
],
"license": "MIT",
Expand All @@ -63,28 +59,24 @@
}
},
"devDependencies": {
"@azure-tools/test-utils": "^1.0.1",
"@azure-tools/test-utils-vitest": "^1.0.0",
"@azure/dev-tool": "^1.0.0",
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
"@azure/functions": "^4.5.0",
"@azure/functions-old": "npm:@azure/functions@3.5.1",
"@types/mocha": "^10.0.0",
"@types/node": "^18.0.0",
"@types/sinon": "^17.0.0",
"@vitest/coverage-istanbul": "^3.0.3",
"dotenv": "^16.0.0",
"eslint": "^9.9.0",
"mocha": "^11.0.2",
"nock": "^14.0.0",
"nyc": "^17.0.0",
"sinon": "^17.0.0",
"tsx": "^4.7.1",
"typescript": "~5.7.2"
"typescript": "~5.7.2",
"vitest": "^3.0.3"
},
"dependencies": {
"@azure/core-auth": "^1.3.0",
"@azure/core-client": "^1.0.0",
"@azure/core-rest-pipeline": "^1.1.0",
"@azure/logger": "^1.0.0",
"@azure/core-auth": "^1.9.0",
"@azure/core-client": "^1.9.2",
"@azure/core-rest-pipeline": "^1.18.2",
"@azure/logger": "^1.1.4",
"@azure/monitor-opentelemetry-exporter": "1.0.0-beta.27",
"@azure/opentelemetry-instrumentation-azure-sdk": "^1.0.0-beta.7",
"@microsoft/applicationinsights-web-snippet": "^1.2.1",
Expand Down Expand Up @@ -120,5 +112,18 @@
"opentelemetry",
"distro",
"cloud"
]
],
"type": "module",
"tshy": {
"project": "./tsconfig.src.json",
"exports": {
"./package.json": "./package.json",
".": "./src/index.ts"
},
"dialects": [
"esm",
"commonjs"
],
"selfLink": false
}
}
19 changes: 10 additions & 9 deletions sdk/monitor/monitor-opentelemetry/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"extends": "../../../tsconfig",
"compilerOptions": {
"outDir": "./dist-esm",
"declarationDir": "./types",
"paths": {
"@azure/monitor-opentelemetry": ["./src/index"]
"references": [
{
"path": "./tsconfig.src.json"
},
"lib": ["es6", "dom"]
},
"include": ["src/**/*.ts", "test/**/*.ts", "samples-dev/**/*.ts"]
{
"path": "./tsconfig.samples.json"
},
{
"path": "./tsconfig.test.json"
}
]
}
10 changes: 10 additions & 0 deletions sdk/monitor/monitor-opentelemetry/tsconfig.samples.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../../tsconfig.samples.base.json",
"compilerOptions": {
"paths": {
"@azure/monitor-opentelemetry": [
"./dist/esm"
]
}
}
}
3 changes: 3 additions & 0 deletions sdk/monitor/monitor-opentelemetry/tsconfig.src.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../../tsconfig.lib.json"
}
6 changes: 6 additions & 0 deletions sdk/monitor/monitor-opentelemetry/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": [
"./tsconfig.src.json",
"../../../tsconfig.test.base.json"
]
}