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

chore: add api to monorepo #3261

Merged
merged 11 commits into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
10 changes: 5 additions & 5 deletions api/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
These tasks must be completed before the API package can be released from this repository.

- [x] remove files specific to the API git repo
- [ ] add to lerna monorepo
- [ ] add tsconfig files
- [ ] add web testing
- [ ] build esm versions
- [x] add to lerna monorepo
- [x] add tsconfig files
- [x] add web testing
- [x] build esm versions
- [ ] test node versions 8, 10, and 12
- [ ] add to auto published docs
- [x] add to auto published docs
24 changes: 24 additions & 0 deletions api/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*!
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const karmaWebpackConfig = require('../karma.webpack');
const karmaBaseConfig = require('../karma.base');

module.exports = (config) => {
config.set(Object.assign({}, karmaBaseConfig, {
webpack: karmaWebpackConfig,
}))
};
24 changes: 24 additions & 0 deletions api/karma.worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*!
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const karmaWebpackConfig = require('../karma.webpack');
const karmaBaseConfig = require('../karma.worker');

module.exports = (config) => {
config.set(Object.assign({}, karmaBaseConfig, {
webpack: karmaWebpackConfig,
}))
};
54 changes: 25 additions & 29 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
},
"repository": "https://github.com/open-telemetry/opentelemetry-js-api.git",
"scripts": {
"clean": "tsc --build --clean tsconfig.json tsconfig.esm.json",
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p .",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p .",
"precompile": "npm run version",
"clean": "tsc --build --clean",
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../",
"codecov:webworker": "nyc report --reporter=json && codecov -f coverage/*.json -p ../",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../",
"precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies",
"compile": "tsc --build tsconfig.json tsconfig.esm.json",
"docs": "typedoc",
"docs:deploy": "gh-pages --dist docs/out",
Expand All @@ -24,10 +25,12 @@
"lint": "eslint src test --ext .ts",
"test:browser": "nyc karma start --single-run",
"test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts",
"test:webworker": "nyc karma start karma.worker.js --single-run",
"cycle-check": "dpdm --exit-code circular:1 src/index.ts",
"version": "node scripts/version-update.js",
"prewatch": "npm run version",
"watch": "tsc --build --watch"
"version": "node ../scripts/version-update.js",
"prewatch": "npm run precompile",
"watch": "tsc --build --watch",
"peer-api-check": "node ../scripts/peer-api-check.js"
},
"keywords": [
"opentelemetry",
Expand Down Expand Up @@ -57,34 +60,27 @@
"access": "public"
},
"devDependencies": {
"@types/mocha": "8.2.2",
"@types/node": "14.17.4",
"@types/sinon": "10.0.2",
"@types/webpack-env": "1.16.0",
"@typescript-eslint/eslint-plugin": "5.0.0",
"@typescript-eslint/parser": "5.0.0",
"codecov": "3.8.2",
"dpdm": "3.7.1",
"eslint": "7.32.0",
"eslint-plugin-header": "3.1.1",
"eslint-plugin-node": "11.1.0",
"gh-pages": "3.2.0",
"@types/mocha": "9.1.1",
"@types/node": "18.6.5",
"@types/sinon": "10.0.13",
"@types/webpack-env": "1.16.3",
"codecov": "3.8.3",
"dpdm": "3.10.0",
"istanbul-instrumenter-loader": "3.0.1",
"karma": "5.2.3",
"karma": "6.3.16",
"karma-chrome-launcher": "3.1.0",
"karma-coverage-istanbul-reporter": "3.0.3",
"karma-mocha": "2.0.1",
"karma-mocha-webworker": "1.3.0",
"karma-spec-reporter": "0.0.32",
"karma-webpack": "4.0.2",
"lerna-changelog": "1.0.1",
"linkinator": "2.13.6",
"mocha": "7.2.0",
"mocha": "10.0.0",
"nyc": "15.1.0",
"sinon": "11.1.1",
"ts-loader": "8.2.0",
"ts-mocha": "8.0.0",
"typedoc": "0.21.2",
"typescript": "4.3.5",
"sinon": "14.0.0",
"ts-loader": "8.4.0",
"ts-mocha": "10.0.0",
"typescript": "4.4.4",
"webpack": "4.46.0"
}
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/api"
}
6 changes: 4 additions & 2 deletions api/test/diag/consoleLogger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ export const diagLoggerFunctions = [
'error',
] as const;

const consoleFuncs: Array<keyof Console> = [
const consoleFuncs = [
'debug',
'info',
'warn',
'error',
'log',
'trace',
];
] as const;

const expectedConsoleMap: { [n: string]: keyof Console } = {
error: 'error',
Expand Down Expand Up @@ -127,6 +127,7 @@ describe('DiagConsoleLogger', () => {

consoleFuncs.forEach(cName => {
it(`should log ${fName} message even when console doesn't support ${cName} call before construction`, () => {
// @ts-ignore removing a console property is not allowed by types
dyladan marked this conversation as resolved.
Show resolved Hide resolved
console[cName] = undefined;
const consoleLogger: any = new DiagConsoleLogger();
consoleLogger[fName](`${fName} called %s`, 'param1');
Expand All @@ -142,6 +143,7 @@ describe('DiagConsoleLogger', () => {

it(`should log ${fName} message even when console doesn't support ${cName} call after construction`, () => {
const consoleLogger: any = new DiagConsoleLogger();
// @ts-ignore removing a console property is not allowed by types
console[cName] = undefined;
consoleLogger[fName](`${fName} called %s`, 'param1');
if (cName !== expectedConsoleMap[fName]) {
Expand Down
9 changes: 9 additions & 0 deletions api/tsconfig.all.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../tsconfig.base.json",
"files": [],
"references": [
{ "path": "./tsconfig.json" },
{ "path": "./tsconfig.esm.json" },
{ "path": "./tsconfig.esnext.json" }
]
}
11 changes: 11 additions & 0 deletions api/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../tsconfig.base.esm.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build/esm",
"tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo"
},
"include": [
"src/**/*.ts"
]
}
11 changes: 11 additions & 0 deletions api/tsconfig.esnext.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../tsconfig.base.esnext.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build/esnext",
"tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo"
},
"include": [
"src/**/*.ts"
]
}
13 changes: 13 additions & 0 deletions api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "build"
},
"include": [
"src/**/*.ts",
"test/**/*.ts"
],
"references": [
]
}
5 changes: 5 additions & 0 deletions experimental/packages/api-logs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
],
"references": [
{
"path": "../../../api"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"test/**/*.ts"
],
"references": [
{
"path": "../../../api"
},
{
"path": "../../../packages/opentelemetry-core"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"test/**/*.ts"
],
"references": [
{
"path": "../../../api"
},
{
"path": "../../../packages/opentelemetry-core"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"test/**/*.ts"
],
"references": [
{
"path": "../../../api"
},
{
"path": "../../../packages/opentelemetry-core"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"include": [
"src/**/*.ts",
"test/**/*.ts"
],
"references": [
{
"path": "../../../api"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"test/**/*.ts"
],
"references": [
{
"path": "../../../api"
},
{
"path": "../../../packages/opentelemetry-core"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"test/**/*.ts"
],
"references": [
{
"path": "../../../api"
},
{
"path": "../../../packages/opentelemetry-core"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"test/**/*.ts"
],
"references": [
{
"path": "../../../api"
},
{
"path": "../../../packages/opentelemetry-core"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"test/**/*.ts"
],
"references": [
{
"path": "../../../api"
},
{
"path": "../../../packages/opentelemetry-core"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"test/**/*.ts"
],
"references": [
{
"path": "../../../api"
},
{
"path": "../../../packages/opentelemetry-context-zone"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"test/**/*.ts"
],
"references": [
{
"path": "../../../api"
},
{
"path": "../../../packages/opentelemetry-context-async-hooks"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"test/**/*.ts"
],
"references": [
{
"path": "../../../api"
},
{
"path": "../../../packages/opentelemetry-context-async-hooks"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"test/**/*.ts"
],
"references": [
{
"path": "../../../api"
},
{
"path": "../../../packages/opentelemetry-context-zone"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"test/**/*.ts"
],
"references": [
{
"path": "../../../api"
},
{
"path": "../opentelemetry-api-metrics"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"test/**/*.ts"
],
"references": [
{
"path": "../../../api"
},
{
"path": "../../../packages/opentelemetry-core"
},
Expand Down
3 changes: 3 additions & 0 deletions experimental/packages/opentelemetry-sdk-node/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"test/**/*.ts"
],
"references": [
{
"path": "../../../api"
},
{
"path": "../../../packages/opentelemetry-context-async-hooks"
},
Expand Down
3 changes: 3 additions & 0 deletions experimental/packages/otlp-exporter-base/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"test/**/*.ts"
],
"references": [
{
"path": "../../../api"
},
{
"path": "../../../packages/opentelemetry-core"
}
Expand Down
Loading