69 Commits

Author SHA1 Message Date
John McLear
aee356ab76
fix: use atomic git push in plugin npmpublish workflow (#7494)
The plugin publish workflow ran `git push --follow-tags` after `pnpm
version patch`. `--follow-tags` is non-atomic per ref: if a concurrent
publish run won the race, the branch fast-forward would be rejected
but the tag push would still land — leaving a dangling `vN+1` tag with
no matching version-bump commit on the branch. Every subsequent push
would then fail forever with `npm error fatal: tag 'vN+1' already
exists`, because `pnpm version patch` would re-derive the same tag
name from the unchanged `package.json`.

On 2026-04-08, a single churn day (badge fixes + Dependabot merges
firing back-to-back) put ~46 plugins into this state simultaneously.
Recovery required hand-bumping `package.json` past the dangling tag
on every affected repo, twice (a second wave appeared after the first
sweep finished, racing the next wave of publishes).

Fix: use `git push --atomic origin <branch> <tag>` so the branch
update and the tag update succeed or fail as a single server-side
transaction. A rejected branch push now also rejects the tag push,
the run aborts cleanly, and the next workflow tick can retry against
the up-to-date refs without leaving any orphaned tags.

Also derive the new tag name from `package.json` after the bump
(rather than parsing pnpm version's stdout, which has historically
varied) and pass it explicitly into the push.

Adds a backend regression test that asserts the workflow file uses
`--atomic`, does not contain a literal `git push --follow-tags`
command (ignoring the historical comment), and includes both the
branch ref and the freshly-bumped tag in the atomic push. The test
gates against accidental reverts.

This file is the source of truth that `bin/plugins/checkPlugin.ts`
propagates into every `ether/ep_*` plugin's `.github/workflows/`, so
the next `update-plugins` cron tick will roll the fix out across all
plugins automatically.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 12:38:41 +01:00
John McLear
7c3837891b
feat: migrate npm publish to OIDC trusted publishing (#7401) (#7490)
* feat: migrate npm publish to OIDC trusted publishing (#7401)

Replaces NPM_TOKEN-based publishing with npm Trusted Publishing over
OIDC for both etherpad-lite core and the shared plugin publish
template. Tokens no longer expire every 90 days; each publish
authenticates via a short-lived OIDC token issued to the GitHub
Actions runner.

Changes:

- bin/plugins/lib/npmpublish.yml: the reusable workflow propagated to
  every ether/ep_* plugin via the update-plugins cron. Now bumps Node
  to 22, upgrades npm to >=11.5.1, declares id-token: write, drops
  NODE_AUTH_TOKEN, and calls `npm publish --provenance --access public`
  directly (not via pnpm/gnpm wrappers, which obscure the npm CLI
  version requirement).

- bin/plugins/lib/test-and-release.yml: the parent workflow that calls
  npmpublish.yml as a reusable workflow. Top-level and release-job
  permissions now grant id-token: write so the OIDC token can flow
  into the called workflow.

- .github/workflows/releaseEtherpad.yml: core's own publish workflow
  for the ep_etherpad package. Same OIDC migration; keeps the gnpm
  install + rename steps but switches the final publish to npm.

- doc/npm-trusted-publishing.md: explains how trusted publishing
  works, the one-time per-package setup that has to happen on
  npmjs.com, requirements (Node 22.14+, npm 11.5.1+, cloud runners),
  and common errors.

The next update-plugins cron run will propagate the new template to
every plugin. Once that lands and the trusted publisher is configured
on npmjs.com per package, the NPM_TOKEN secret can be removed.

Closes #7401

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: add bin/setup-trusted-publishers.sh for bulk OIDC config (#7401)

Adds a script that automates the per-package trusted-publisher setup
that previously had to be done by clicking through npmjs.com once for
each of the 80+ ep_* plugins. Uses the new `npm trust github` CLI
(npm >= 11.5.1) so the whole org can be configured in one shot:

  npm login
  bin/setup-trusted-publishers.sh

The script:
- Discovers every non-archived ether/ep_* repo via `gh repo list`
- Maps ep_etherpad to the etherpad-lite repo / releaseEtherpad.yml,
  and every plugin to its same-named repo / test-and-release.yml
- Runs `npm trust github <pkg> --repository <org>/<repo> --file
  <workflow> --yes` for each package
- Supports --dry-run, --packages <comma list>, and --skip-existing
- Verifies npm >= 11.5.1 and that the user is logged in before doing
  anything destructive

Doc updated to feature the script as the recommended setup path,
with manual web-UI steps kept as a fallback.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: don't bump CI Node version to 22 for OIDC

npm 11.5.1 (the version that ships trusted publishing) actually
requires '^20.17.0 || >=22.9.0', not Node 22.14+. The npm docs
recommend Node 22 but only because that's what bundles a recent
enough npm — installing 'npm@latest' on top of Node 20.17+ works
just as well.

The repo already requires Node >= 20.0.0 in engines.node and the
setup-node@v6 'version: 20' input resolves to the latest 20.x
(currently 20.20+), which satisfies npm 11's range. Revert the CI
publish workflows from node-version: 22 back to 20 so this PR does
not raise the Node bar at all.

Doc updated to explain the actual constraint.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 17:38:23 +01:00
John McLear
0a76256075
Enable globstar in plugin backend-tests template (#7414)
* fix: re-apply retries: 0

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Enable globstar in backend-tests template for recursive test discovery

Without shopt -s globstar, bash ** doesn't recurse into subdirectories,
causing mocha to miss test files in paths like specs/api/exportHTML.ts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 22:01:29 +01:00
John McLear
09df1ce65f
Add pnpm update step to checkPlugin for dependency updates (#7404)
Run pnpm update on plugins during autofix to bump all dependencies
to their latest compatible versions, reducing dependabot noise and
keeping plugins current.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 10:26:48 +01:00
John McLear
a6d283a809
Fix plugin frontend-tests template: use dev mode not prod (#7402)
Prod mode enables rate limiting which causes frontend tests to fail
silently. Dev mode disables rate limiting for testing.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 03:21:43 +01:00
John McLear
0423477966
Fix/plugin workflow templates clean (#7399)
* Revert plugin workflow template changes

Reverts the following commits to replace with a single clean fix:
- e97e203d7 Fix backend-tests find pattern for versioned plugin paths
- 45fe8a310 Fix backend-tests find path for plugin test discovery
- 892c52ba2 Fix plugin backend-tests workflow pnpm 10 symlink error
- 7484d9ea6 Update deprecated GitHub Actions in plugin workflow templates

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Modernize plugin workflow templates for pnpm 10 and new plugin paths

- Bump actions/checkout v3 → v4, cache-apt-pkgs-action v1.4.2 → v1.6.0
- Replace pnpm link --global with pnpm run plugins i --path (fixes
  pnpm 10 "symlink path same as target" error)
- Fix backend test discovery: plugins install to src/plugin_packages/
  via live-plugin-manager, not node_modules/
- Run mocha directly from src/ against node_modules/ep_* symlinks
  so tests resolve correctly

Tested and verified on ep_table_of_contents.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 01:21:17 +01:00
John McLear
e97e203d76
Fix backend-tests find pattern for versioned plugin paths (#7398)
live-plugin-manager installs to src/plugin_packages/ep_name@version/,
not src/plugin_packages/ep_name/. Update the glob to match the
versioned directory format.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 00:52:44 +01:00
John McLear
45fe8a310e
Fix backend-tests find path for plugin test discovery (#7397)
plugins i --path installs to src/plugin_packages/, not node_modules/.
Update the find command to look in the correct location so backend
tests are actually discovered and run.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 00:47:21 +01:00
John McLear
892c52ba26
Fix plugin backend-tests workflow pnpm 10 symlink error (#7396)
Remove redundant pnpm link --global steps that conflict with
pnpm run plugins i --path on pnpm 10, causing "Symlink path is
the same as the target path" errors. The plugins i command handles
all linking internally via LinkInstaller.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 00:40:10 +01:00
John McLear
7484d9ea60
Update deprecated GitHub Actions in plugin workflow templates (#7395)
Bump actions/checkout v3 → v4 and awalsh128/cache-apt-pkgs-action v1.4.2 → v1.6.0
to fix CI failures caused by deprecated actions/upload-artifact v3 dependency.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 00:31:21 +01:00
SamTV12345
96ff4276e0 feat: fixed upgrade yml 2025-07-27 22:22:18 +02:00
SamTV12345
88862f0246 Fixed bin scripts. 2024-08-08 21:23:10 +02:00
SamTV12345
d6d636955c
Feat/bundle js (#6511)
* Added minify

* Added POC for browser

* Moved first js files to ts

* Fixed caret positioning

* Added support for plugins

* Fixed get undefined.

* Removed require of socketio, l10n, html10n and error reporter

* Added minify

* Added POC for browser

* Moved first js files to ts

* Fixed caret positioning

* Added support for plugins

* Fixed get undefined.

* Removed require of socketio, l10n, html10n and error reporter

* Fixed popup not showing

* Fixed timeslider

* Reworked paths

* Fixed loading

* Don't generate sources map in production mode

* Non working hmr

* Added live reloading.

* Fixed timeslider when hot reloading

* Removed eval

* Fixed.

* Fixed env

* Fixed frontend tests.

* Added minifying via lightningcss

* Added minify via esbuild

* Fixed diagnostic url

* Removed lightningcss

* Fixed types

* Fixed alias

* Fixed loadtest

* Fixed

* Fixed loading ep_font_color3

* Restructure windows build

* Fixed windows build

* Fixed pnpm lock

---------

Co-authored-by: SamTv12345 <samtv12345@samtv12345.com>
2024-07-18 08:51:30 +02:00
SamTV12345
27dab95113
Fixed documentation to be pnpm run plugins i for plugin installation (#6405) 2024-05-24 21:57:39 +02:00
SamTV12345
59b87e0631 Updated checkPlugin to work again and added updated workflow files. 2024-03-16 23:11:11 +01:00
SamTV12345
cb56ec0c17 Added test-and-release 2024-03-16 20:40:16 +01:00
SamTV12345
107598b4b3 Added updated workflow runners. 2024-03-16 20:38:05 +01:00
SamTV12345
65046a3ff2 Added node workspace. 2024-03-15 20:59:28 +01:00
SamTV12345
f9e3416d78 Ported bin folder to typescript. 2024-03-13 20:31:29 +01:00
SamTV12345
a768b322cf Updated pipeline templates. 2024-03-13 19:11:25 +01:00
JannikStreek
04063d664b
cleanup after workspace refactoring (#6174)
* fix bin folder and workflows as far its possible

cleanup of dockerfile

changed paths of scripts

add lock file

fix working directory for workflows

fix windows bin

fix travis (is travis used anyway?)

fix package refs

remove pnpm-lock file in root as these conflicts with the docker volume setup

optimize comments

use install again

refactor prod image call to run

fix --workspace can only be used inside a workspace

correct comment

try fix pipeline

try fix pipeline for upgrade-from-latest-release

install all deps

smaller adjustments

save

update dockerfile

remove workspace command

fix run test command

start repair latest release workflow

start repair latest release workflow

start repair latest release workflow

further repairs

* remove test plugin from docker compose
2024-02-21 21:50:11 +01:00
John McLear
2ea8ea1275 restructure: move bin/ and tests/ to src/
Also add symlinks from the old `bin/` and `tests/` locations to avoid
breaking scripts and other tools.

Motivations:

  * Scripts and tests no longer have to do dubious things like:

        require('ep_etherpad-lite/node_modules/foo')

    to access packages installed as dependencies in
    `src/package.json`.

  * Plugins can access the backend test helper library in a non-hacky
    way:

        require('ep_etherpad-lite/tests/backend/common')

  * We can delete the top-level `package.json` without breaking our
    ability to lint the files in `bin/` and `tests/`.

    Deleting the top-level `package.json` has downsides: It will cause
    `npm` to print warnings whenever plugins are installed, npm will
    no longer be able to enforce a plugin's peer dependency on
    ep_etherpad-lite, and npm will keep deleting the
    `node_modules/ep_etherpad-lite` symlink that points to `../src`.

    But there are significant upsides to deleting the top-level
    `package.json`: It will drastically speed up plugin installation
    because `npm` doesn't have to recursively walk the dependencies in
    `src/package.json`. Also, deleting the top-level `package.json`
    avoids npm's horrible dependency hoisting behavior (where it moves
    stuff from `src/node_modules/` to the top-level `node_modules/`
    directory). Dependency hoisting causes numerous mysterious
    problems such as silent failures in `npm outdated` and `npm
    update`. Dependency hoisting also breaks plugins that do:

        require('ep_etherpad-lite/node_modules/foo')
2021-02-04 17:15:08 -05:00
John McLear
0cc8405e9c Bump minimum required Node.js version to 10.17.0
This makes it possible to use fs.promises.
2021-01-30 17:00:40 -05:00
Richard Hansen
b02ab430fe Bump eslint-config-etherpad to 1.0.24 2021-01-29 01:10:58 -05:00
John McLear
2fdc737355
bugfix, lint and refactor all bin scripts (#4617)
* bugfix, lint and refactor all bin scripts

* for squash: throw Error(message) rather than log(message); throw Error()

* for squash: Exit non-0 on unhandled Promise rejection

Many of the recent lint changes have converted normal functions to
async functions, and an error thrown in an async function does not
cause Node.js to exit by default.

* for squash: fix `require()` paths

* for squash: remove erroneous `Object.keys()` call

* for squash: fix missing `continue` statements

* for squash: Fix HTTP method for deleteSession

* for squash: delete erroneous throw

Throw is only for errors, not successful completion.

* for squash: redo migrateDirtyDBtoRealDB.js to fix async bugs

* for squash: fix erroneous use of `for..of`

* for squash: Add line break between statements

* for squash: put closing paren on same line as last arg

* for squash: Move `log()` back up where it was

to minimize the diff to develop

* for squash: indentation fixes

* for squash: typo fix

* for squash: wrap long lines

* for squash: use `util.callbackify` to silence promise/no-callback-in-promise warning

* for squash: use double quotes to improve readability

Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2021-01-18 08:53:15 +00:00
Richard Hansen
481fa047e4 checkPlugin: Merge the autoupdate option into autofix 2021-01-11 08:51:04 +00:00
Richard Hansen
039c50de80 checkPlugin: Make autocommit imply autoupdate, autoupdate imply autofix 2021-01-11 08:51:04 +00:00
Richard Hansen
27df9df47f checkPlugin: Revise README.md 2021-01-11 08:51:04 +00:00
Richard Hansen
adb38d0d61 checkPlugin: Display a diff of the changes 2021-01-11 08:51:04 +00:00
Richard Hansen
6ccbe374d8 checkPlugin: Don't nuke node_modules/
`git add -A` will ignore `node_modules/` because it's in `.gitignore`.
2021-01-11 08:51:04 +00:00
Richard Hansen
5f2aaea255 checkPlugin: Use git to determine whether there were changes 2021-01-11 08:51:04 +00:00
Richard Hansen
9f4bcfb79b checkPlugin: Ensure that a peer dep for ep_etherpad-lite exists
Tweak the new `updateDeps()` function and use it to add the
`ep_etherpad-lite` dependency if it is missing.
2021-01-11 08:51:04 +00:00
Richard Hansen
42da976705 checkPlugin: Move dependency update logic to a generic function
This will make it possible to reuse the logic for `peerDependencies`.
2021-01-11 08:51:04 +00:00
Richard Hansen
747f323552 checkPlugin: Use absolute path when installing ep_etherpad-lite
This makes it possible to check plugins that were installed by
symlinking into `node_modules/` like this:

    git clone git@github.com:ether/etherpad-lite.git
    git clone git@github.com:ether/ep_example.git
    cd etherpad-lite
    npm i ep_example@file:../ep_example
    node ./bin/checkPlugin.js ep_example
2021-01-11 08:51:04 +00:00
Richard Hansen
b719affe6e checkPlugin: Unconditionally run npm install 2021-01-11 08:51:04 +00:00
Richard Hansen
bba47ea2df checkPlugin: Make sure package.json ends with a newline 2021-01-11 08:51:04 +00:00
Richard Hansen
bf8d55ab8e checkPlugin: New writePackageJson() convenience function 2021-01-11 08:51:04 +00:00
Richard Hansen
b3b9afa668 checkPlugin: Split dirty working directory check into two checks
Rather than check for modifications and untracked files in one
command, use two commands: one for modifications and one for untracked
files. This makes the error messages easier to understand, and it
allows us to include `git status`-like output in the modifications
error message.
2021-01-09 22:49:27 +00:00
Richard Hansen
6a13baf7d4 checkPlugin: Use --name-status for git diff-index
`--compact-sumary` is relatively new (v2.17.0), and I actually
intended to use `--name-status` anyway.
2021-01-09 22:49:27 +00:00
Richard Hansen
071cca1d48 checkPlugin: Don't create an empty commit 2021-01-09 08:05:31 +00:00
Richard Hansen
38ca0c52a6 checkPlugin: Add lots of Git sanity checks 2021-01-09 08:05:31 +00:00
Richard Hansen
1a9bfc8d4f checkPlugin: Don't capture stdout when unnecessary 2021-01-09 08:05:31 +00:00
Richard Hansen
102c01f723 checkPlugin: Move log messages where they make more sense 2021-01-09 08:05:31 +00:00
Richard Hansen
d816bb2b38 checkPlugin: New execSync() convenience function 2021-01-09 08:05:31 +00:00
Richard Hansen
a55dd73f2b Typo fix: checkPlugins.js -> checkPlugin.js 2021-01-08 19:02:55 -05:00
Richard Hansen
44118c0e7b checkPlugin: Refine installation of lint dependencies 2021-01-08 19:02:55 -05:00
Richard Hansen
a0d21f75c4 checkPlugin: Add missing lint dependency 2021-01-08 18:42:10 -05:00
Richard Hansen
6890bfada1 checkPlugin: Bump eslint, eslint-config-etherpad versions 2021-01-08 18:24:42 -05:00
Richard Hansen
ba1c468865 checkPlugin: Fix command-line argument parsing bug 2021-01-08 18:07:55 -05:00
John McLear
fd3004faad
checkPlugins: various minor updates (#4635)
Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2021-01-07 21:52:45 -05:00