mirror-cockpit-project-cockpit/tools
Jelle van der Waa 618473f951 package.json: Switch to markdown-to-jsx
The PackageKit UpdateDetail signal provides markdown in the
`update_text` and uses remarkable to parse the markdown contents.

Remarkable however has not been updated since 6 years, additionally it
requires us to use `dangerouslySetInnerHTML` which can lead to XSS
issues.

The npm ecosystem has two other markdown alternatives `react-markdown`
and a `markdown-to-jsx`. The latter has zero dependencies while
`react-markdown` has eleven and requires additional plugins like
`rehype-external-links` to add a rel/target to external links.

https://www.freedesktop.org/software/PackageKit/gtk-doc/Transaction.html
https://github.com/jonschlinkert/remarkable/issues/438
2026-10-09 15:43:36 +02:00
..
apparmor.d tools: Add AppArmor profile for cockpit-desktop 2024-03-12 16:14:27 +01:00
arch tools: drop glib-networking runtime dep from packaging 2026-01-29 21:02:59 +01:00
debian debian: Add PSF-2.0 license to copyright.template 2026-09-02 11:37:07 +03:00
mock-build-env packit: Re-enable and fix dist build 2021-05-06 20:48:46 +02:00
vulture_suppressions pytests: update fixtures to not use deprecated event_loop 2025-06-26 15:15:27 +02:00
adjust-distdir-timestamps build: rip out automated version history 2022-09-23 11:26:56 +02:00
build-debian-copyright build-debian-copyright: Don't top-level merge packages with differing licenses 2026-02-03 14:36:57 +01:00
cockpit.debian.pam tools: Fix pam_listfile PAM stage 2024-03-15 11:45:09 +01:00
cockpit.pam tools: Fix pam_listfile PAM stage 2024-03-15 11:45:09 +01:00
cockpit.spec spec: networkmanger description line is too long 2026-09-01 09:50:30 +02:00
cockpit.suse.pam tools: Add opensuse specific cockpit.pam file 2025-07-09 12:28:23 +02:00
escape-to-c tools/escape-to-c: drop a superfluous f-string 2022-01-13 18:27:40 +01:00
fix-spec tools/fix-spec: use word boundry for version number replacement 2026-04-16 10:59:54 +02:00
git-hook-post-commit test: Move static-code into common/ 2024-12-05 14:23:20 +01:00
git-hook-pre-push test: Move git hook scripts to tools/ 2022-06-23 11:12:30 +02:00
git-hook-pre-rebase tools: add git-hook-pre-rebase 2022-02-14 13:55:50 +01:00
glib.supp bridge: Fix valgrind memory leak in bridge's signal handler 2019-09-17 15:45:55 +02:00
make-debs REUSE: Convert license headers to SPDX format 2026-02-04 10:24:11 +01:00
make-dist doc: Prebundle docs on RHEL & CentOS 2026-01-08 13:02:15 +01:00
make-rpms REUSE: Convert license headers to SPDX format 2026-02-04 10:24:11 +01:00
make-sysext make-sysext: don't enable -Werror 2026-02-26 19:33:09 +01:00
Makefile-tools.am tools: Add AppArmor profile for cockpit-desktop 2024-03-12 16:14:27 +01:00
Makefile.redirect tools: Allow 'make dist' from srcdir to work 2016-11-09 16:17:29 +01:00
node-modules package.json: Switch to markdown-to-jsx 2026-10-09 15:43:36 +02:00
patch-metainfo flatpak: preserve xml declaration in installed metainfo 2022-11-09 16:08:07 +01:00
README.dist Update documentation and comments to not be webpack specific 2023-03-22 08:07:00 +01:00
README.node_modules.md tools: Rename README.node_modules to Markdown 2024-06-24 12:49:18 +02:00
release build: Create node runtime tarball as part of "make dist" 2025-12-08 11:47:47 +01:00
urls-check urls-check: avoid using 'task' from bots 2026-06-02 15:46:31 +02:00
webpack-make.js test: apply eslint to .js files as well 2023-10-27 13:42:46 +02:00
webpack-watch lib, tools: Rename JS tool executables to *.js 2023-02-17 19:17:02 +01:00

Cockpit Javascript Dependencies

Cockpit uses Node.js and the npm package manager to build its code and run browser integration tests. These are not used at runtime or when building/installing from a release tarball.

package.json has two npmjs package lists: runtime dependencies like PatternFly or React which are included into Cockpit's pages and run in the browser; and devDependencies like esbuild or linters which are only used at build/test time.

Git builds

When building from Git, the node_modules/ directory is managed as a git submodule from the node-cache repository in the same project as the main repository (ie: cockpit-project/node-cache). That means that normal builds won't need to run npm install. Checking out the correct version of the node_modules directory is managed by the script tools/node-modules, which is automatically invoked from the build system on an as-needed basis, and has good caching. You can also do a recursive git checkout, if you'd prefer to build in a no-network environment, but you'll lose the caching benefits.

The gitlink for node_modules/ is always kept in sync with the package.json file used to fetch that set of modules with npm install.

Making changes

If you modify package.json, the node_modules will need to be regenerated, and a new commit recorded. That can be managed locally by running

tools/node_modules install

which will produce a commit which is available for local testing.

When you are ready to open a pull request with your changes, push the newly created node_modules commit to the cache by running

tools/node_modules push

Then create a pull request with your package.json and node_modules changes.

Each pull request runs the reposchutz workflow to ensure that the branch is consistent wrt. package.json and node_modules/. This is purely read-only and does not need any secrets.

GitHub setup notes (documentation for project admins)

This section documents the way to setup the node-cache repository on GitHub. All projects in the cockpit-project organization share the same repository.

Each project's "release" and "dependabot" workflows need write access to the node-cache repository for taggging releases or rebuilding node_modules/ respectively. These happen via workflow environments, whose deploy keys are set up in bot's setup-deploy-keys script.

For other projects/orgs or forks, you can create a node-cache repository from scratch manually (unless you want to fork/re-use setup-deploy-keys):

  • create the node-cache repository under the same project as the main repository (or fork it)
  • add a commit to that repository with a README. At least one commit on a named branch needs to be present in order for the GitHub web UI to function properly (eg: generate diffs, show tree contents, etc.)
  • generate an SSH key locally, without a passphrase, without touching the disk: ssh-keygen -t ed25519 -C 'node-cache deploy' -f "${XDG_RUNTIME_DIR}/deploy-key" -N ''
  • create an environment called node-cache upload in the "environments" settings of the primary repository.
  • add the content of the private key deploy-key to the node-cache upload environment as a secret with the name NODE_CACHE_DEPLOY_KEY
  • upload the public key deploy-key.pub as a deploy key to node-cache with write access enabled: https://github.com/cockpit-project/node-cache/settings/keys/new
  • destroy the local copy: rm ${XDG_RUNTIME_DIR}/deploy-key*