ep_set_title_on_pad 0.6.38 → 0.6.40

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,7 +26,7 @@ jobs:
26
26
  with:
27
27
  repository: ether/etherpad-lite
28
28
  path: etherpad-lite
29
- - uses: pnpm/action-setup@v3
29
+ - uses: pnpm/action-setup@v6
30
30
  name: Install pnpm
31
31
  with:
32
32
  version: 10
@@ -15,7 +15,7 @@ jobs:
15
15
  uses: actions/checkout@v6
16
16
  with:
17
17
  repository: ether/etherpad-lite
18
- - uses: pnpm/action-setup@v3
18
+ - uses: pnpm/action-setup@v6
19
19
  name: Install pnpm
20
20
  with:
21
21
  version: 10
@@ -31,7 +31,7 @@ jobs:
31
31
  uses: actions/checkout@v6
32
32
  with:
33
33
  repository: ether/etherpad-lite
34
- - uses: pnpm/action-setup@v5
34
+ - uses: pnpm/action-setup@v6
35
35
  name: Install pnpm
36
36
  with:
37
37
  version: 10
@@ -59,12 +59,20 @@ jobs:
59
59
  [ "${NEW_COMMITS}" -gt 0 ] || exit 0
60
60
  git config user.name 'github-actions[bot]'
61
61
  git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
62
- pnpm i
62
+ pnpm i --frozen-lockfile
63
63
  # `pnpm version patch` bumps package.json, makes a commit, and creates
64
64
  # a `v<new-version>` tag. Capture the new tag name from package.json
65
65
  # rather than parsing pnpm's output, which has historically varied.
66
- pnpm version patch
67
- NEW_TAG="v$(node -p "require('./package.json').version")"
66
+ # Bump the patch component directly with Node. pnpm/action-setup@v6
67
+ # sometimes installs pnpm 11 pre-releases even when version: 10.x is
68
+ # requested (pnpm/action-setup#225); those pre-releases either skip
69
+ # the git commit/tag or reject --no-git-tag-version as unknown.
70
+ # Doing the bump in Node sidesteps both failure modes.
71
+ 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);")
72
+ NEW_TAG="v${NEW_VERSION}"
73
+ git add package.json
74
+ git commit -m "${NEW_TAG}"
75
+ git tag -a "${NEW_TAG}" -m "${NEW_TAG}"
68
76
  # CRITICAL: use --atomic so the branch update and the tag update
69
77
  # succeed (or fail) as a single transaction on the server. The old
70
78
  # `git push --follow-tags` was non-atomic per ref: if a concurrent
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # ep_set_title_on_pad
1
+ # Derive Pad Title from its First Line for Etherpad
2
2
 
3
- [![Publish Status](https://github.com/ether/ep_set_title_on_pad/workflows/Node.js%20Package/badge.svg)](https://github.com/ether/ep_set_title_on_pad/actions/workflows/test-and-release.yml)
3
+ [![Demo](demo.gif)](https://github.com/ether/ep_set_title_on_pad/actions/workflows/test-and-release.yml)
4
4
  [![Backend Tests Status](https://github.com/ether/ep_set_title_on_pad/actions/workflows/test-and-release.yml/badge.svg)](https://github.com/ether/ep_set_title_on_pad/actions/workflows/test-and-release.yml)
5
5
 
6
6
  Adds a title field to pads that updates in real time and is used as the export filename.
package/demo.gif ADDED
Binary file
package/demo.png ADDED
Binary file
package/ep.json CHANGED
@@ -11,7 +11,9 @@
11
11
  "handleMessage": "ep_set_title_on_pad/handleMessage",
12
12
  "eejsBlock_mySettings": "ep_set_title_on_pad/index",
13
13
  "exportFileName":"ep_set_title_on_pad/index",
14
- "clientVars": "ep_set_title_on_pad/handleMessage"
14
+ "clientVars": "ep_set_title_on_pad/handleMessage",
15
+ "padRemove": "ep_set_title_on_pad/index",
16
+ "padCopy": "ep_set_title_on_pad/index"
15
17
  }
16
18
  }
17
19
  ]
package/index.js CHANGED
@@ -20,3 +20,12 @@ exports.eejsBlock_mySettings = (hookName, args, cb) => {
20
20
  args.content += eejs.require('ep_set_title_on_pad/templates/settings.ejs');
21
21
  cb();
22
22
  };
23
+
24
+ exports.padRemove = async (hookName, {pad}) => {
25
+ await db.remove(`title:${pad.id}`);
26
+ };
27
+
28
+ exports.padCopy = async (hookName, {srcPad, dstPad}) => {
29
+ const title = await db.get(`title:${srcPad.id}`);
30
+ if (title) await db.set(`title:${dstPad.id}`, title);
31
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ep_set_title_on_pad",
3
3
  "description": "Set the title on a pad in Etherpad, also includes real time updates to the UI",
4
- "version": "0.6.38",
4
+ "version": "0.6.40",
5
5
  "license": "Apache-2.0",
6
6
  "author": "johnyma22 (John McLear) <john@mclear.co.uk>",
7
7
  "keywords": [
@@ -26,8 +26,8 @@
26
26
  },
27
27
  "devDependencies": {
28
28
  "eslint": "^8.57.1",
29
- "eslint-config-etherpad": "^4.0.4",
30
- "typescript": "^6.0.2"
29
+ "eslint-config-etherpad": "^4.0.5",
30
+ "typescript": "^6.0.3"
31
31
  },
32
32
  "scripts": {
33
33
  "lint": "eslint .",
@@ -0,0 +1,42 @@
1
+ 'use strict';
2
+
3
+ const assert = require('assert').strict;
4
+ const common = require('ep_etherpad-lite/tests/backend/common');
5
+ const padManager = require('ep_etherpad-lite/node/db/PadManager');
6
+ const DB = require('ep_etherpad-lite/node/db/DB');
7
+
8
+ const titleKey = (padId) => `title:${padId}`;
9
+
10
+ describe(__filename, function () {
11
+ before(async function () {
12
+ await common.init();
13
+ });
14
+
15
+ it('removes the title when the pad is removed (regression for #109)', async function () {
16
+ const padId = `title-rm-${common.randomString()}`;
17
+ const pad = await padManager.getPad(padId, '\n');
18
+ await DB.set(titleKey(padId), 'My Pad Title');
19
+ assert.equal(await DB.get(titleKey(padId)), 'My Pad Title');
20
+
21
+ await pad.remove();
22
+
23
+ // Different DB drivers return either null or undefined for missing keys.
24
+ assert(await DB.get(titleKey(padId)) == null);
25
+ });
26
+
27
+ it('copies the title when the pad is copied', async function () {
28
+ const srcId = `title-cp-src-${common.randomString()}`;
29
+ const dstId = `title-cp-dst-${common.randomString()}`;
30
+ const src = await padManager.getPad(srcId, '\n');
31
+ await DB.set(titleKey(srcId), 'Original Title');
32
+
33
+ await src.copy(dstId);
34
+
35
+ assert.equal(await DB.get(titleKey(dstId)), 'Original Title');
36
+
37
+ // cleanup
38
+ const dst = await padManager.getPad(dstId);
39
+ await src.remove();
40
+ await dst.remove();
41
+ });
42
+ });
package/screenshot.png DELETED
Binary file