Skip to content

Commit 6956e54

Browse files
authored
Merge branch 'master' into context-naming
2 parents bd4e7d6 + 7e5da41 commit 6956e54

File tree

90 files changed

+1360
-283
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+1360
-283
lines changed

.github/workflows/backcompat.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/docs.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ jobs:
1111
- name: Checkout 🛎️
1212
uses: actions/checkout@v2
1313

14-
- name: Install and Build 🔧
15-
run: |
14+
- name: Install Dependencies
1615
npm install --ignore-scripts
17-
npx lerna bootstrap --scope @opentelemetry/api --include-filtered-dependencies
18-
npm run docs
16+
npx lerna bootstrap --no-ci --scope @opentelemetry/api --include-dependencies
17+
18+
- name: Build 🔧
19+
run: |
20+
npx lerna run compile --scope @opentelemetry/api
21+
npx lerna run docs
1922
2023
- name: Deploy 🚀
2124
uses: JamesIves/github-pages-deploy-action@releases/v3

.github/workflows/lint.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,15 @@ jobs:
4848
npm run lint
4949
npm run lint:examples
5050
51-
- name: Install and Build API Dependencies
52-
run: npx lerna bootstrap --no-ci --scope @opentelemetry/api --include-filtered-dependencies
51+
- name: Install API Dependencies
52+
run: |
53+
npm install --ignore-scripts
54+
npx lerna bootstrap --no-ci --scope @opentelemetry/api --include-dependencies
55+
56+
- name: Build 🔧
57+
run: |
58+
npx lerna run compile --scope @opentelemetry/api
59+
npx lerna run docs
5360
5461
- name: Test Docs
5562
run: npm run docs-test

.github/workflows/unit-test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030
run: npm install --ignore-scripts
3131
- name: Boostrap Dependencies
3232
run: npx lerna bootstrap --no-ci
33+
- name: Build
34+
run: npm run compile
3335
- name: Unit tests
3436
run: npm run test
3537
- name: Report Coverage
@@ -58,6 +60,8 @@ jobs:
5860
run: npm install --ignore-scripts
5961
- name: Boostrap Dependencies
6062
run: npx lerna bootstrap --no-ci
63+
- name: Build
64+
run: npm run compile
6165
- name: Unit tests
6266
run: npm run test:browser
6367
- name: Report Coverage

.github/workflows/w3c-integration-test.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@ jobs:
1212
- name: Checkout 🛎️
1313
uses: actions/checkout@v2
1414

15-
- name: Install and Build 🔧
15+
- name: Install
1616
run: |
1717
npm install --ignore-scripts
18-
npx lerna bootstrap --scope=propagation-validation-server --include-dependencies
18+
npx lerna bootstrap --no-ci --scope=propagation-validation-server --include-dependencies
19+
20+
- name: Build 🔧
21+
run: npm run compile
22+
working-directory: ./integration-tests/propagation-validation-server
1923

2024
- name: Run W3C Test harness
2125
run: ./integration-tests/tracecontext-integration-test.sh

CONTRIBUTING.md

Lines changed: 107 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33
We'd love your help!
44

5+
## Development Quick Start
6+
7+
To get the project started quickly, you can follow these steps. For more
8+
detailed instructions, see [development](#development) below.
9+
10+
```sh
11+
git clone https://github.com/open-telemetry/opentelemetry-js.git
12+
cd opentelemetry-js
13+
npm install
14+
npm run compile
15+
npm test
16+
```
17+
518
## Report a bug or requesting feature
619

720
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
5770

5871
Please also see [GitHub workflow](https://github.com/open-telemetry/community/blob/master/CONTRIBUTING.md#github-workflow) section of general project contributing guide.
5972

60-
### Running the tests
73+
## Development
74+
75+
### Tools used
76+
77+
- [NPM](https://npmjs.com)
78+
- [TypeScript](https://www.typescriptlang.org/)
79+
- [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.
80+
- [MochaJS](https://mochajs.org/) for tests
81+
- [gts](https://github.com/google/gts)
82+
- [eslint](https://eslint.org/)
83+
84+
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.
85+
86+
### Install dependencies
87+
88+
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.
89+
90+
```sh
91+
npm install
92+
```
93+
94+
### Compile modules
95+
96+
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.
97+
98+
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.
99+
100+
```sh
101+
# Build all modules
102+
npm run compile
103+
104+
# Remove compiled output
105+
npm run clean
106+
```
107+
108+
These commands can also be run for specific packages instead of the whole project, which can speed up compilations while developing.
109+
110+
```sh
111+
# Build a single module and all of its dependencies
112+
cd packages/opentelemetry-module-name
113+
npm run compile
114+
```
115+
116+
Finally, builds can be run continuously as files change using the `watch` npm script.
117+
118+
```sh
119+
# Build all modules
120+
npm run watch
121+
122+
# Build a single module and all of its dependencies
123+
cd packages/opentelemetry-module-name
124+
npm run watch
125+
```
126+
127+
### Running tests
128+
129+
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.
130+
131+
```sh
132+
# Test all modules
133+
npm test
134+
135+
# Test a single module
136+
cd packages/opentelemetry-module-name
137+
npm test
138+
```
139+
140+
### Linting
141+
142+
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.
143+
144+
```sh
145+
# Lint all modules
146+
npm lint
147+
148+
# Lint a single module
149+
cd packages/opentelemetry-module-name
150+
npm lint
151+
```
152+
153+
There is also a script which will automatically fix many linting errors.
154+
155+
```sh
156+
# Lint all modules, fixing errors
157+
npm lint:fix
158+
159+
# Lint a single module, fixing errors
160+
cd packages/opentelemetry-module-name
161+
npm lint:fix
162+
```
163+
164+
### Adding a package
61165

62-
The `opentelemetry-js` project is written in TypeScript.
166+
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`.
63167

64-
- `npm install` to install dependencies.
65-
- `npm run compile` compiles the code, checking for type errors.
66-
- `npm run bootstrap` Bootstrap the packages in the current Lerna repo. Installs all of their dependencies and links any cross-dependencies.
67-
- `npm test` tests code the same way that our CI will test it.
68-
- `npm run lint:fix` lint (and maybe fix) any changes.
168+
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.
69169

70170
### Guidelines for Pull Requests
71171

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,9 @@ estimates, and subject to change.
120120
## Contributing
121121

122122
We'd love your help!. Use tags [up-for-grabs][up-for-grabs-issues] and
123-
[good first issue][good-first-issues] to get started with the project. Follow
124-
[CONTRIBUTING](CONTRIBUTING.md) guide to report issues or submit a proposal.
123+
[good first issue][good-first-issues] to get started with the project. For
124+
instructions to build and make changes to this project, see the
125+
[CONTRIBUTING](CONTRIBUTING.md) guide.
125126

126127
We have a weekly SIG meeting! See the [community page](https://github.com/open-telemetry/community#javascript-sdk) for meeting details and notes.
127128

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"extends": "../../tsconfig.es5.json",
3+
"compilerOptions": {
4+
"rootDir": ".",
5+
"outDir": "build"
6+
},
7+
"include": [
8+
"index.ts"
9+
],
10+
"references": [
11+
{
12+
"path": "../../packages/opentelemetry-sdk-node"
13+
},
14+
{
15+
"path": "../../packages/opentelemetry-tracing"
16+
}
17+
]
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"extends": "../../tsconfig.es5.json",
3+
"compilerOptions": {
4+
"rootDir": ".",
5+
"outDir": "build"
6+
},
7+
"include": [
8+
"index.ts"
9+
],
10+
"references": [
11+
{
12+
"path": "../../packages/opentelemetry-sdk-node"
13+
},
14+
{
15+
"path": "../../packages/opentelemetry-tracing"
16+
}
17+
]
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"extends": "../../tsconfig.es5.json",
3+
"compilerOptions": {
4+
"rootDir": ".",
5+
"outDir": "build"
6+
},
7+
"include": [
8+
"index.ts"
9+
],
10+
"references": [
11+
{
12+
"path": "../../packages/opentelemetry-sdk-node"
13+
},
14+
{
15+
"path": "../../packages/opentelemetry-tracing"
16+
}
17+
]
18+
}

0 commit comments

Comments
 (0)