Skip to content

chore: upgrade lerna #2836

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

Merged
merged 75 commits into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
590d035
chore: remove precompile and prewatch scripts
david-luna Nov 13, 2024
5d268b5
chore: remove lerna package
david-luna Nov 13, 2024
221fc4f
chore: update peer api check workflow
david-luna Nov 13, 2024
ae4ed34
chore: update release validate workflow
david-luna Nov 13, 2024
f38a38c
chore: update comment
david-luna Nov 13, 2024
4e229dc
chore: update comment in tests
david-luna Nov 13, 2024
fb4df28
chore: update release workflow
david-luna Nov 13, 2024
9f37712
chore: update docs
david-luna Nov 13, 2024
6b8d618
chore: update docs
david-luna Nov 13, 2024
362fb4f
chore: add bump version script
david-luna Nov 13, 2024
6d8aaa1
chore: update version script
david-luna Nov 13, 2024
629f866
chore: update version script
david-luna Nov 14, 2024
174d218
Merge branch 'main' into remove-lerna
david-luna Nov 18, 2024
23b7c71
Merge branch 'main' into remove-lerna
david-luna Nov 19, 2024
60400f0
Merge branch 'main' into remove-lerna
david-luna Nov 22, 2024
67723d6
Merge branch 'main' into remove-lerna
david-luna Nov 27, 2024
8972f4b
Merge branch 'main' into remove-lerna
david-luna Dec 2, 2024
05020c1
Merge branch 'main' into remove-lerna
david-luna Dec 4, 2024
0726e0c
Merge branch 'main' into remove-lerna
david-luna Dec 5, 2024
a60d5f4
chore: merge main
david-luna Jan 21, 2025
3887b70
chore: update package-lock.json
david-luna Jan 21, 2025
eae2663
Merge branch 'main' into remove-lerna
david-luna Jan 21, 2025
6f48e5b
chore: cleanup some scripts
david-luna Jan 21, 2025
1df01ae
chore: fix typo
david-luna Jan 21, 2025
d86b1f2
chore: update version script
david-luna Jan 22, 2025
ddf5b7f
chore: update version script
david-luna Jan 22, 2025
5e90af5
chore: update version script
david-luna Jan 22, 2025
6ee4863
chore: update version script
david-luna Jan 23, 2025
577d584
Merge branch 'main' into remove-lerna
david-luna Feb 3, 2025
c048ccd
Merge branch 'main' into remove-lerna
david-luna Feb 10, 2025
947a253
chore: update package-lock.json
david-luna Feb 10, 2025
a544ed3
Merge branch 'main' into remove-lerna
david-luna Mar 5, 2025
2433805
chore: update lock file
david-luna Mar 5, 2025
9d5e7e4
Merge branch 'main' into remove-lerna
david-luna Mar 19, 2025
96684c1
Merge branch 'main' into remove-lerna
david-luna Apr 3, 2025
534ed2a
chore: update deps
david-luna Apr 3, 2025
8dd6c23
Merge branch 'main' into remove-lerna
david-luna Apr 15, 2025
d48f9f9
Merge branch 'main' into remove-lerna
david-luna Apr 23, 2025
1eadc59
Merge branch 'main' into remove-lerna
david-luna May 19, 2025
b138e0d
chore: update package-lock
david-luna May 19, 2025
b1829bf
chore: upgrade lerna
david-luna May 19, 2025
a2ae0f1
chore: remove publish script
david-luna May 19, 2025
6e58cbf
chore: update comment
david-luna May 19, 2025
fee8a85
chore: update nx cache path
david-luna May 19, 2025
3a6b1dc
chore: update build cache path
david-luna May 19, 2025
1678af4
chore: set .nx as build artifact
david-luna May 19, 2025
022d36f
chore: update cache folder
david-luna May 19, 2025
057e093
chore: update cache folder
david-luna May 19, 2025
8900a76
chore: cleanup nx before downloading artifact
david-luna May 19, 2025
449fd3c
chore: use tar.gz file for build snapshots
david-luna May 19, 2025
302f079
chore: update paths
david-luna May 19, 2025
1de18b2
chore: fix caching in tav workflow
david-luna May 19, 2025
da0ce71
chore: add workflow logs
david-luna May 20, 2025
5d90ebc
chore: update build cache
david-luna May 20, 2025
a8f31d4
chore: fix path for build cache
david-luna May 20, 2025
3d3c1f8
chore: skip TAV for now
david-luna May 20, 2025
e45533c
chore: remove trailing slash
david-luna May 20, 2025
b5c182e
chore: use tar files for caching
david-luna May 20, 2025
e1c5799
chore: fix caching in workflows
david-luna May 20, 2025
8af5873
chore: use caching in browser tests
david-luna May 20, 2025
dc2ec97
Merge branch 'main' into dluna-upgrade-lerna
david-luna May 20, 2025
1b0560f
chore: remove usage of tar
david-luna May 20, 2025
1a6f774
chore: fixed download path
david-luna May 20, 2025
645054b
chore: remove comments and logs
david-luna May 20, 2025
f26493b
Update CONTRIBUTING.md
david-luna May 21, 2025
1773343
Update CONTRIBUTING.md
david-luna May 21, 2025
d8d8a71
Merge branch 'main' into dluna-upgrade-lerna
david-luna May 22, 2025
5525f8a
chore: add `setup:dev` script on each package
david-luna May 22, 2025
2e5b5ea
docs: fix lint issue
david-luna May 22, 2025
d76522c
Merge branch 'main' into dluna-upgrade-lerna
david-luna May 22, 2025
f655a20
Merge branch 'main' into dluna-upgrade-lerna
david-luna May 22, 2025
e49d69c
chore: update package-lock.json
david-luna May 22, 2025
3ebc8fb
chore: update package-lock.json
david-luna May 22, 2025
a0f5696
chore: run npm dedupe
david-luna May 22, 2025
8a79c9b
Update CONTRIBUTING.md
david-luna May 22, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/peer-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
run: npm ci

- name: Check API dependency semantics
run: npx lerna exec "node \$LERNA_ROOT_PATH/scripts/peer-api-check.js"
Copy link
Contributor Author

@david-luna david-luna May 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note for reviewer: there is no need to have lerna orchestrating this task since the script could iterate over the package folders that need API check

run: node ./scripts/peer-api-check.js
4 changes: 2 additions & 2 deletions .github/workflows/release-please-validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install lerna
run: npm install -g lerna@6.6.2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note to reviewer: the script check-release-please.mjs does not depend on lerna anymore. Making the install faster and reducing time in CI

- name: Install glob
run: npm install glob

- name: Ensure Release Please Config and Manifest are in sync with the repository
run: node scripts/check-release-please.mjs
2 changes: 1 addition & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:

# Release Please has already incremented versions and published tags, so we just
# need to publish all unpublished versions to npm here
# See: https://github.com/lerna/lerna/tree/main/commands/publish#bump-from-package
# See: https://github.com/lerna/lerna/tree/main/libs/commands/publish#bump-from-package
- name: Publish to npm
# only publish if a release has been created
if: ${{ steps.release.outputs.releases_created }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ docs

#lerna
.changelog
package.json.lerna_backup
.nx

# OS generated files
.DS_Store
Expand Down
23 changes: 23 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,29 @@ Some tests depend on other packages to be installed, so these steps are also req

Each of these commands can also be run in individual packages, as long as the initial install and compile are done first in the root directory.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it woudl be helpful to have a separate section header for this new focus thing.

If you're going to work on a single package and want to quickly jump into its development you can make use of the `focus` script. This scritp will run
the necessary tasks to have only that package ready for development saving time. For example, if you want to work with `@opentelemetry/resource-detector-aws`
run the following command in the root folder

```sh
npm run focus @opentelemetry/resource-detector-aws

> opentelemetry-contrib@0.1.0 focus
> nx run-many -t compile -p @opentelemetry/resource-detector-aws


✔ nx run @opentelemetry/instrumentation-fs:version:update (796ms)
✔ nx run @opentelemetry/contrib-test-utils:compile (3s)
✔ nx run @opentelemetry/instrumentation-fs:compile (3s)
✔ nx run @opentelemetry/resource-detector-aws:compile (3s)

———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

> NX Successfully ran target compile for project @opentelemetry/resource-detector-aws and 3 tasks it depends on (7s)
```

Once the command is done you can `cd` into the package and start using the usual commands.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(non-blocking) I'm not opposed to this command, but it would be kind of nice to not have to type out both (a) the package name and (b) the directory for that package.

Possible alternative:

cd detectors/node/opentelemetry-resource-detector-aws   # or whatever package to focus on
npm run compile:include-deps

Or perhaps others would find a command at the top-level more convenient? My personal typical development process is that I cd into the package dir I am working on and work from there. So an npm run ... script in that package dir would be convenient for me.

Copy link
Contributor Author

@david-luna david-luna May 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I was already removing scripts from each package.json I didn't want to add anything else. But I think its a fair point. At the end you have to cd into that directory to run the scripts there so it would be more convenient.

Checklist:

  • remove focus script
  • add setup:dev script in each package
  • update contributing.md: remove focus section
  • update contributing.md: rewrite compile at the top requirement


### CHANGELOG

The conventional commit type (in PR title) is very important to automatically bump versions on release. For instance:
Expand Down
17 changes: 7 additions & 10 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Decide on the next `major.minor.patch` release number based on [semver](http://s

- Use `npm install` command to initialize all package directories
- Use `lerna publish --skip-npm --no-git-tag-version --no-push` to bump the version in all `package.json`
- Use `npm run bootstrap` to generate latest `version.ts` files

## Use the Changelog to create a GitHub Release

Expand Down Expand Up @@ -90,18 +89,16 @@ Create a pull request titled `chore: x.y.z release proposal`. The commit body sh

Merge the PR, and pull the changes locally (using the commands in the first step). Ensure that `chore: x.y.z release proposal` is the most recent commit.

## Publish all packages
## Compile all packages

Go into each directory and use `npm publish` (requires permissions) to publish the package. You can use the following script to automate this.
Go into the root folder and run `npm ci && npm run compile` to build all packages with the latest version of the code.

```bash
#!/bin/bash
## Publish all packages

Use lerna's `publish` command to walk over all non private packages and publish the ones that has not been published yet.

for dir in $(ls packages); do
pushd packages/$dir
npm publish
popd
done
```sh
npx lerna publish from-package --no-push --no-private --no-git-tag-version --no-verify-access --yes
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note to reviewer: is this section used? I've updated but I think now all the releases are done via CI right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the whole RELEASING.md can be removed, or we can refer to the release-please workflow that basically handles all the releases now. 🙂

(In the 2.5 years I've been a maintainer, I've never needed to do a manual release in the contrib repo 🙂)

Copy link
Contributor

@trentm trentm May 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the top of this file:

For posterity, or in the event of any failures with release-please, the process for performing a manual release is below.

Given this gets out of date, it would possibly be better to drop it. I'd defer to @pichlermarc for an opinion on that as he does most of the releasing.

Update: Marc already gave an opinion on this above (#2836 (comment)).

```

Check your e-mail and make sure the number of “you’ve published this module” emails matches the number you expect.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"compile": "tsc --build tsconfig.json tsconfig.esm.json",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"prewatch": "npm run precompile",
"prepublishOnly": "npm run compile",
"test": "nyc mocha 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"compile": "tsc --build tsconfig.json tsconfig.esm.json",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"prewatch": "npm run precompile",
"prepublishOnly": "npm run compile",
"test": "nyc mocha 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"compile": "tsc --build tsconfig.json tsconfig.esm.json",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"prewatch": "npm run precompile",
"prepublishOnly": "npm run compile",
"test": "nyc mocha 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"compile": "tsc --build tsconfig.json tsconfig.esm.json",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"prewatch": "npm run precompile",
"prepublishOnly": "npm run compile",
"test": "nyc mocha 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"compile": "tsc --build tsconfig.json tsconfig.esm.json",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"prewatch": "npm run precompile",
"prepublishOnly": "npm run compile",
"test": "nyc mocha 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"compile": "tsc --build tsconfig.json tsconfig.esm.json",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"prewatch": "npm run precompile",
"prepublishOnly": "npm run compile",
"test": "nyc mocha 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"compile": "tsc --build tsconfig.json tsconfig.esm.json",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"prewatch": "npm run precompile",
"prepublishOnly": "npm run compile",
"test": "nyc mocha 'test/**/*.test.ts'",
"tdd": "npm run test -- --watch-extensions ts --watch",
Expand Down
2 changes: 0 additions & 2 deletions incubator/opentelemetry-sampler-aws-xray/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
"compile": "tsc -p .",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"precompile": "tsc --version && lerna run version:update --scope @opentelemetry/sampler-aws-xray --include-dependencies",
"prewatch": "npm run precompile",
"clean": "tsc --build --clean tsconfig.json tsconfig.esm.json",
"prepublishOnly": "npm run compile",
"tdd": "npm run test -- --watch-extensions ts --watch",
Expand Down
1 change: 0 additions & 1 deletion metapackages/auto-configuration-propagators/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"compile": "tsc -p .",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"prewatch": "npm run precompile",
"prepublishOnly": "npm run compile",
"tdd": "npm run test -- --watch-extensions ts --watch",
"test": "nyc mocha 'test/**/*.ts'",
Expand Down
1 change: 0 additions & 1 deletion metapackages/auto-instrumentations-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"compile": "tsc -p .",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"prewatch": "npm run precompile",
"prepublishOnly": "npm run compile",
"tdd": "yarn test -- --watch-extensions ts --watch",
"test": "nyc mocha 'test/**/*.ts'",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function runWithRegister(path: string): PromiseWithChild<{
env: Object.assign({}, process.env, {
OTEL_TRACES_EXPORTER: 'console',
OTEL_LOG_LEVEL: 'debug',
// nx (used by lerna run) defaults `FORCE_COLOR=true`, which in
// nx defaults `FORCE_COLOR=true`, which in
// node v18.17.0, v20.3.0 and later results in ANSI color escapes
// in the ConsoleSpanExporter output that is checked below.
FORCE_COLOR: '0',
Expand Down
1 change: 0 additions & 1 deletion metapackages/auto-instrumentations-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"prewatch": "npm run precompile",
"prepublishOnly": "npm run compile",
"test:browser": "nyc karma start --single-run",
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json"
Expand Down
5 changes: 5 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
"{projectRoot}/build"
]
},
"watch": {
"dependsOn": [
"compile"
]
},
"lint": {
"inputs": [
"{projectRoot}/src/**/*.ts",
Expand Down
Loading
Loading