Skip to content

Commit

Permalink
[monitor] Add rollup build (#13182)
Browse files Browse the repository at this point in the history
#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.
  • Loading branch information
xirzec authored Jan 12, 2021
1 parent 2972c14 commit 8ec4ed1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 26 deletions.
13 changes: 8 additions & 5 deletions sdk/monitor/opentelemetry-exporter-azure-monitor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
"build:autorest": "autorest ./swagger/README.md --typescript --v3",
"build:browser": "echo skipped",
"build:test": "echo skipped",
"build:node": "tsc -p .",
"build:node": "tsc -p . && rollup -c 2>&1",
"build": "npm run build:node && npm run build:browser && api-extractor run --local",
"extract-api": "tsc -p . && api-extractor run --local",
"lint": "eslint . --ext .ts || exit 0",
"test": "npm run test:node && npm run test:browser",
"test:node": "npm run unit-test:node",
"test:browser": "npm run unit-test:browser",
"unit-test:browser": "echo skipped",
"unit-test:node": "nyc ts-mocha -p ./tsconfig.json 'test/unit/**/*.test.ts'",
"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\"",
"unit-test:node:no-timeout": "echo skipped",
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
"functional-test": "ts-mocha -p ./tsconfig.json 'test/functional/**/*.test.ts'",
"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\"",
"integration-test:browser": "echo skipped",
"integration-test:node": "npm run functional-test",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
Expand Down Expand Up @@ -62,6 +62,7 @@
]
},
"devDependencies": {
"@azure/dev-tool": "^1.0.0",
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
"@microsoft/api-extractor": "7.7.11",
"@types/mocha": "^7.0.2",
Expand All @@ -74,8 +75,9 @@
"nyc": "^14.0.0",
"prettier": "^1.16.4",
"rimraf": "^3.0.0",
"rollup": "^1.16.3",
"sinon": "^9.0.2",
"ts-mocha": "^7.0.0",
"ts-node": "^8.3.0",
"typescript": "4.1.2",
"typedoc": "0.15.0"
},
Expand All @@ -85,7 +87,8 @@
"@opentelemetry/core": "^0.10.2",
"@opentelemetry/resources": "^0.10.2",
"@opentelemetry/semantic-conventions": "^0.10.2",
"@opentelemetry/tracing": "^0.10.2"
"@opentelemetry/tracing": "^0.10.2",
"tslib": "^2.0.0"
},
"sideEffects": false,
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { makeConfig } from "@azure/dev-tool/shared-config/rollup";

export default makeConfig(require("./package.json"), { disableBrowserBundle: true });
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from "../breezeTestUtils";
import { FileSystemPersist } from "../../../src/platform";
import { TelemetryItem as Envelope } from "../../../src/generated";
import nock = require("nock");
import nock from "nock";

function toObject<T>(obj: T): T {
return JSON.parse(JSON.stringify(obj)) as T;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
partialBreezeResponse
} from "../../breezeTestUtils";
import { TelemetryItem as Envelope } from "../../../../src/generated";
import nock = require("nock");
import nock from "nock";

describe("HttpSender", () => {
const scope = nock(DEFAULT_BREEZE_ENDPOINT).post("/v2/track");
Expand Down
21 changes: 2 additions & 19 deletions sdk/monitor/opentelemetry-exporter-azure-monitor/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
{
"extends": "../../../tsconfig.package",
"compilerOptions": {
"importHelpers": false,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"declaration": true,
"forceConsistentCasingInFileNames": true,
"module": "commonjs",
"noEmitOnError": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"pretty": true,
"sourceMap": true,
"strict": true,
"strictNullChecks": true,
"target": "es5",
"incremental": true,
"outDir": "dist-esm",
"declarationDir": "types",
"lib": []
"outDir": "./dist-esm",
"declarationDir": "./types"
},
"include": ["src/**/*.ts", "test/**/*.ts"]
}

0 comments on commit 8ec4ed1

Please sign in to comment.