Skip to content

Conversation

@christoph-jerolimov
Copy link
Member

@christoph-jerolimov christoph-jerolimov commented Nov 3, 2024

Hey, I just made a Pull Request!

  • This PR adds a new backend plugin to fetch npm packages from custom registries or from npmjs.com with an auth token.
  • For that I moved the fetch code into a common package. Incl. the annotations and some utils like isNpmPackage
  • Updated the readme and added some techdocs to the plugin. Fyi: I linked the README and docs from the plugins so that we have just one source in the root of the workspace.

The included backstage app contains catalog examples for npmjs and GitHub. Also if the GitHub example is public, it requires an authtoken and an app-config.local.yaml like this:

npm:
  defaultRegistry: npmjs
  registries:
    - name: npmjs
      url: https://registry.npmjs.com
    - name: github
      url: https://npm.pkg.github.com
      token: ghp_....

Catalog entities can reference this registries with a new annotation:

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: github-packages-examples
  annotations:
    npm/registry: github
    npm/package: '@github-packages-examples/npm-publish'
...

The GitHub example looks then like this:

http://localhost:3000/catalog/default/component/github-packages-examples

image

The local backstage incl. a catalog entity for the tech docs:

http://localhost:3000/docs/default/component/backstage-plugin-npm

image

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)
  • All your commits have a Signed-off-by line in the message. (more info)

@backstage-goalie
Copy link
Contributor

Thanks for the contribution!
All commits need to be DCO signed before they are reviewed. Please refer to the the DCO section in CONTRIBUTING.md or the DCO status for more info.

@backstage-goalie
Copy link
Contributor

backstage-goalie bot commented Nov 3, 2024

Changed Packages

Package Name Package Path Changeset Bump Current Version
app-next workspaces/npm/packages/app-next none v0.0.0
backend workspaces/npm/packages/backend none v0.0.0
@backstage-community/plugin-npm-backend workspaces/npm/plugins/npm-backend minor v1.1.0
@backstage-community/plugin-npm-common workspaces/npm/plugins/npm-common minor v1.1.0
@backstage-community/plugin-npm workspaces/npm/plugins/npm minor v1.1.0

@christoph-jerolimov christoph-jerolimov self-assigned this Nov 3, 2024
@christoph-jerolimov christoph-jerolimov force-pushed the add-npm-backend branch 8 times, most recently from 7d08a0d to 414cc3b Compare November 7, 2024 23:28
@github-actions
Copy link
Contributor

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

@github-actions github-actions bot added the stale label Nov 22, 2024
@github-actions github-actions bot closed this Nov 29, 2024
@github-actions github-actions bot removed the stale label Jan 9, 2025
@christoph-jerolimov christoph-jerolimov force-pushed the add-npm-backend branch 4 times, most recently from efde1e6 to 18089d0 Compare January 10, 2025 09:02
@christoph-jerolimov christoph-jerolimov marked this pull request as ready for review January 10, 2025 09:05
@christoph-jerolimov christoph-jerolimov requested review from a team and ciiay as code owners January 10, 2025 09:05
@christoph-jerolimov christoph-jerolimov force-pushed the add-npm-backend branch 2 times, most recently from da752d3 to 855fd41 Compare January 10, 2025 13:24
Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com>
@christoph-jerolimov
Copy link
Member Author

@karthikjeeyar @awanlin I finally got the backend plugin into a state where I'm mostly happy. And kind of feedback is very welcome. :)

…is loaded from GitLab

Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com>
Copy link
Contributor

@awanlin awanlin left a comment

Choose a reason for hiding this comment

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

This looks good to me @christoph-jerolimov, as mentioned previously let's try out the pattern you've got for the README files and see how it works once published to NPM.

Going to approve but leave the merging to you. 👍

@christoph-jerolimov christoph-jerolimov merged commit 2816eb6 into backstage:main Jan 14, 2025
12 checks passed
@christoph-jerolimov christoph-jerolimov deleted the add-npm-backend branch January 14, 2025 17:07
@christoph-jerolimov
Copy link
Member Author

@awanlin it didn't worked. 😞

https://github.com/backstage/community-plugins/actions/runs/12773015777/job/35604234982

Sorry that I didn't tried yarn pack... I will take care of that later with a follow-up PR.

@awanlin
Copy link
Contributor

awanlin commented Jan 14, 2025

No worries, I think it was good that we gave this a try and now we know it won't work. 👍

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.

2 participants