ep_table_of_contents 0.4.13 → 0.4.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,3 +9,7 @@ updates:
9
9
  schedule:
10
10
  interval: "daily"
11
11
  versioning-strategy: "increase"
12
+ ignore:
13
+ # typescript-eslint has no release that supports TypeScript 7 yet.
14
+ - dependency-name: "typescript"
15
+ versions: [">=7"]
@@ -27,15 +27,15 @@ jobs:
27
27
  uses: actions/checkout@v7
28
28
 
29
29
  - name: Initialize CodeQL
30
- uses: github/codeql-action/init@v4.39.4
30
+ uses: github/codeql-action/init@v4.39.5
31
31
  with:
32
32
  languages: ${{ matrix.language }}
33
33
  queries: +security-and-quality
34
34
 
35
35
  - name: Autobuild
36
- uses: github/codeql-action/autobuild@v4.39.4
36
+ uses: github/codeql-action/autobuild@v4.39.5
37
37
 
38
38
  - name: Perform CodeQL Analysis
39
- uses: github/codeql-action/analyze@v4.39.4
39
+ uses: github/codeql-action/analyze@v4.39.5
40
40
  with:
41
41
  category: "/language:${{ matrix.language }}"
@@ -7,13 +7,24 @@ jobs:
7
7
  lint:
8
8
  name: ESLint
9
9
  runs-on: ubuntu-latest
10
- # `eslint .` executes .eslintrc.cjs and every installed ESLint plugin, so
10
+ # `eslint .` executes eslint.config.mjs and every installed ESLint plugin, so
11
11
  # don't hand it the caller's contents:write / id-token:write token.
12
12
  permissions:
13
13
  contents: read
14
14
  steps:
15
15
  - name: Check out plugin repository
16
16
  uses: actions/checkout@v7
17
+ with:
18
+ path: plugin
19
+ # Only core's package.json is needed: its packageManager field sets the
20
+ # pnpm version, the same one the backend and frontend test workflows use.
21
+ - name: Check out Etherpad core's package.json
22
+ uses: actions/checkout@v7
23
+ with:
24
+ repository: ether/etherpad
25
+ path: core
26
+ sparse-checkout: /package.json
27
+ sparse-checkout-cone-mode: false
17
28
  - uses: actions/setup-node@v7
18
29
  name: Install Node.js
19
30
  with:
@@ -21,7 +32,9 @@ jobs:
21
32
  - uses: pnpm/action-setup@v6.1.1
22
33
  name: Install pnpm
23
34
  with:
24
- version: 10
35
+ # No `version:`: pnpm comes from core's packageManager, so it follows
36
+ # core and never clashes with a version input.
37
+ package_json_file: ./core/package.json
25
38
  run_install: false
26
39
  - name: Get pnpm store directory
27
40
  shell: bash
@@ -30,10 +43,12 @@ jobs:
30
43
  name: Setup pnpm cache
31
44
  with:
32
45
  path: ${{ env.STORE_PATH }}
33
- key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
46
+ key: ${{ runner.os }}-pnpm-store-${{ hashFiles('plugin/pnpm-lock.yaml') }}
34
47
  restore-keys: |
35
48
  ${{ runner.os }}-pnpm-store-
36
49
  - name: Install dependencies
50
+ working-directory: plugin
37
51
  run: pnpm install --ignore-scripts
38
52
  - name: Run ESLint
53
+ working-directory: plugin
39
54
  run: pnpm run lint
@@ -38,6 +38,9 @@ jobs:
38
38
  - uses: pnpm/action-setup@v6.1.1
39
39
  name: Install pnpm
40
40
  with:
41
+ # No `version:`: the core checkout above puts core's package.json at
42
+ # the workspace root, so pnpm comes from core's packageManager, like
43
+ # every other plugin workflow.
41
44
  run_install: false
42
45
  - name: Get pnpm store directory
43
46
  shell: bash
@@ -73,7 +76,13 @@ jobs:
73
76
  fi
74
77
  git config user.name 'github-actions[bot]'
75
78
  git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
76
- pnpm i --frozen-lockfile
79
+ # Not every plugin commits a pnpm-lock.yaml, and --frozen-lockfile
80
+ # fails outright without one.
81
+ if [ -f pnpm-lock.yaml ]; then
82
+ pnpm i --frozen-lockfile
83
+ else
84
+ pnpm i
85
+ fi
77
86
  # `pnpm version patch` bumps package.json, makes a commit, and creates
78
87
  # a `v<new-version>` tag. Capture the new tag name from package.json
79
88
  # rather than parsing pnpm's output, which has historically varied.
@@ -82,7 +91,28 @@ jobs:
82
91
  # requested (pnpm/action-setup#225); those pre-releases either skip
83
92
  # the git commit/tag or reject --no-git-tag-version as unknown.
84
93
  # Doing the bump in Node sidesteps both failure modes.
85
- NEW_VERSION=$(node -e "const fs=require('fs');const p=require('./package.json');const v=p.version.split('.');v[2]=String(Number(v[2])+1);p.version=v.join('.');fs.writeFileSync('./package.json',JSON.stringify(p,null,2)+'\n');console.log(p.version);")
94
+ # Same rules as `semver inc patch`: 1.2.3 -> 1.2.4, and a prerelease
95
+ # such as 1.2.3-beta.1 is released as 1.2.3. Splitting on dots and
96
+ # calling Number() on the patch part would give NaN for prereleases.
97
+ NEW_VERSION=$(node <<'EOF'
98
+ const fs = require('fs');
99
+ const p = require('./package.json');
100
+ // The regex from semver.org: no leading zeros, no empty identifiers.
101
+ const id = '(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)';
102
+ const m = new RegExp(
103
+ '^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)' +
104
+ `(-${id}(?:\\.${id})*)?` +
105
+ '(\\+[0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*)?$').exec(p.version);
106
+ if (m == null) {
107
+ console.error(`package.json version '${p.version}' is not valid semver`);
108
+ process.exit(1);
109
+ }
110
+ const patch = m[4] ? Number(m[3]) : Number(m[3]) + 1;
111
+ p.version = `${m[1]}.${m[2]}.${patch}`;
112
+ fs.writeFileSync('./package.json', `${JSON.stringify(p, null, 2)}\n`);
113
+ console.log(p.version);
114
+ EOF
115
+ ) || exit 1
86
116
  NEW_TAG="v${NEW_VERSION}"
87
117
  git add package.json
88
118
  git commit -m "${NEW_TAG}"
@@ -1,5 +1,11 @@
1
1
  name: Node.js Package
2
- on: [push]
2
+ on:
3
+ push:
4
+ # Invoked by automerge.yml after a Dependabot PR is merged. GitHub
5
+ # Actions doesn't fire on:push when the push is authored by GITHUB_TOKEN
6
+ # (the automerge action's only available identity), so without this
7
+ # dispatch trigger the release job never runs after auto-merges.
8
+ workflow_dispatch:
3
9
 
4
10
  # id-token: write must be granted here so the reusable npmpublish workflow
5
11
  # can request an OIDC token for npm trusted publishing.
@@ -0,0 +1,37 @@
1
+ import browser from 'eslint-config-etherpad/flat/browser.js';
2
+ import etherpad from 'eslint-config-etherpad/flat/plugin.js';
3
+
4
+ // The globals of the shared browser profile (browser, jQuery, ES2017).
5
+ const browserGlobals = Object.assign({}, ...browser.map((c) => c.languageOptions?.globals ?? {}));
6
+
7
+ export default [
8
+ {
9
+ // Third-party code, not linted.
10
+ ignores: ['static/js/scrollTo.js'],
11
+ },
12
+ ...etherpad,
13
+ {
14
+ // `globalThis` is standard in every runtime this plugin targets (Node >= 22
15
+ // and all supported browsers), but it is not in the environments that
16
+ // eslint-config-etherpad selects.
17
+ languageOptions: {globals: {globalThis: 'readonly'}},
18
+ },
19
+ {
20
+ // eslint-config-etherpad has no profile for Playwright specs: it lints
21
+ // `static/tests/**` as CommonJS mocha running under Node. These specs are
22
+ // ES modules that run in Playwright's runner, so give them their own
23
+ // parser options and globals.
24
+ files: ['static/tests/frontend-new/specs/**/*.js'],
25
+ languageOptions: {
26
+ ecmaVersion: 'latest',
27
+ sourceType: 'module',
28
+ globals: {...browserGlobals, $: 'readonly'},
29
+ },
30
+ rules: {
31
+ 'strict': ['error', 'never'],
32
+ 'n/no-missing-require': 'off',
33
+ 'n/no-unpublished-import': 'off',
34
+ 'mocha/no-exports': 'off',
35
+ },
36
+ },
37
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ep_table_of_contents",
3
- "version": "0.4.13",
3
+ "version": "0.4.14",
4
4
  "description": "View a table of contents for your pad",
5
5
  "author": {
6
6
  "name": "John McLear",
@@ -26,11 +26,11 @@
26
26
  "url": "https://etherpad.org/"
27
27
  },
28
28
  "dependencies": {
29
- "ep_plugin_helpers": "^0.6.9"
29
+ "ep_plugin_helpers": "^0.6.11"
30
30
  },
31
31
  "devDependencies": {
32
- "eslint": "^8.57.1",
33
- "eslint-config-etherpad": "^5.0.0",
32
+ "eslint": "^9.39.5",
33
+ "eslint-config-etherpad": "^5.0.4",
34
34
  "typescript": "~6.0.3"
35
35
  },
36
36
  "scripts": {
package/.eslintrc.cjs DELETED
@@ -1,34 +0,0 @@
1
- 'use strict';
2
-
3
- // This is a workaround for https://github.com/eslint/eslint/issues/3458
4
- require('eslint-config-etherpad/patch/modern-module-resolution');
5
-
6
- module.exports = {
7
- root: true,
8
- // `globalThis` is standard in every runtime this plugin targets (Node >= 22
9
- // and all supported browsers), but it is not in the `env`s that
10
- // eslint-config-etherpad selects.
11
- globals: {globalThis: 'readonly'},
12
- extends: 'etherpad/plugin',
13
- ignorePatterns: [
14
- '/static/js/scrollTo.js',
15
- ],
16
- overrides: [
17
- {
18
- // eslint-config-etherpad has no profile for Playwright specs: it lints
19
- // `static/tests/**` as CommonJS mocha running under Node. These specs are
20
- // ES modules that run in Playwright's runner, so give them their own
21
- // parser options and globals.
22
- files: ['static/tests/frontend-new/specs/**/*'],
23
- parserOptions: {ecmaVersion: 'latest', sourceType: 'module'},
24
- env: {browser: true, node: true},
25
- globals: {$: 'readonly'},
26
- rules: {
27
- strict: ['error', 'never'],
28
- 'n/no-missing-require': 'off',
29
- 'n/no-unpublished-import': 'off',
30
- 'mocha/no-exports': 'off',
31
- },
32
- },
33
- ],
34
- };