diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1fcba1986ed..0073effd137 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,6 +2,19 @@ We'd love your help! +## Development Quick Start + +To get the project started quickly, you can follow these steps. For more +detailed instructions, see [development](#development) below. + +```sh +$ git clone https://github.com/open-telemetry/opentelemetry-js.git +$ cd opentelemetry-js +$ npm install +$ npm run compile +$ npm test +``` + ## Report a bug or requesting feature Reporting bugs is an important contribution. Please make sure to include: @@ -57,15 +70,102 @@ Remember to always work in a branch of your local copy, as you might otherwise h Please also see [GitHub workflow](https://github.com/open-telemetry/community/blob/master/CONTRIBUTING.md#github-workflow) section of general project contributing guide. -### Running the tests +## Development + +### Tools used + +- [NPM](https://npmjs.com) +- [TypeScript](https://www.typescriptlang.org/) +- [lerna](https://github.com/lerna/lerna) to manage dependencies, compilations, and links between packages. Most lerna commands should be run by calling the provided npm scripts. +- [MochaJS](https://mochajs.org/) for tests +- [gts](https://github.com/google/gts) +- [eslint](https://eslint.org/) + +Most of the commands needed for development are accessed as [npm scripts](https://docs.npmjs.com/cli/v6/using-npm/scripts). It is recommended that you use the provided npm scripts instead of using `lerna run` in most cases. + +### Install dependencies + +This will install all dependencies for the root project and all modules managed by `lerna`. By default, a `postinstall` script will run `lerna bootstrap` automatically after an install. This can be avoided using the `--ignore-scripts` option if desired. + +```sh +$ npm install +``` + +### Compile modules + +All modules are managed as a composite typescript project using [Project References](https://www.typescriptlang.org/docs/handbook/project-references.html). This means that a breaking change in one module will be reflected in compilations of its dependent modules automatically. + +DO NOT use lerna to compile all modules unless you know what you are doing because this will cause a new typescript process to be spawned for every module in the project. + +```sh +# Build all modules +$ npm run compile + +# Remove compiled output +$ npm run clean +``` + +These commands can also be run for specific packages instead of the whole project, which can speed up compilations while developing. + +```sh +# Build a single module and all of its dependencies +$ cd packages/opentelemetry-module-name +$ npm run compile +``` + +Finally, builds can be run continuously as files change using the `watch` npm script. + +```sh +# Build all modules +$ npm run watch + +# Build a single module and all of its dependencies +$ cd packages/opentelemetry-module-name +$ npm run watch +``` + +### Running tests + +Similar to compilations, tests can be run from the root to run all tests or from a single module to run only the tests for that module. + +```sh +# Test all modules +$ npm test + +# Test a single module +$ cd packages/opentelemetry-module-name +$ npm test +``` + +### Linting + +This project uses a combination of `gts` and `eslint`. Just like tests and compilation, linting can be done for all packages or only a single package. + +```sh +# Lint all modules +$ npm lint + +# Lint a single module +$ cd packages/opentelemetry-module-name +$ npm lint +``` + +There is also a script which will automatically fix many linting errors. + +```sh +# Lint all modules, fixing errors +$ npm lint:fix + +# Lint a single module, fixing errors +$ cd packages/opentelemetry-module-name +$ npm lint:fix +``` + +### Adding a package -The `opentelemetry-js` project is written in TypeScript. +To add a new package, copy `packages/template` to your new package directory and modify the `package.json` file to reflect your desired package settings. If the package will not support browser, the `karma.conf` file may be deleted. If the package will support es5 targets, the reference to `tsconfig.base.json` in `tsconfig.json` should be changed to `tsconfig.es5.json`. -- `npm install` to install dependencies. -- `npm run compile` compiles the code, checking for type errors. -- `npm run bootstrap` Bootstrap the packages in the current Lerna repo. Installs all of their dependencies and links any cross-dependencies. -- `npm test` tests code the same way that our CI will test it. -- `npm run lint:fix` lint (and maybe fix) any changes. +After adding the package, run `npm install` from the root of the project. This will update the `tsconfig.json` project references automatically and install all dependencies in your new package. ### Guidelines for Pull Requests diff --git a/README.md b/README.md index 7465856da01..9c0f3b5aca9 100644 --- a/README.md +++ b/README.md @@ -120,8 +120,9 @@ estimates, and subject to change. ## Contributing We'd love your help!. Use tags [up-for-grabs][up-for-grabs-issues] and -[good first issue][good-first-issues] to get started with the project. Follow -[CONTRIBUTING](CONTRIBUTING.md) guide to report issues or submit a proposal. +[good first issue][good-first-issues] to get started with the project. For +instructions to build and make changes to this project, see the +[CONTRIBUTING](CONTRIBUTING.md) guide. We have a weekly SIG meeting! See the [community page](https://github.com/open-telemetry/community#javascript-sdk) for meeting details and notes. diff --git a/package.json b/package.json index 29b32860075..511657f6c3d 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "types": "build/src/index.d.ts", "scripts": { "compile": "tsc --build", + "watch": "tsc --build --watch", "clean": "tsc --build --clean", "bench": "node benchmark", "postinstall": "update-ts-references && npm run bootstrap", diff --git a/packages/opentelemetry-api/package.json b/packages/opentelemetry-api/package.json index d85889dbddf..f3e0d5e40f4 100644 --- a/packages/opentelemetry-api/package.json +++ b/packages/opentelemetry-api/package.json @@ -22,7 +22,7 @@ "version": "node ../../scripts/version-update.js", "docs-test": "linkinator docs/out --silent --skip david-dm.org", "docs": "typedoc --tsconfig tsconfig.docs.json", - "watch": "tsc -w" + "watch": "tsc --build --watch" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-context-base/package.json b/packages/opentelemetry-context-base/package.json index 45f97772f7d..76cb1a6587d 100644 --- a/packages/opentelemetry-context-base/package.json +++ b/packages/opentelemetry-context-base/package.json @@ -14,7 +14,7 @@ "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc --build --watch" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-context-zone-peer-dep/package.json b/packages/opentelemetry-context-zone-peer-dep/package.json index 9e71b0120b4..45eafacde60 100644 --- a/packages/opentelemetry-context-zone-peer-dep/package.json +++ b/packages/opentelemetry-context-zone-peer-dep/package.json @@ -14,7 +14,7 @@ "version": "node ../../scripts/version-update.js", "tdd": "karma start", "test:browser": "nyc karma start --single-run", - "watch": "tsc -w" + "watch": "tsc --build --watch" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-context-zone/package.json b/packages/opentelemetry-context-zone/package.json index 40ea1ffdbd2..5ac8ee0b36b 100644 --- a/packages/opentelemetry-context-zone/package.json +++ b/packages/opentelemetry-context-zone/package.json @@ -11,7 +11,7 @@ "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc --build --watch" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-core/package.json b/packages/opentelemetry-core/package.json index fe2cb4db6d4..53a72577a69 100644 --- a/packages/opentelemetry-core/package.json +++ b/packages/opentelemetry-core/package.json @@ -22,7 +22,7 @@ "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc --build --watch" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-exporter-collector/package.json b/packages/opentelemetry-exporter-collector/package.json index cad769f531c..7e729c16903 100644 --- a/packages/opentelemetry-exporter-collector/package.json +++ b/packages/opentelemetry-exporter-collector/package.json @@ -20,7 +20,7 @@ "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'", "test:browser": "nyc karma start --single-run", "version": "node ../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc --build --watch" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-exporter-jaeger/package.json b/packages/opentelemetry-exporter-jaeger/package.json index 4dd1b8e08f7..a92a8249bf5 100644 --- a/packages/opentelemetry-exporter-jaeger/package.json +++ b/packages/opentelemetry-exporter-jaeger/package.json @@ -14,7 +14,7 @@ "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc --build --watch" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-exporter-prometheus/package.json b/packages/opentelemetry-exporter-prometheus/package.json index 7c6e1f10038..8047b2dfeaa 100644 --- a/packages/opentelemetry-exporter-prometheus/package.json +++ b/packages/opentelemetry-exporter-prometheus/package.json @@ -14,7 +14,7 @@ "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc --build --watch" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-exporter-zipkin/package.json b/packages/opentelemetry-exporter-zipkin/package.json index a62f40f03b2..1b1f16cb76d 100644 --- a/packages/opentelemetry-exporter-zipkin/package.json +++ b/packages/opentelemetry-exporter-zipkin/package.json @@ -20,7 +20,7 @@ "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'", "test:browser": "nyc karma start --single-run", "version": "node ../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc --build --watch" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-instrumentation-http/package.json b/packages/opentelemetry-instrumentation-http/package.json index c796b6815f6..7583b407b5a 100644 --- a/packages/opentelemetry-instrumentation-http/package.json +++ b/packages/opentelemetry-instrumentation-http/package.json @@ -14,7 +14,7 @@ "lint:fix": "eslint . --ext .ts --fix", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", "version": "node ../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc --build --watch" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-instrumentation-xml-http-request/package.json b/packages/opentelemetry-instrumentation-xml-http-request/package.json index 4c572d1d881..e9223cbe694 100644 --- a/packages/opentelemetry-instrumentation-xml-http-request/package.json +++ b/packages/opentelemetry-instrumentation-xml-http-request/package.json @@ -14,7 +14,7 @@ "version": "node ../../scripts/version-update.js", "tdd": "karma start", "test:browser": "nyc karma start --single-run", - "watch": "tsc -w" + "watch": "tsc --build --watch" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-instrumentation/package.json b/packages/opentelemetry-instrumentation/package.json index ed133311c94..8d0ac7633f9 100644 --- a/packages/opentelemetry-instrumentation/package.json +++ b/packages/opentelemetry-instrumentation/package.json @@ -39,7 +39,7 @@ "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'", "test:browser": "nyc karma start --single-run", "version": "node ../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc --build --watch" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-metrics/package.json b/packages/opentelemetry-metrics/package.json index 2bd974b4a7c..cdd911d2373 100644 --- a/packages/opentelemetry-metrics/package.json +++ b/packages/opentelemetry-metrics/package.json @@ -14,7 +14,7 @@ "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc --build --watch" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-node/package.json b/packages/opentelemetry-node/package.json index eb927c10486..4b67dbef34e 100644 --- a/packages/opentelemetry-node/package.json +++ b/packages/opentelemetry-node/package.json @@ -14,7 +14,7 @@ "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc --build --watch" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-plugin-fetch/package.json b/packages/opentelemetry-plugin-fetch/package.json index df0e64e37e5..97f30564113 100644 --- a/packages/opentelemetry-plugin-fetch/package.json +++ b/packages/opentelemetry-plugin-fetch/package.json @@ -14,7 +14,7 @@ "version": "node ../../scripts/version-update.js", "tdd": "karma start", "test:browser": "nyc karma start --single-run", - "watch": "tsc -w" + "watch": "tsc --build --watch" }, "keywords": [ "fetch", diff --git a/packages/opentelemetry-plugin-http/package.json b/packages/opentelemetry-plugin-http/package.json index 07e0d06f50c..296b247efd4 100644 --- a/packages/opentelemetry-plugin-http/package.json +++ b/packages/opentelemetry-plugin-http/package.json @@ -14,7 +14,7 @@ "lint:fix": "eslint . --ext .ts --fix", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", "version": "node ../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc --build --watch" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-propagator-b3/package.json b/packages/opentelemetry-propagator-b3/package.json index a6d15cd41c0..6598df1a9f8 100644 --- a/packages/opentelemetry-propagator-b3/package.json +++ b/packages/opentelemetry-propagator-b3/package.json @@ -13,7 +13,7 @@ "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc --build --watch" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-sdk-node/package.json b/packages/opentelemetry-sdk-node/package.json index c1249f80d7c..eb2c7820afb 100644 --- a/packages/opentelemetry-sdk-node/package.json +++ b/packages/opentelemetry-sdk-node/package.json @@ -13,7 +13,7 @@ "lint": "eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "version": "node ../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc --build --watch" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-semantic-conventions/package.json b/packages/opentelemetry-semantic-conventions/package.json index 78e0079dee8..4bf532c43e1 100644 --- a/packages/opentelemetry-semantic-conventions/package.json +++ b/packages/opentelemetry-semantic-conventions/package.json @@ -13,7 +13,7 @@ "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'", "tdd": "npm run test -- --watch-extensions ts --watch", "version": "node ../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc --build --watch" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-tracing/package.json b/packages/opentelemetry-tracing/package.json index 28d26979110..8b6ac004b23 100644 --- a/packages/opentelemetry-tracing/package.json +++ b/packages/opentelemetry-tracing/package.json @@ -21,7 +21,7 @@ "lint:fix": "eslint . --ext .ts --fix", "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", "version": "node ../../scripts/version-update.js", - "watch": "tsc -w" + "watch": "tsc --build --watch" }, "keywords": [ "opentelemetry", diff --git a/packages/opentelemetry-web/package.json b/packages/opentelemetry-web/package.json index 1408b1f71b7..6ed5fc83738 100644 --- a/packages/opentelemetry-web/package.json +++ b/packages/opentelemetry-web/package.json @@ -14,7 +14,7 @@ "version": "node ../../scripts/version-update.js", "tdd": "karma start", "test:browser": "nyc karma start --single-run", - "watch": "tsc -w" + "watch": "tsc --build --watch" }, "keywords": [ "opentelemetry", diff --git a/packages/template/.eslintignore b/packages/template/.eslintignore new file mode 100644 index 00000000000..9ef96044fab --- /dev/null +++ b/packages/template/.eslintignore @@ -0,0 +1,2 @@ +build + diff --git a/packages/template/.eslintrc.js b/packages/template/.eslintrc.js new file mode 100644 index 00000000000..9dfe62f9b8c --- /dev/null +++ b/packages/template/.eslintrc.js @@ -0,0 +1,9 @@ +module.exports = { + "env": { + "mocha": true, + "commonjs": true, + "node": true, + "browser": true + }, + ...require('../../eslint.config.js') +} diff --git a/packages/template/.npmignore b/packages/template/.npmignore new file mode 100644 index 00000000000..9505ba9450f --- /dev/null +++ b/packages/template/.npmignore @@ -0,0 +1,4 @@ +/bin +/coverage +/doc +/test diff --git a/packages/template/LICENSE b/packages/template/LICENSE new file mode 100644 index 00000000000..261eeb9e9f8 --- /dev/null +++ b/packages/template/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/packages/template/README.md b/packages/template/README.md new file mode 100644 index 00000000000..b15e5f12174 --- /dev/null +++ b/packages/template/README.md @@ -0,0 +1,11 @@ +# `@opentelemetry/template` + +> TODO: description + +## Usage + +``` +const template = require('@opentelemetry/template'); + +// TODO: DEMONSTRATE API +``` diff --git a/packages/template/karma.conf.js b/packages/template/karma.conf.js new file mode 100644 index 00000000000..3019564a15b --- /dev/null +++ b/packages/template/karma.conf.js @@ -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 + })) +}; diff --git a/packages/template/package.json b/packages/template/package.json new file mode 100644 index 00000000000..60bd4ee71a3 --- /dev/null +++ b/packages/template/package.json @@ -0,0 +1,87 @@ +{ + "name": "@opentelemetry/template", + "version": "0.14.0", + "private": true, + "publishConfig": { + "access": "restricted" + }, + "description": "> TODO: description", + "author": "OpenTelemetry Authors", + "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme", + "license": "Apache-2.0", + "main": "build/src/index.js", + "types": "build/src/index.d.ts", + "repository": { + "type": "git", + "url": "git+https://github.com/open-telemetry/opentelemetry-js.git" + }, + "bugs": { + "url": "https://github.com/open-telemetry/opentelemetry-js/issues" + }, + "engines": { + "node": ">=8.0.0" + }, + "scripts": { + "compile": "tsc --build", + "clean": "tsc --build --clean" + }, + "Add these to scripts": { + "compile": "tsc --build", + "clean": "tsc --build --clean", + "test": "nyc ts-mocha -p tsconfig.json test/**/*.test.ts", + "codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", + "lint": "eslint . --ext .ts", + "lint:fix": "eslint . --ext .ts --fix", + "version": "node ../../scripts/version-update.js", + "watch": "tsc --build --watch" + }, + "Add these to scripts if browser is supported": { + "test:browser": "nyc karma start --single-run", + "codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../" + }, + "keywords": [ + "opentelemetry", + "nodejs", + "browser", + "tracing", + "profiling", + "metrics", + "stats", + "monitoring" + ], + "files": [ + "build/src/**/*.js", + "build/src/**/*.js.map", + "build/src/**/*.d.ts", + "LICENSE", + "README.md" + ], + "devDependencies": { + "@types/node": "14.14.12", + "typescript": "3.9.7" + }, + "Add these to devDependencies for testing": { + "@types/mocha": "8.2.0", + "@types/sinon": "9.0.9", + "codecov": "3.8.1", + "istanbul-instrumenter-loader": "3.0.1", + "mocha": "7.2.0", + "nyc": "15.1.0", + "sinon": "9.2.2", + "ts-loader": "8.0.12", + "ts-mocha": "8.0.0" + }, + "Add these to devDependencies if browser is targeted": { + "@types/webpack-env": "1.16.0", + "karma": "5.2.3", + "karma-chrome-launcher": "3.1.0", + "karma-coverage-istanbul-reporter": "3.0.3", + "karma-mocha": "2.0.1", + "karma-spec-reporter": "0.0.32", + "karma-webpack": "4.0.2", + "webpack": "4.44.2" + }, + "Add these to devDependencies for linting": { + "gts": "2.0.2" + } +} diff --git a/packages/template/src/index.ts b/packages/template/src/index.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/template/tsconfig.json b/packages/template/tsconfig.json new file mode 100644 index 00000000000..4ffdbb48ce6 --- /dev/null +++ b/packages/template/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build" + }, + "include": [ + "src/**/*.ts", + "test/**/*.ts" + ], + "references": [ + ] +} diff --git a/tsconfig.json b/tsconfig.json index fc42a783f3b..22efc769bce 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -107,6 +107,9 @@ { "path": "packages/opentelemetry-web" }, + { + "path": "packages/template" + }, { "path": "integration-tests/propagation-validation-server" }