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

Support engines part #3

Closed
3 tasks done
GeoffreyParrier opened this issue Dec 28, 2024 · 0 comments · Fixed by #4
Closed
3 tasks done

Support engines part #3

GeoffreyParrier opened this issue Dec 28, 2024 · 0 comments · Fixed by #4
Labels
enhancement New feature or request

Comments

@GeoffreyParrier
Copy link
Contributor

GeoffreyParrier commented Dec 28, 2024

Clear and concise description of the problem

Related : @antfu/taze#146

Sumary: It could be nice to know if an update would support our version of node in taze, so it is needed to be handled by fast-npm-meta

Suggested solution

Because I am currently working on a PR, here is my current thinking and implementation (WIP).

Obviously if you see a better approach I can update this PR and the implementation is not final for now, so it is totally possible that it changes until release (I will keep this issue updated if that is the case).

  • A new route /engines/[...pkg]: See (1)
  • An update to /versions/[...pkg]:
    • Without change return like currently (to not break current implementations)
    • A new Option (query param): engines
      • append: (default) with or without that values append to the current object - See 2.i.a
      • concat: with this value replace the versions object with versionsEngines - See 2.i.b
  1. Engines route
    curl https://npm.antfu.dev/engines/vite
    {
      "name": "vite",
      "versionsEngines": {
        "0.6.1": {
          "node": ">=10.0.0"
        },
        "0.7.0": {
          "node": ">=10.0.0"
        },
        "0.8.0": {
          "node": ">=10.0.0"
        },
        "0.8.1": {
          "node": ">=10.0.0"
        }
        // ...
      },
      "lastSynced": 1735335830574
    }
  2. Versions routes - options
    1. engines
      1. engines or engines=append
        curl https://npm.antfu.dev/versions/vite?engines
        curl https://npm.antfu.dev/versions/vite?engines=append
        {
            /* ...
            "latest": "6.0.6"
          },
          "versions": [
            "0.1.0",
            "0.1.1",
            "0.1.2"
            // ...
          ],
          "versionsEngines": {
            "0.6.1": {
              "node": ">=10.0.0"
            },
            "0.7.0": {
              "node": ">=10.0.0"
            },
            "0.8.0": {
              "node": ">=10.0.0"
            }
            // ...
          },
          "time": {
          // ...
        }
      2. engines=concat
        curl https://npm.antfu.dev/versions/vite?engines=concat
        {
            /* ...
            "latest": "6.0.6"
          },
          "versions": {
            "0.6.1": {
              "node": ">=10.0.0"
            },
            "0.7.0": {
              "node": ">=10.0.0"
            },
            "0.8.0": {
              "node": ">=10.0.0"
            }
            // ...
          },
          "time": {
          // ...
        }

Alternative

I have considered to only update versions without any params and it worked but I think allowing developer to have a finer control is probably better.

Additional context

⚠️ This issue is still in WIP, I will update it as I work on fast-npm-meta and taze.

Validations

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

Successfully merging a pull request may close this issue.

1 participant