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

Use npm list to get the version of elastic-apm-node #228

Merged
merged 1 commit into from
Apr 26, 2024

Conversation

reakaleek
Copy link
Member

No description provided.

@reakaleek reakaleek requested a review from v1v April 26, 2024 08:41
@reakaleek reakaleek self-assigned this Apr 26, 2024
@reakaleek reakaleek requested a review from a team April 26, 2024 08:43
@reakaleek reakaleek merged commit ea5fb3f into elastic:main Apr 26, 2024
4 checks passed
@reakaleek reakaleek deleted the feature/fix-create-tag-workflow branch April 26, 2024 08:55
@trentm
Copy link
Member

trentm commented Apr 26, 2024

Why this change? What problem was being solved here?

@v1v
Copy link
Member

v1v commented Apr 26, 2024

vnull

image
$ jq -r '.dependencies."elastic-apm-node".version' package-lock.json
null

@trentm
Copy link
Member

trentm commented Apr 26, 2024

Okay, thanks.

It looks like this commit changed the package-lock.json lockfileVersion:

commit 03a52ab96be71449e22243ce3a491cb45c967b10
Author: apmmachine <58790750+apmmachine@users.noreply.github.com>
Date:   2023-11-27T14:55:13-08:00 (5 months ago)

    Bump elastic-apm-node to latest version (#210)


diff --git a/package-lock.json b/package-lock.json
index 41f60b9..ba203d0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,46 +1,85 @@
 {
   "name": "opbeans-node",
   "version": "1.0.0",
-  "lockfileVersion": 1,
+  "lockfileVersion": 3,
   "requires": true,

A possible alternative to doing the npm ci would be to use npm ls with the --package-lock-only option. From npm help ls:

   package-lock-only

       •   Default: false

       •   Type: Boolean

       If set to true, the current operation will only use the package-lock.json, ignoring node_modules.

       For update this means only the package-lock.json will be updated, instead of checking node_modules and downloading dependencies.

       For list this means the output will be based on the tree described by the package-lock.json, rather than the contents of
       node_modules.

This is a subtle usage that I only happened upon earlier this year.

% npm ls --package-lock-only elastic-apm-node --json
{
  "version": "1.0.0",
  "name": "opbeans-node",
  "dependencies": {
    "elastic-apm-node": {
      "version": "4.5.2",
      "resolved": "https://registry.npmjs.org/elastic-apm-node/-/elastic-apm-node-4.5.2.tgz",
      "overridden": false
    }
  }
}

% npm ls --package-lock-only elastic-apm-node --json  | jq -r '.dependencies."elastic-apm-node".version'
4.5.2

The npm ci step is >90% of the time spent on the "create-tag" workflow, so that would be a nice win.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants