ep_performance_test_hooks 0.0.8 → 0.0.12

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.
@@ -1,6 +1,3 @@
1
- # You need to change lines 38 and 46 in case the plugin's name on npmjs.com is different
2
- # from the repository name
3
-
4
1
  name: "Backend tests"
5
2
 
6
3
  # any branch is useful for testing before a PR is submitted
@@ -17,6 +14,10 @@ jobs:
17
14
  runs-on: ubuntu-latest
18
15
 
19
16
  steps:
17
+ - uses: actions/setup-node@v2
18
+ with:
19
+ node-version: 12
20
+
20
21
  - name: Install libreoffice
21
22
  run: |
22
23
  sudo add-apt-repository -y ppa:libreoffice/ppa
@@ -30,22 +31,31 @@ jobs:
30
31
  repository: ether/etherpad-lite
31
32
 
32
33
  - name: Install all dependencies and symlink for ep_etherpad-lite
33
- run: bin/installDeps.sh
34
+ run: src/bin/installDeps.sh
34
35
 
35
- # clone this repository into node_modules/ep_plugin-name
36
36
  - name: Checkout plugin repository
37
37
  uses: actions/checkout@v2
38
38
  with:
39
- path: ./node_modules/${{github.event.repository.name}}
39
+ path: ./node_modules/__tmp
40
+
41
+ - name: Determine plugin name
42
+ id: plugin_name
43
+ run: |
44
+ cd ./node_modules/__tmp
45
+ npx -c 'printf %s\\n "::set-output name=plugin_name::${npm_package_name}"'
46
+
47
+ - name: Rename plugin directory
48
+ run: |
49
+ mv ./node_modules/__tmp ./node_modules/"${PLUGIN_NAME}"
50
+ env:
51
+ PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }}
40
52
 
41
53
  - name: Install plugin dependencies
42
54
  run: |
43
- cd node_modules/${{github.event.repository.name}}
55
+ cd ./node_modules/"${PLUGIN_NAME}"
44
56
  npm ci
57
+ env:
58
+ PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }}
45
59
 
46
- # configures some settings and runs npm run test
47
60
  - name: Run the backend tests
48
- run: tests/frontend/travis/runnerBackend.sh
49
-
50
- ##ETHERPAD_NPM_V=1
51
- ## NPM configuration automatically created using bin/plugins/updateAllPluginsScript.sh
61
+ run: cd src && npm test
@@ -0,0 +1,92 @@
1
+ # Publicly credit Sauce Labs because they generously support open source
2
+ # projects.
3
+ name: "frontend tests powered by Sauce Labs"
4
+
5
+ on: [push]
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+
11
+ steps:
12
+ - name: Generate Sauce Labs strings
13
+ id: sauce_strings
14
+ run: |
15
+ printf %s\\n '::set-output name=name::${{github.event.repository.name}} ${{ github.workflow }} - ${{ github.job }}'
16
+ printf %s\\n '::set-output name=tunnel_id::${{ github.run_id }}-${{ github.run_number }}-${{ github.job }}'
17
+
18
+ - uses: actions/setup-node@v2
19
+ with:
20
+ node-version: 12
21
+
22
+ - name: Check out Etherpad core
23
+ uses: actions/checkout@v2
24
+ with:
25
+ repository: ether/etherpad-lite
26
+
27
+ - name: Check out the plugin
28
+ uses: actions/checkout@v2
29
+ with:
30
+ path: ./node_modules/__tmp
31
+
32
+ - name: export GIT_HASH to env
33
+ id: environment
34
+ run: |
35
+ cd ./node_modules/__tmp
36
+ echo "::set-output name=sha_short::$(git rev-parse --short ${{ github.sha }})"
37
+
38
+ - name: Determine plugin name
39
+ id: plugin_name
40
+ run: |
41
+ cd ./node_modules/__tmp
42
+ npx -c 'printf %s\\n "::set-output name=plugin_name::${npm_package_name}"'
43
+
44
+ - name: Rename plugin directory
45
+ env:
46
+ PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }}
47
+ run: |
48
+ mv ./node_modules/__tmp ./node_modules/"${PLUGIN_NAME}"
49
+
50
+ - name: Install plugin dependencies
51
+ env:
52
+ PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }}
53
+ run: |
54
+ cd ./node_modules/"${PLUGIN_NAME}"
55
+ npm ci
56
+
57
+ # This must be run after setting up the plugin, otherwise npm will try to
58
+ # hoist common dependencies by removing them from src/node_modules and
59
+ # installing them in the top-level node_modules. As of v6.14.10, npm's hoist
60
+ # logic appears to be buggy, because it sometimes removes dependencies from
61
+ # src/node_modules but fails to add them to the top-level node_modules. Even
62
+ # if npm correctly hoists the dependencies, the hoisting seems to confuse
63
+ # tools such as `npm outdated`, `npm update`, and some ESLint rules.
64
+ - name: Install Etherpad core dependencies
65
+ run: src/bin/installDeps.sh
66
+
67
+ - name: Create settings.json
68
+ run: cp settings.json.template settings.json
69
+
70
+ - name: Disable import/export rate limiting
71
+ run: |
72
+ sed -e '/^ *"importExportRateLimiting":/,/^ *\}/ s/"max":.*/"max": 0/' -i settings.json
73
+
74
+ - name: Remove standard frontend test files
75
+ run: rm -rf src/tests/frontend/specs
76
+
77
+ - uses: saucelabs/sauce-connect-action@v1
78
+ with:
79
+ username: ${{ secrets.SAUCE_USERNAME }}
80
+ accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
81
+ tunnelIdentifier: ${{ steps.sauce_strings.outputs.tunnel_id }}
82
+
83
+ - name: Run the frontend tests
84
+ shell: bash
85
+ env:
86
+ SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
87
+ SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
88
+ SAUCE_NAME: ${{ steps.sauce_strings.outputs.name }}
89
+ TRAVIS_JOB_NUMBER: ${{ steps.sauce_strings.outputs.tunnel_id }}
90
+ GIT_HASH: ${{ steps.environment.outputs.sha_short }}
91
+ run: |
92
+ src/tests/frontend/travis/runner.sh
@@ -56,15 +56,22 @@ jobs:
56
56
  runs-on: ubuntu-latest
57
57
  steps:
58
58
  - uses: actions/checkout@v2
59
+ with:
60
+ fetch-depth: 0
59
61
  - uses: actions/setup-node@v1
60
62
  with:
61
63
  node-version: 12
62
64
  registry-url: https://registry.npmjs.org/
63
- - run: git config user.name 'github-actions[bot]'
64
- - run: git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
65
- - run: npm ci
66
- - run: npm version patch
67
- - run: git push --follow-tags
65
+ - name: Bump version (patch)
66
+ run: |
67
+ LATEST_TAG=$(git describe --tags --abbrev=0) || exit 1
68
+ NEW_COMMITS=$(git rev-list --count "${LATEST_TAG}"..) || exit 1
69
+ [ "${NEW_COMMITS}" -gt 0 ] || exit 0
70
+ git config user.name 'github-actions[bot]'
71
+ git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
72
+ npm ci
73
+ npm version patch
74
+ git push --follow-tags
68
75
  # `npm publish` must come after `git push` otherwise there is a race
69
76
  # condition: If two PRs are merged back-to-back then master/main will be
70
77
  # updated with the commits from the second PR before the first PR's
@@ -78,6 +85,3 @@ jobs:
78
85
  - run: npm publish
79
86
  env:
80
87
  NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
81
-
82
- ##ETHERPAD_NPM_V=2
83
- ## NPM configuration automatically created using bin/plugins/updateAllPluginsScript.sh
@@ -0,0 +1,135 @@
1
+ # Contributor Guidelines
2
+ (Please talk to people on the mailing list before you change this page, see our section on [how to get in touch](https://github.com/ether/etherpad-lite#get-in-touch))
3
+
4
+ ## Pull requests
5
+
6
+ * the commit series in the PR should be _linear_ (it **should not contain merge commits**). This is necessary because we want to be able to [bisect](https://en.wikipedia.org/wiki/Bisection_(software_engineering)) bugs easily. Rewrite history/perform a rebase if necessary
7
+ * PRs should be issued against the **develop** branch: we never pull directly into **master**
8
+ * PRs **should not have conflicts** with develop. If there are, please resolve them rebasing and force-pushing
9
+ * when preparing your PR, please make sure that you have included the relevant **changes to the documentation** (preferably with usage examples)
10
+ * contain meaningful and detailed **commit messages** in the form:
11
+ ```
12
+ submodule: description
13
+
14
+ longer description of the change you have made, eventually mentioning the
15
+ number of the issue that is being fixed, in the form: Fixes #someIssueNumber
16
+ ```
17
+ * if the PR is a **bug fix**:
18
+ * the first commit in the series must be a test that shows the failure
19
+ * subsequent commits will fix the bug and make the test pass
20
+ * the final commit message should include the text `Fixes: #xxx` to link it to its bug report
21
+ * think about stability: code has to be backwards compatible as much as possible. Always **assume your code will be run with an older version of the DB/config file**
22
+ * if you want to remove a feature, **deprecate it instead**:
23
+ * write an issue with your deprecation plan
24
+ * output a `WARN` in the log informing that the feature is going to be removed
25
+ * remove the feature in the next version
26
+ * if you want to add a new feature, put it under a **feature flag**:
27
+ * once the new feature has reached a minimal level of stability, do a PR for it, so it can be integrated early
28
+ * expose a mechanism for enabling/disabling the feature
29
+ * the new feature should be **disabled** by default. With the feature disabled, the code path should be exactly the same as before your contribution. This is a __necessary condition__ for early integration
30
+ * think of the PR not as something that __you wrote__, but as something that __someone else is going to read__. The commit series in the PR should tell a novice developer the story of your thoughts when developing it
31
+
32
+ ## How to write a bug report
33
+
34
+ * Please be polite, we all are humans and problems can occur.
35
+ * Please add as much information as possible, for example
36
+ * client os(s) and version(s)
37
+ * browser(s) and version(s), is the problem reproducible on different clients
38
+ * special environments like firewalls or antivirus
39
+ * host os and version
40
+ * npm and nodejs version
41
+ * Logfiles if available
42
+ * steps to reproduce
43
+ * what you expected to happen
44
+ * what actually happened
45
+ * Please format logfiles and code examples with markdown see github Markdown help below the issue textarea for more information.
46
+
47
+ If you send logfiles, please set the loglevel switch DEBUG in your settings.json file:
48
+
49
+ ```
50
+ /* The log level we are using, can be: DEBUG, INFO, WARN, ERROR */
51
+ "loglevel": "DEBUG",
52
+ ```
53
+
54
+ The logfile location is defined in startup script or the log is directly shown in the commandline after you have started etherpad.
55
+
56
+ ## General goals of Etherpad
57
+ To make sure everybody is going in the same direction:
58
+ * easy to install for admins and easy to use for people
59
+ * easy to integrate into other apps, but also usable as standalone
60
+ * lightweight and scalable
61
+ * extensible, as much functionality should be extendable with plugins so changes don't have to be done in core.
62
+ Also, keep it maintainable. We don't wanna end up as the monster Etherpad was!
63
+
64
+ ## How to work with git?
65
+ * Don't work in your master branch.
66
+ * Make a new branch for every feature you're working on. (This ensures that you can work you can do lots of small, independent pull requests instead of one big one with complete different features)
67
+ * Don't use the online edit function of github (this only creates ugly and not working commits!)
68
+ * Try to make clean commits that are easy readable (including descriptive commit messages!)
69
+ * Test before you push. Sounds easy, it isn't!
70
+ * Don't check in stuff that gets generated during build or runtime
71
+ * Make small pull requests that are easy to review but make sure they do add value by themselves / individually
72
+
73
+ ## Coding style
74
+ * Do write comments. (You don't have to comment every line, but if you come up with something that's a bit complex/weird, just leave a comment. Bear in mind that you will probably leave the project at some point and that other people will read your code. Undocumented huge amounts of code are worthless!)
75
+ * Never ever use tabs
76
+ * Indentation: JS/CSS: 2 spaces; HTML: 4 spaces
77
+ * Don't overengineer. Don't try to solve any possible problem in one step, but try to solve problems as easy as possible and improve the solution over time!
78
+ * Do generalize sooner or later! (if an old solution, quickly hacked together, poses more problems than it solves today, refactor it!)
79
+ * Keep it compatible. Do not introduce changes to the public API, db schema or configurations too lightly. Don't make incompatible changes without good reasons!
80
+ * If you do make changes, document them! (see below)
81
+ * Use protocol independent urls "//"
82
+
83
+ ## Branching model / git workflow
84
+ see git flow http://nvie.com/posts/a-successful-git-branching-model/
85
+
86
+ ### `master` branch
87
+ * the stable
88
+ * This is the branch everyone should use for production stuff
89
+
90
+ ### `develop`branch
91
+ * everything that is READY to go into master at some point in time
92
+ * This stuff is tested and ready to go out
93
+
94
+ ### release branches
95
+ * stuff that should go into master very soon
96
+ * only bugfixes go into these (see http://nvie.com/posts/a-successful-git-branching-model/ for why)
97
+ * we should not be blocking new features to develop, just because we feel that we should be releasing it to master soon. This is the situation that release branches solve/handle.
98
+
99
+ ### hotfix branches
100
+ * fixes for bugs in master
101
+
102
+ ### feature branches (in your own repos)
103
+ * these are the branches where you develop your features in
104
+ * If it's ready to go out, it will be merged into develop
105
+
106
+ Over the time we pull features from feature branches into the develop branch. Every month we pull from develop into master. Bugs in master get fixed in hotfix branches. These branches will get merged into master AND develop. There should never be commits in master that aren't in develop
107
+
108
+ ## Documentation
109
+ The docs are in the `doc/` folder in the git repository, so people can easily find the suitable docs for the current git revision.
110
+
111
+ Documentation should be kept up-to-date. This means, whenever you add a new API method, add a new hook or change the database model, pack the relevant changes to the docs in the same pull request.
112
+
113
+ You can build the docs e.g. produce html, using `make docs`. At some point in the future we will provide an online documentation. The current documentation in the github wiki should always reflect the state of `master` (!), since there are no docs in master, yet.
114
+
115
+ ## Testing
116
+
117
+ Front-end tests are found in the `src/tests/frontend/` folder in the repository.
118
+ Run them by pointing your browser to `<yourdomainhere>/tests/frontend`.
119
+
120
+ Back-end tests can be run from the `src` directory, via `npm test`.
121
+
122
+ ## Things you can help with
123
+ Etherpad is much more than software. So if you aren't a developer then worry not, there is still a LOT you can do! A big part of what we do is community engagement. You can help in the following ways
124
+ * Triage bugs (applying labels) and confirming their existence
125
+ * Testing fixes (simply applying them and seeing if it fixes your issue or not) - Some git experience required
126
+ * Notifying large site admins of new releases
127
+ * Writing Changelogs for releases
128
+ * Creating Windows packages
129
+ * Creating releases
130
+ * Bumping dependencies periodically and checking they don't break anything
131
+ * Write proposals for grants
132
+ * Co-Author and Publish CVEs
133
+ * Work with SFC to maintain legal side of project
134
+ * Maintain TODO page - https://github.com/ether/etherpad-lite/wiki/TODO#IMPORTANT_TODOS
135
+
package/LICENSE.md ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2021 John McLear
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ ![Publish Status](https://github.com/ether/ep_performance_test_hooks/workflows/Node.js%20Package/badge.svg) ![Backend Tests Status](https://github.com/ether/ep_performance_test_hooks/workflows/Backend%20tests/badge.svg)
2
+
1
3
  # Performance Test Hooks for Etherpad
2
4
 
3
5
  A plugin to get test data to help improve the performance of Etherpad.
package/package.json CHANGED
@@ -26,7 +26,7 @@
26
26
  "description": "Etherpad plugin to show performance stats in /stats url",
27
27
  "funding": {
28
28
  "type": "individual",
29
- "url": "http://etherpad.org/"
29
+ "url": "https://etherpad.org/"
30
30
  },
31
31
  "homepage": "https://github.com/ether/ep_performance_test_hooks#readme",
32
32
  "keywords": [
@@ -40,16 +40,17 @@
40
40
  "type": "git",
41
41
  "url": "git+https://github.com/ether/ep_performance_test_hooks.git"
42
42
  },
43
- "version": "0.0.8",
43
+ "version": "0.0.12",
44
44
  "devDependencies": {
45
- "eslint": "^7.18.0",
46
- "eslint-config-etherpad": "^1.0.23",
45
+ "eslint": "^7.32.0",
46
+ "eslint-config-etherpad": "^2.0.2",
47
47
  "eslint-plugin-eslint-comments": "^3.2.0",
48
- "eslint-plugin-mocha": "^8.0.0",
48
+ "eslint-plugin-mocha": "^9.0.0",
49
49
  "eslint-plugin-node": "^11.1.0",
50
50
  "eslint-plugin-prefer-arrow": "^1.2.3",
51
- "eslint-plugin-promise": "^4.2.1",
52
- "eslint-plugin-you-dont-need-lodash-underscore": "^6.10.0"
51
+ "eslint-plugin-promise": "^5.1.1",
52
+ "eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0",
53
+ "eslint-plugin-cypress": "^2.12.1"
53
54
  },
54
55
  "eslintConfig": {
55
56
  "root": true,
@@ -61,5 +62,8 @@
61
62
  "scripts": {
62
63
  "lint": "eslint .",
63
64
  "lint:fix": "eslint --fix ."
65
+ },
66
+ "engines": {
67
+ "node": ">=12.13.0"
64
68
  }
65
69
  }
@@ -30,8 +30,17 @@ exports.postAceInit = () => {
30
30
  }
31
31
 
32
32
  perf.performance = performance.getEntriesByType('navigation')[0];
33
- perf.loadTimes = getLoadTimes();
34
- perf.loadSizes = getSizeData();
33
+ perf.loadTimes = {};
34
+ perf.loadSizes = {};
35
+ // main window
36
+ perf.loadTimes.main = getLoadTimes(window.performance.getEntriesByType('resource'));
37
+ perf.loadSizes.main = getSizeData(performance.getEntriesByType('resource'));
38
+ // ace_outer
39
+ perf.loadTimes.outer = getLoadTimes(window[1].performance.getEntriesByType('resource'));
40
+ perf.loadSizes.outer = getSizeData(window[1].performance.getEntriesByType('resource'));
41
+ // ace_inner
42
+ perf.loadTimes.inner = getLoadTimes(window[1].frames[0].performance.getEntriesByType('resource'));
43
+ perf.loadSizes.inner = getSizeData(window[1].frames[0].performance.getEntriesByType('resource'));
35
44
  const myAuthorId = pad.getUserId();
36
45
  const padId = pad.getPadId();
37
46
  const message = {
@@ -44,8 +53,7 @@ exports.postAceInit = () => {
44
53
  pad.collabClient.sendMessage(message); // Send the chat position message to the server
45
54
  };
46
55
 
47
- const getLoadTimes = () => {
48
- const resources = performance.getEntriesByType('resource');
56
+ const getLoadTimes = (resources) => {
49
57
  const data = {};
50
58
 
51
59
  for (let i = 0; i < resources.length; i++) {
@@ -91,8 +99,7 @@ const getLoadTimes = () => {
91
99
  return data;
92
100
  };
93
101
 
94
- const getSizeData = () => {
95
- const list = performance.getEntriesByType('resource');
102
+ const getSizeData = (list) => {
96
103
  if (list === undefined) {
97
104
  return;
98
105
  }