Skip to content

Commit

Permalink
chore: fix build errors (open-telemetry#747)
Browse files Browse the repository at this point in the history
* chore: switch from yarn to npm

* chore: ignore unpublished package
  • Loading branch information
dyladan authored Feb 5, 2020
1 parent 8b7e58c commit 5c9ad85
Show file tree
Hide file tree
Showing 30 changed files with 95 additions and 90 deletions.
50 changes: 28 additions & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ node_test_env: &node_test_env
MYSQL_PASSWORD: secret
MYSQL_DATABASE: circle_database
MYSQL_PORT: 3306
NPM_CONFIG_UNSAFE_PERM: true

postgres_service: &postgres_service
image: circleci/postgres:9.6-alpine
Expand All @@ -39,10 +40,10 @@ mysql_service: &mysql_service
MYSQL_ROOT_PASSWORD: rootpw

cache_1: &cache_1
key: npm-cache-01-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-1
key: npm-cache-01-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-FDF2088C
paths:
- ./node_modules
- ./yarn.lock
- ./package-lock.json
- packages/opentelemetry-base/node_modules
- packages/opentelemetry-scope-base/node_modules
- packages/opentelemetry-api/node_modules
Expand All @@ -59,7 +60,7 @@ cache_1: &cache_1
- packages/opentelemetry-plugin-dns/node_modules

cache_2: &cache_2
key: npm-cache-02-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-2
key: npm-cache-02-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-FDF2088C
paths:
- packages/opentelemetry-plugin-grpc/node_modules
- packages/opentelemetry-plugin-http/node_modules
Expand All @@ -76,6 +77,7 @@ cache_2: &cache_2
- packages/opentelemetry-exporter-stackdriver-trace/node_modules

node_unit_tests: &node_unit_tests
resource_class: large
steps:
- checkout
- run:
Expand All @@ -93,28 +95,29 @@ node_unit_tests: &node_unit_tests
echo "CIRCLE_NODE_VERSION=${CIRCLE_NODE_VERSION}"
- restore_cache:
keys:
- npm-cache-01-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-1
- npm-cache-01-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-FDF2088C
- restore_cache:
keys:
- npm-cache-02-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-2
- npm-cache-02-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-FDF2088C
- run:
name: Install Dependencies
command: yarn install
name: Install Root Dependencies
command: npm install --ignore-scripts
- run:
name: Boostrap dependencies
command: npx lerna bootstrap --no-ci
- save_cache:
<<: *cache_1
- save_cache:
<<: *cache_2
- run:
name: Compile code
command: yarn compile
- run:
name: Unit tests
command: yarn test
command: npm run test
- run:
name: report coverage
command: if [ "${CIRCLE_NODE_VERSION}" = "v12" ]; then yarn codecov; fi
command: if [ "${CIRCLE_NODE_VERSION}" = "v12" ]; then npm run codecov; fi

browsers_unit_tests: &browsers_unit_tests
resource_class: large
steps:
- checkout
- run:
Expand All @@ -132,23 +135,26 @@ browsers_unit_tests: &browsers_unit_tests
echo "CIRCLE_NODE_VERSION=${CIRCLE_NODE_VERSION}"
- restore_cache:
keys:
- npm-cache-01-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-1
- npm-cache-01-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-FDF2088C
- restore_cache:
keys:
- npm-cache-02-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-1
- npm-cache-02-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/checksums.txt" }}-FDF2088C
- run:
name: Install Root Dependencies
command: npm install --ignore-scripts
- run:
name: Install Dependencies
command: yarn install
name: Boostrap dependencies
command: npx lerna bootstrap --no-ci
- save_cache:
<<: *cache_1
- save_cache:
<<: *cache_2
- run:
name: Unit tests
command: yarn test:browser
command: npm run test:browser
- run:
name: report coverage
command: if [ "$CIRCLE_NODE_VERSION" = "v12" ]; then yarn codecov:browser; fi
command: if [ "$CIRCLE_NODE_VERSION" = "v12" ]; then npm run codecov:browser; fi

jobs:
lint_&_docs:
Expand All @@ -158,16 +164,16 @@ jobs:
- checkout
- run:
name: Install minimal doc and lint modules globally
command: yarn global add lerna typedoc linkinator typescript gts tslint-consistent-codestyle tslint-microsoft-contrib
command: npm i -g tslint lerna typedoc linkinator typescript gts tslint-consistent-codestyle tslint-microsoft-contrib
- run:
name: Symlink global modules into all lerna packages
command: lerna exec 'ln -s $(yarn global dir)/node_modules node_modules'
command: lerna exec 'npm link tslint lerna typedoc linkinator typescript gts tslint-consistent-codestyle tslint-microsoft-contrib'
- run:
name: Check code style and linting
command: yarn run check
command: npm run check
- run:
name: Docs tests
command: yarn docs-test
command: npm run docs-test
- persist_to_workspace:
root: packages/opentelemetry-api/docs
paths:
Expand Down
16 changes: 8 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,20 @@ Please also see [GitHub workflow](https://github.com/open-telemetry/community/bl

The `opentelemetry-js` project is written in TypeScript.

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


### Generating API documentation
- `yarn docs` or `npm run docs` to generate API documentation. Generates the documentation in `packages/opentelemetry-api/docs/out`
- `npm run docs` to generate API documentation. Generates the documentation in `packages/opentelemetry-api/docs/out`

### Generating CHANGELOG documentation
- `yarn changelog` or `npm run changelog` to generate CHANGELOG documentation in your terminal (see [RELEASING.md](RELEASING.md) for more details).
- `npm run changelog` to generate CHANGELOG documentation in your terminal (see [RELEASING.md](RELEASING.md) for more details).

### Benchmarks
When two or more approaches must be compared, please write a benchmark in the benchmark/index.js module so that we can keep track of the most efficient algorithm.

- `yarn bench` or `npm run bench` to run your benchmark.
- `npm run bench` to run your benchmark.
18 changes: 8 additions & 10 deletions doc/development-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@

Before contributing to this open source project, read our [CONTRIBUTING](../CONTRIBUTING.md). We gratefully welcome improvements to documentation as well as to code.

The code base is a monorepo. We use [Lerna](https://lerna.js.org/) for managing inter-module dependencies, which makes it easier to develop coordinated changes between the modules. Instead of running lerna directly, the commands are wrapped with `yarn`;
The code base is a monorepo. We use [Lerna](https://lerna.js.org/) for managing inter-module dependencies, which makes it easier to develop coordinated changes between the modules. Instead of running lerna directly, the commands are wrapped with `npm`;

### Requirements

Since this project supports multiple Node versions, using a version
manager such as [nvm](https://github.com/creationix/nvm) is recommended.

We use [yarn](https://yarnpkg.com/) for its workspace functionality, so make sure to install that as well.

To get started once you have Node and yarn installed, run:
To get started once you have Node installed, run:

```sh
$ yarn
$ npm install
```

This will install all the necessary modules.
Expand All @@ -26,13 +24,13 @@ This will install all the necessary modules.
To run the all unit tests, use:

```sh
$ yarn test
$ npm run test
```

To run the unit tests continuously in watch mode while developing, use:

```sh
$ yarn tdd
$ npm run tdd
```

### Linting
Expand All @@ -43,12 +41,12 @@ Before raising a pull request, make sure there are no lint problems.

To check the linter, use:
```sh
$ yarn run check
$ npm run check
```

To fix the linter, use:
```sh
$ yarn fix
$ npm run fix
```

### Continuous Integration
Expand All @@ -74,7 +72,7 @@ We use [typedoc](https://www.npmjs.com/package/typedoc) to generate the api docu

To generate the docs, use:
```sh
$ yarn docs
$ npm run docs
```

The document will be available under `packages/opentelemetry-api/docs/out` path.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lerna": "3.13.4",
"npmClient": "yarn",
"npmClient": "npm",
"packages": [
"benchmark/*",
"packages/*",
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"bench": "node benchmark",
"clean": "lerna run clean",
"fix": "lerna run fix",
"postinstall": "yarn run bootstrap",
"postinstall": "npm run bootstrap",
"precompile": "tsc --version",
"version:update": "lerna run version:update",
"compile": "lerna run compile",
Expand All @@ -20,7 +20,7 @@
"codecov:browser": "lerna run codecov:browser",
"changelog": "lerna-changelog",
"check": "lerna run check",
"predocs-test": "yarn docs",
"predocs-test": "npm run docs",
"docs-test": "lerna run docs-test",
"docs": "lerna run docs",
"docs-deploy": "gh-pages --dist packages/opentelemetry-api/docs/out",
Expand Down Expand Up @@ -50,6 +50,7 @@
"husky": "^3.0.9",
"lerna": "^3.17.0",
"lerna-changelog": "^0.8.2",
"tslint": "^5.0.0",
"typescript": "^3.7.2"
},
"husky": {
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"version:update": "node ../../scripts/version-update.js",
"compile": "npm run version:update && tsc -p .",
"fix": "gts fix",
"docs-test": "linkinator docs/out --silent --skip david-dm.org --skip https://open-telemetry.github.io/opentelemetry-js/classes/.+api.html",
"docs-test": "linkinator docs/out --silent --skip david-dm.org --skip https://open-telemetry.github.io/opentelemetry-js/classes/.+api.html --skip https://www.npmjs.com/package/@opentelemetry/api",
"docs": "typedoc --tsconfig tsconfig.json",
"prepare": "npm run compile"
},
Expand Down Expand Up @@ -63,7 +63,7 @@
"nyc": "^14.1.1",
"ts-loader": "^6.0.4",
"ts-mocha": "^6.0.0",
"tslint-consistent-codestyle": "^1.15.1",
"tslint-consistent-codestyle": "^1.16.0",
"tslint-microsoft-contrib": "^6.2.0",
"typedoc": "^0.15.0",
"typescript": "3.7.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/opentelemetry-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
"test": "nyc ts-mocha -p tsconfig.json test/**/*.ts",
"tdd": "yarn tdd:node",
"tdd:node": "yarn test -- --watch-extensions ts --watch",
"tdd": "npm run tdd:node",
"tdd:node": "npm run test -- --watch-extensions ts --watch",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"clean": "rimraf build/*",
"check": "gts check",
Expand Down Expand Up @@ -51,7 +51,7 @@
"rimraf": "^3.0.0",
"ts-mocha": "^6.0.0",
"ts-node": "^8.6.2",
"tslint-consistent-codestyle": "^1.15.1",
"tslint-consistent-codestyle": "^1.16.0",
"tslint-microsoft-contrib": "^6.2.0",
"typescript": "3.7.2"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"scripts": {
"test": "nyc ts-mocha -p tsconfig.json test/**/*.ts",
"test:browser": "nyc karma start --single-run",
"tdd": "yarn tdd:node",
"tdd:node": "yarn test -- --watch-extensions ts --watch",
"tdd": "npm run tdd:node",
"tdd:node": "npm run test -- --watch-extensions ts --watch",
"tdd:browser": "karma start",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-exporter-collector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"compile": "npm run version:update && tsc -p .",
"fix": "gts fix",
"prepare": "npm run compile",
"tdd": "yarn test -- --watch-extensions ts --watch",
"tdd": "npm run test -- --watch-extensions ts --watch",
"tdd:browser": "karma start",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.ts' --exclude 'test/browser/**/*.ts'",
"test:browser": "nyc karma start --single-run",
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-exporter-jaeger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.ts'",
"tdd": "yarn test -- --watch-extensions ts --watch",
"tdd": "npm run test -- --watch-extensions ts --watch",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"clean": "rimraf build/*",
"check": "gts check",
Expand Down Expand Up @@ -49,7 +49,7 @@
"rimraf": "^3.0.0",
"ts-mocha": "^6.0.0",
"ts-node": "^8.6.2",
"tslint-consistent-codestyle": "^1.15.1",
"tslint-consistent-codestyle": "^1.16.0",
"tslint-microsoft-contrib": "^6.2.0",
"typescript": "3.7.2"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-exporter-prometheus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.ts'",
"tdd": "yarn test -- --watch-extensions ts --watch",
"tdd": "npm run test -- --watch-extensions ts --watch",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"clean": "rimraf build/*",
"check": "gts check",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"fix": "gts fix",
"precompile": "tsc --version",
"prepare": "npm run compile",
"tdd": "yarn test -- --watch-extensions ts --watch",
"tdd": "npm run test -- --watch-extensions ts --watch",
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.ts'"
},
"keywords": [
Expand Down Expand Up @@ -54,7 +54,7 @@
"sinon": "^8.0.1",
"ts-mocha": "^6.0.0",
"ts-node": "^8.3.0",
"tslint-consistent-codestyle": "^1.15.1",
"tslint-consistent-codestyle": "^1.16.0",
"tslint-microsoft-contrib": "^6.2.0",
"typescript": "3.7.2"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-exporter-zipkin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.ts'",
"tdd": "yarn test -- --watch-extensions ts --watch",
"tdd": "npm run test -- --watch-extensions ts --watch",
"clean": "rimraf build/*",
"check": "gts check",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
Expand Down Expand Up @@ -50,7 +50,7 @@
"rimraf": "^3.0.0",
"ts-mocha": "^6.0.0",
"ts-node": "^8.6.2",
"tslint-consistent-codestyle": "^1.15.1",
"tslint-consistent-codestyle": "^1.16.0",
"tslint-microsoft-contrib": "^6.2.0",
"typescript": "3.7.2"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-metrics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"repository": "open-telemetry/opentelemetry-js",
"scripts": {
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.ts'",
"tdd": "yarn test -- --watch-extensions ts --watch",
"tdd": "npm run test -- --watch-extensions ts --watch",
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
"clean": "rimraf build/*",
"check": "gts check",
Expand Down Expand Up @@ -51,7 +51,7 @@
"sinon": "^7.5.0",
"ts-mocha": "^6.0.0",
"ts-node": "^8.6.2",
"tslint-consistent-codestyle": "^1.15.1",
"tslint-consistent-codestyle": "^1.16.0",
"tslint-microsoft-contrib": "^6.2.0",
"typescript": "3.7.2"
},
Expand Down
Loading

0 comments on commit 5c9ad85

Please sign in to comment.