From e441e75520f23f48d96d52c573254f9fc6b5cd6f Mon Sep 17 00:00:00 2001 From: NovemLinguae Date: Wed, 29 May 2024 08:07:10 -0700 Subject: [PATCH 1/8] fix monobook fixes #44 --- xfdcloser-src/App.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xfdcloser-src/App.js b/xfdcloser-src/App.js index a6e3c4c..9a8109f 100644 --- a/xfdcloser-src/App.js +++ b/xfdcloser-src/App.js @@ -70,7 +70,14 @@ import DiscussionView from "./Views/DiscussionView"; const showHide = $("#mw-content-text " + config.xfd.html.head).length > 1 && ShowHideTag.initialiseNewTag(); // Set up discussion object for each discussion - $(config.xfd.html.head + " > span.mw-headline") + let headings; + if ( mw.config.get( "skin" ) === "monobook" ) { + headings = config.xfd.html.head; + } else { + // vector, vector-2022, minerva + headings = config.xfd.html.head + " > span.mw-headline"; + } + $( headings ) .not(".XFDcloser-ignore") .each(function(index) { try { From 17dced4fd781b0ee06137ad7b0af28217c817c66 Mon Sep 17 00:00:00 2001 From: NovemLinguae Date: Sat, 1 Jun 2024 19:37:30 -0700 Subject: [PATCH 2/8] fix all old skins, not just monobook --- xfdcloser-src/App.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/xfdcloser-src/App.js b/xfdcloser-src/App.js index 9a8109f..ac3d43e 100644 --- a/xfdcloser-src/App.js +++ b/xfdcloser-src/App.js @@ -70,13 +70,18 @@ import DiscussionView from "./Views/DiscussionView"; const showHide = $("#mw-content-text " + config.xfd.html.head).length > 1 && ShowHideTag.initialiseNewTag(); // Set up discussion object for each discussion + const skin = mw.config.get( "skin" ); let headings; - if ( mw.config.get( "skin" ) === "monobook" ) { - headings = config.xfd.html.head; - } else { - // vector, vector-2022, minerva + switch ( skin ) { + case "vector": + case "vector-2022": + case "minerva": headings = config.xfd.html.head + " > span.mw-headline"; + break; + default: + headings = config.xfd.html.head; } + $( headings ) .not(".XFDcloser-ignore") .each(function(index) { From ccc2dd04097688c59c6592a303dc5f1feb1d5347 Mon Sep 17 00:00:00 2001 From: NovemLinguae Date: Sat, 1 Jun 2024 19:38:22 -0700 Subject: [PATCH 3/8] refactor --- xfdcloser-src/App.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xfdcloser-src/App.js b/xfdcloser-src/App.js index ac3d43e..0bdaa8a 100644 --- a/xfdcloser-src/App.js +++ b/xfdcloser-src/App.js @@ -70,9 +70,8 @@ import DiscussionView from "./Views/DiscussionView"; const showHide = $("#mw-content-text " + config.xfd.html.head).length > 1 && ShowHideTag.initialiseNewTag(); // Set up discussion object for each discussion - const skin = mw.config.get( "skin" ); let headings; - switch ( skin ) { + switch ( mw.config.get( "skin" ) ) { case "vector": case "vector-2022": case "minerva": From a91d0db104e060b11afee0c3c1a08fbd89f88625 Mon Sep 17 00:00:00 2001 From: NovemLinguae <79697282+NovemLinguae@users.noreply.github.com> Date: Sat, 1 Jun 2024 23:22:53 -1000 Subject: [PATCH 4/8] create continuous integration (#40) automatically run npm test for each pull request and commit --- .github/workflows/unit_tests.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/unit_tests.yml diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml new file mode 100644 index 0000000..da234ad --- /dev/null +++ b/.github/workflows/unit_tests.yml @@ -0,0 +1,15 @@ +name: Unit Tests + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: npm ci + - run: npm test From 82bf23377da9e43faf71bb213e4136adfc46fd5e Mon Sep 17 00:00:00 2001 From: NovemLinguae <79697282+NovemLinguae@users.noreply.github.com> Date: Sat, 1 Jun 2024 23:28:23 -1000 Subject: [PATCH 5/8] add linter to CI (#41) - create continuous integration for linter - move --fix out of the main `npm run lint` script. moved to `npm run lint:fix`. CI now runs `npm run lint`, and should not be changing any files, just checking --- .github/workflows/linter.yml | 15 +++++++++++++++ package.json | 10 +++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/linter.yml diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 0000000..6b94429 --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,15 @@ +name: Linter + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: npm ci + - run: npm run lint diff --git a/package.json b/package.json index 2432eba..c0cde74 100644 --- a/package.json +++ b/package.json @@ -10,11 +10,15 @@ "test:delay": "mocha --delay --require @babel/register --reporter list", "lint:es5": "jshint \"dist/loader-dev.js\" \"dist/loader-gadget.js\"", "lint:es5:dev": "jshint \"dist/loader-dev.js\"", - "lint:css": "stylelint \"styles-src/**/*.css\" --fix", - "lint:es6": "eslint \"xfdcloser-src/**/*.js\" \"test/*\" --fix", - "lint:bin": "eslint \"bin/*.js\" --fix --env node", + "lint:css": "stylelint \"styles-src/**/*.css\"", + "lint:es6": "eslint \"xfdcloser-src/**/*.js\" \"test/*\"", + "lint:bin": "eslint \"bin/*.js\" --env node", "lint": "npm run lint:es6 && npm run lint:es5 && npm run lint:css", "lint:dev": "npm run lint:es6 && npm run lint:es5:dev && npm run lint:css", + "lint:css:fix": "stylelint \"styles-src/**/*.css\" --fix", + "lint:es6:fix": "eslint \"xfdcloser-src/**/*.js\" \"test/*\" --fix", + "lint:bin:fix": "eslint \"bin/*.js\" --fix --env node", + "lint:fix": "npm run lint:es6:fix && npm run lint:bin:fix && npm run lint:css:fix", "globals:node": "concat-cli -f \"globals-src/comment.js\" \"globals-src/node.js\" -o \"globals.js\"", "globals:window": "concat-cli -f \"globals-src/comment.js\" \"globals-src/window.js\" -o \"globals.js\"", "build:loader:dev": "concat-cli -f \"loader-src/loader-dev-top.js.txt\" \"loader-src/loader-core.js.txt\" \"loader-src/loader-dev-bottom.js.txt\" -o dist/loader-dev.js", From 32c0442e0a5eaf675e2186d207d754451ae8cfd1 Mon Sep 17 00:00:00 2001 From: NovemLinguae <79697282+NovemLinguae@users.noreply.github.com> Date: Sat, 1 Jun 2024 23:30:03 -1000 Subject: [PATCH 6/8] `npm run build:dev` should build CSS (#46) Tried `npm run build:dev` when developing locally, and I was missing CSS files. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c0cde74..a2e5e7c 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "build:concat": "concat-cli -f \"core-comment-top.js\" dist/core.min.js \"core-comment-bottom.js\" -o dist/core-gadget.js", "build:css": "node bin/concatCss", "build": "npm run globals:window && npm run build:loader && npm run lint && npm run test:all && npm run build:css && npm run build:bundle && npm run build:minify && npm run build:concat", - "build:dev": "npm run globals:window && npm run build:loader:dev && npm run lint:dev && npm run test:all && npm run build:bundle ", + "build:dev": "npm run globals:window && npm run build:loader:dev && npm run lint:dev && npm run test:all && npm run build:css && npm run build:bundle ", "build:quickdev": "npm run globals:window && npm run build:loader:dev && npm run build:bundle " }, "author": { From 54689936ba2cb346741761ceb5058fcac76ab0e7 Mon Sep 17 00:00:00 2001 From: NovemLinguae <79697282+NovemLinguae@users.noreply.github.com> Date: Sat, 1 Jun 2024 23:30:55 -1000 Subject: [PATCH 7/8] readme: fix mentions of v3 (#43) v4 is already deployed --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 91cc490..19dc06e 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This is the source code for version 4 of the Wikipedia gadget [XFDcloser](https://en.wikipedia.org/wiki/Wikipedia:XFDcloser). ## Installation instructions and user guide -Will be available at [https://en.wikipedia.org/wiki/Wikipedia:XFDcloser](https://en.wikipedia.org/wiki/Wikipedia:XFDcloser). Currently, that page is for version 3. +Is available at [https://en.wikipedia.org/wiki/Wikipedia:XFDcloser](https://en.wikipedia.org/wiki/Wikipedia:XFDcloser). ## Repository structure - `bin\` contains scripts to run with node. To run, type `node bin\FILENAME` in the terminal (`.js` extensions are optional) @@ -65,7 +65,7 @@ On-wiki testing is conducted at the [Test Wikipedia](https://test.wikipedia.org/ 4. Run `node bin/server` in a terminal (in the directory where your local repistory is located) 5. Now when you visit the XFD log/discussion pages, the most recently built version of the script will be loaded. ### Testing deployment -1. Comment out or remove the code that load the development version from [your common.js](https://test.wikipedia.org/wiki/Special:MyPage/common.js) +1. Comment out or remove the code that loads the development version from [your common.js](https://test.wikipedia.org/wiki/Special:MyPage/common.js) 2. Ensure the XFDcloser gadget is enabled in your preferences. 3. Deploy to testwiki (see "Repository structure" section above for what goes where) 4. Set up mock XFD discussions. A development version of Twinkle is available as a gadget, and can be used to nominate pages for deletion. From a218ecae20273e3349950a7a71ab4d07253f2e23 Mon Sep 17 00:00:00 2001 From: NovemLinguae <79697282+NovemLinguae@users.noreply.github.com> Date: Sat, 1 Jun 2024 23:31:15 -1000 Subject: [PATCH 8/8] readme: improve manual testing section (#42) * readme: improve manual testing section * use npm run build, not npm run build:dev * back to `npm run build:dev`. i can fix the problem with it in package.json --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 19dc06e..b6bb79c 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ Is available at [https://en.wikipedia.org/wiki/Wikipedia:XFDcloser](https://en.w ## On-wiki testing On-wiki testing is conducted at the [Test Wikipedia](https://test.wikipedia.org/wiki/Main_Page) (testwiki). - Note that the `extendedconfirmed` permission does not exist there, so the gadget definition lines need to be adjusted accordingly when testing non-admin accounts. + ### Testing development version 1. Ensure the XFDcloser gadget is *not* enabled in your preferences. 2. Add code like the following to [your common.js](https://test.wikipedia.org/wiki/Special:MyPage/common.js): @@ -62,8 +63,11 @@ On-wiki testing is conducted at the [Test Wikipedia](https://test.wikipedia.org/ ``` 3. Set up mock XFD discussions. A development version of Twinkle is available as a gadget, and can be used to nominate pages for deletion. -4. Run `node bin/server` in a terminal (in the directory where your local repistory is located) -5. Now when you visit the XFD log/discussion pages, the most recently built version of the script will be loaded. +4. First time only: create the /dist/ folder so the build script doesn't throw an error. +5. Run `npm run build:dev`. +6. Run `node bin/server` in a terminal (in the directory where your local repistory is located). +7. Now when you visit the XFD log/discussion pages, the most recently built version of the script will be loaded. + ### Testing deployment 1. Comment out or remove the code that loads the development version from [your common.js](https://test.wikipedia.org/wiki/Special:MyPage/common.js) 2. Ensure the XFDcloser gadget is enabled in your preferences. @@ -87,6 +91,7 @@ A general overview of planned features: - [ ] Preferences, similar to Rater - [ ] Rename option for CfD, and possibly some other feature requests on WT:XFDC - [ ] Possibly add handling for closing requested moves + ### Roadmap - [ ] Complete the v4 rewrite - [ ] Get beta testers to try out the new version. Fix/adjust things as they get reported.