ep_hide_line_numbers 0.0.50 → 0.0.52

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.
@@ -26,6 +26,10 @@ jobs:
26
26
  with:
27
27
  repository: ether/etherpad-lite
28
28
  path: etherpad-lite
29
+ - uses: actions/setup-node@v4
30
+ name: Install Node.js
31
+ with:
32
+ node-version: 22
29
33
  - uses: pnpm/action-setup@v6
30
34
  name: Install pnpm
31
35
  with:
@@ -15,6 +15,11 @@ jobs:
15
15
  uses: actions/checkout@v6
16
16
  with:
17
17
  repository: ether/etherpad-lite
18
+ path: etherpad-lite
19
+ - uses: actions/setup-node@v4
20
+ name: Install Node.js
21
+ with:
22
+ node-version: 22
18
23
  - uses: pnpm/action-setup@v6
19
24
  name: Install pnpm
20
25
  with:
@@ -32,63 +37,42 @@ jobs:
32
37
  restore-keys: |
33
38
  ${{ runner.os }}-pnpm-store-
34
39
  -
35
- name: Check out the plugin
40
+ name: Checkout plugin repository
36
41
  uses: actions/checkout@v6
37
42
  with:
38
- path: ./node_modules/__tmp
39
- -
40
- name: export GIT_HASH to env
41
- id: environment
42
- run: |
43
- cd ./node_modules/__tmp
44
- echo "::set-output name=sha_short::$(git rev-parse --short ${{ github.sha }})"
45
- -
46
- name: Determine plugin name
47
- id: plugin_name
48
- run: |
49
- cd ./node_modules/__tmp
50
- npx -c 'printf %s\\n "::set-output name=plugin_name::${npm_package_name}"'
51
- -
52
- name: Rename plugin directory
53
- env:
54
- PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }}
55
- run: |
56
- mv ./node_modules/__tmp ./node_modules/"${PLUGIN_NAME}"
57
- -
58
- name: Install plugin dependencies
59
- env:
60
- PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }}
61
- run: |
62
- cd ./node_modules/"${PLUGIN_NAME}"
63
- pnpm i
64
- # Etherpad core dependencies must be installed after installing the
65
- # plugin's dependencies, otherwise npm will try to hoist common
66
- # dependencies by removing them from src/node_modules and installing them
67
- # in the top-level node_modules. As of v6.14.10, npm's hoist logic appears
68
- # to be buggy, because it sometimes removes dependencies from
69
- # src/node_modules but fails to add them to the top-level node_modules.
70
- # Even if npm correctly hoists the dependencies, the hoisting seems to
71
- # confuse tools such as `npm outdated`, `npm update`, and some ESLint
72
- # rules.
43
+ path: plugin
73
44
  -
74
45
  name: Install Etherpad core dependencies
46
+ working-directory: ./etherpad-lite
75
47
  run: bin/installDeps.sh
48
+ - name: Install plugin
49
+ working-directory: ./etherpad-lite
50
+ run: |
51
+ pnpm run plugins i --path ../../plugin
76
52
  - name: Create settings.json
53
+ working-directory: ./etherpad-lite
77
54
  run: cp ./src/tests/settings.json settings.json
78
55
  - name: Run the frontend tests
56
+ working-directory: ./etherpad-lite
79
57
  shell: bash
80
58
  run: |
81
59
  pnpm run dev &
82
60
  connected=false
83
61
  can_connect() {
84
- curl -sSfo /dev/null http://localhost:9001/ || return 1
85
- connected=true
62
+ curl -sSfo /dev/null http://localhost:9001/ || return 1
63
+ connected=true
86
64
  }
87
65
  now() { date +%s; }
88
66
  start=$(now)
89
- while [ $(($(now) - $start)) -le 15 ] && ! can_connect; do
90
- sleep 1
67
+ while [ $(($(now) - $start)) -le 30 ] && ! can_connect; do
68
+ sleep 1
91
69
  done
92
70
  cd src
93
- pnpm exec playwright install chromium --with-deps
94
- pnpm run test-ui --project=chromium
71
+ pnpm exec playwright install chromium --with-deps
72
+ # Use the declared-disables helper instead of plain test-ui:
73
+ # ep.json declares `disables: ["@feature:line-numbers"]`, so the
74
+ # helper runs two passes — regression (everything not tagged
75
+ # @feature:line-numbers must pass) + honesty (every test
76
+ # tagged @feature:line-numbers must FAIL because the plugin
77
+ # genuinely keeps line numbers hidden). See doc/PLUGIN_FEATURE_DISABLES.md.
78
+ ../bin/run-frontend-tests-with-disables.sh -- --project=chromium
@@ -53,10 +53,21 @@ jobs:
53
53
  fetch-depth: 0
54
54
  -
55
55
  name: Bump version (patch)
56
+ id: bump
56
57
  run: |
57
58
  LATEST_TAG=$(git describe --tags --abbrev=0) || exit 1
58
59
  NEW_COMMITS=$(git rev-list --count "${LATEST_TAG}"..) || exit 1
59
- [ "${NEW_COMMITS}" -gt 0 ] || exit 0
60
+ # No new commits since the last tag → nothing to publish.
61
+ # Setting `bumped=false` lets the publish step below skip
62
+ # itself instead of trying to republish the existing version
63
+ # (which fails with "cannot publish over previously published
64
+ # versions"). Only manual `gh workflow run` invocations on a
65
+ # tag-current branch hit this path; on:push always sees ≥1
66
+ # new commit because the push event is what triggered us.
67
+ if [ "${NEW_COMMITS}" -le 0 ]; then
68
+ echo "bumped=false" >> "${GITHUB_OUTPUT}"
69
+ exit 0
70
+ fi
60
71
  git config user.name 'github-actions[bot]'
61
72
  git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
62
73
  pnpm i --frozen-lockfile
@@ -84,9 +95,11 @@ jobs:
84
95
  # rejects the tag push too, and the next workflow tick can retry
85
96
  # cleanly against the up-to-date refs.
86
97
  git push --atomic origin "${GITHUB_REF_NAME}" "${NEW_TAG}"
98
+ echo "bumped=true" >> "${GITHUB_OUTPUT}"
87
99
  # This is required if the package has a prepare script that uses something
88
100
  # in dependencies or devDependencies.
89
101
  -
102
+ if: steps.bump.outputs.bumped == 'true'
90
103
  run: pnpm i
91
104
  # `npm publish` must come after `git push` otherwise there is a race
92
105
  # condition: If two PRs are merged back-to-back then master/main will be
@@ -104,4 +117,5 @@ jobs:
104
117
  # whichever `npm` is on PATH; calling `npm` directly avoids any shim
105
118
  # ambiguity.
106
119
  - name: Publish to npm via OIDC
120
+ if: steps.bump.outputs.bumped == 'true'
107
121
  run: npm publish --provenance --access public
package/ep.json CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "disables": ["@feature:line-numbers"],
2
3
  "parts": [
3
4
  {
4
5
  "name": "hide_line_numbers",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ep_hide_line_numbers",
3
- "version": "0.0.50",
3
+ "version": "0.0.52",
4
4
  "keywords": [
5
5
  "line",
6
6
  "numbers",
@@ -1,5 +1,28 @@
1
1
  'use strict';
2
2
 
3
- exports.postAceInit = () => {
4
- pad.changeViewOption('showLineNumbers', false);
3
+ // Hide the line-number gutter without going through pad.changeViewOption.
4
+ //
5
+ // Earlier revisions called `pad.changeViewOption('showLineNumbers', false)`
6
+ // here, which works in isolation but has a nasty side-effect: core's
7
+ // changeViewOption reads pad.padOptions, applies the one key being
8
+ // changed, then re-runs setViewOptions for *all* options — falling
9
+ // back to defaults for anything not persisted to pad.padOptions.
10
+ //
11
+ // The URL parameter `?rtl=true` is set by core via
12
+ // `pad.changeViewOption('rtlIsTrue', true)` in pad.ts:postAceInit
13
+ // *before* our hook fires, but core's changeViewOption doesn't write
14
+ // rtlIsTrue back to pad.padOptions either — so when we later fire our
15
+ // own changeViewOption call, the rtl override is lost and the
16
+ // #options-rtlcheck checkbox flips back to unchecked.
17
+ //
18
+ // This broke rtl_url_param.spec.ts when ep_hide_line_numbers was
19
+ // installed (#7658 surfaced the line-numbers half of the problem; this
20
+ // is the other half).
21
+ //
22
+ // Fix: skip changeViewOption entirely. Tell ace directly + sync the
23
+ // settings checkbox. No cascade through setViewOptions, so other
24
+ // in-flight options (including the URL-derived rtl) are untouched.
25
+ exports.postAceInit = (hook, context) => {
26
+ context.ace.setProperty('showslinenumbers', false);
27
+ $('#options-linenoscheck').prop('checked', false);
5
28
  };
@@ -0,0 +1,13 @@
1
+ import {expect, test} from '@playwright/test';
2
+ import {getPadBody, goToNewPad} from 'ep_etherpad-lite/tests/frontend-new/helper/padHelper';
3
+
4
+ test.beforeEach(async ({page}) => {
5
+ await goToNewPad(page);
6
+ });
7
+
8
+ test.describe('ep_hide_line_numbers', () => {
9
+ test('pad loads with plugin installed', async ({page}) => {
10
+ const padBody = await getPadBody(page);
11
+ await expect(padBody).toBeVisible();
12
+ });
13
+ });