Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8ec4ed1

Browse files
authored
[monitor] Add rollup build (Azure#13182)
Azure#13070 broke the monitor package for non-module imports, since the "main" file it references doesn't exist. This PR brings the package into our normal build process, exposing real module exports and also bundling a cjs version.
1 parent 2972c14 commit 8ec4ed1

File tree

5 files changed

+15
-26
lines changed

5 files changed

+15
-26
lines changed

sdk/monitor/opentelemetry-exporter-azure-monitor/package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@
1212
"build:autorest": "autorest ./swagger/README.md --typescript --v3",
1313
"build:browser": "echo skipped",
1414
"build:test": "echo skipped",
15-
"build:node": "tsc -p .",
15+
"build:node": "tsc -p . && rollup -c 2>&1",
1616
"build": "npm run build:node && npm run build:browser && api-extractor run --local",
1717
"extract-api": "tsc -p . && api-extractor run --local",
1818
"lint": "eslint . --ext .ts || exit 0",
1919
"test": "npm run test:node && npm run test:browser",
2020
"test:node": "npm run unit-test:node",
2121
"test:browser": "npm run unit-test:browser",
2222
"unit-test:browser": "echo skipped",
23-
"unit-test:node": "nyc ts-mocha -p ./tsconfig.json 'test/unit/**/*.test.ts'",
23+
"unit-test:node": "nyc mocha -r esm --require ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace \"test/unit/**/*.test.ts\"",
2424
"unit-test:node:no-timeout": "echo skipped",
2525
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
26-
"functional-test": "ts-mocha -p ./tsconfig.json 'test/functional/**/*.test.ts'",
26+
"functional-test": "nyc mocha -r esm --require ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace \"test/functional/**/*.test.ts\"",
2727
"integration-test:browser": "echo skipped",
2828
"integration-test:node": "npm run functional-test",
2929
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
@@ -62,6 +62,7 @@
6262
]
6363
},
6464
"devDependencies": {
65+
"@azure/dev-tool": "^1.0.0",
6566
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
6667
"@microsoft/api-extractor": "7.7.11",
6768
"@types/mocha": "^7.0.2",
@@ -74,8 +75,9 @@
7475
"nyc": "^14.0.0",
7576
"prettier": "^1.16.4",
7677
"rimraf": "^3.0.0",
78+
"rollup": "^1.16.3",
7779
"sinon": "^9.0.2",
78-
"ts-mocha": "^7.0.0",
80+
"ts-node": "^8.3.0",
7981
"typescript": "4.1.2",
8082
"typedoc": "0.15.0"
8183
},
@@ -85,7 +87,8 @@
8587
"@opentelemetry/core": "^0.10.2",
8688
"@opentelemetry/resources": "^0.10.2",
8789
"@opentelemetry/semantic-conventions": "^0.10.2",
88-
"@opentelemetry/tracing": "^0.10.2"
90+
"@opentelemetry/tracing": "^0.10.2",
91+
"tslib": "^2.0.0"
8992
},
9093
"sideEffects": false,
9194
"keywords": [
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { makeConfig } from "@azure/dev-tool/shared-config/rollup";
2+
3+
export default makeConfig(require("./package.json"), { disableBrowserBundle: true });

sdk/monitor/opentelemetry-exporter-azure-monitor/test/unit/export/trace.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from "../breezeTestUtils";
1313
import { FileSystemPersist } from "../../../src/platform";
1414
import { TelemetryItem as Envelope } from "../../../src/generated";
15-
import nock = require("nock");
15+
import nock from "nock";
1616

1717
function toObject<T>(obj: T): T {
1818
return JSON.parse(JSON.stringify(obj)) as T;

sdk/monitor/opentelemetry-exporter-azure-monitor/test/unit/platform/nodejs/httpSender.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
partialBreezeResponse
1111
} from "../../breezeTestUtils";
1212
import { TelemetryItem as Envelope } from "../../../../src/generated";
13-
import nock = require("nock");
13+
import nock from "nock";
1414

1515
describe("HttpSender", () => {
1616
const scope = nock(DEFAULT_BREEZE_ENDPOINT).post("/v2/track");
Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,8 @@
11
{
22
"extends": "../../../tsconfig.package",
33
"compilerOptions": {
4-
"importHelpers": false,
5-
"allowUnreachableCode": false,
6-
"allowUnusedLabels": false,
7-
"declaration": true,
8-
"forceConsistentCasingInFileNames": true,
9-
"module": "commonjs",
10-
"noEmitOnError": true,
11-
"noFallthroughCasesInSwitch": true,
12-
"noImplicitReturns": true,
13-
"noUnusedLocals": true,
14-
"pretty": true,
15-
"sourceMap": true,
16-
"strict": true,
17-
"strictNullChecks": true,
18-
"target": "es5",
19-
"incremental": true,
20-
"outDir": "dist-esm",
21-
"declarationDir": "types",
22-
"lib": []
4+
"outDir": "./dist-esm",
5+
"declarationDir": "./types"
236
},
247
"include": ["src/**/*.ts", "test/**/*.ts"]
258
}

0 commit comments

Comments
 (0)