Skip to content

Commit

Permalink
refactor: event modernization and optimization (#2404)
Browse files Browse the repository at this point in the history
- Refactor methods names and functionality
- Replace scroll listeners with observers
- Replace Tweezer-based scrolling with native scroll methods
- Remove tweezer.js dependency
- Remove redundant method calls
- Rename $resetEvents to onNavigate
- Rename __scrollActiveSidebar to onRender
- Remove __getAndActive
- Remove __sticky
- Add IntersectionObserver mock to Jest environment

Also included:

- Add e2e test “ui” and “chromium” scripts
- Rename "jest" script to "test:jest"
- Remove unused SSR code

---------

Co-authored-by: Koy Zhuang <koy@ko8e24.top>
  • Loading branch information
jhildenbiddle and Koooooo-7 committed Apr 21, 2024
1 parent 2d986fe commit bb902f8
Show file tree
Hide file tree
Showing 11 changed files with 442 additions and 350 deletions.
8 changes: 1 addition & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 10 additions & 9 deletions package.json
Expand Up @@ -28,19 +28,18 @@
"build:css": "mkdirp lib/themes && node build/css -o lib/themes",
"build:emoji": "node ./build/emoji.js",
"build:js": "cross-env NODE_ENV=production node build/build.js",
"build:test": "npm run build && npm test",
"build": "rimraf lib themes && run-s build:js build:css build:css:min build:cover build:emoji",
"build": "run-s clean build:js build:css build:css:min build:cover build:emoji",
"clean": "rimraf lib themes _playwright*",
"dev": "run-p serve:dev watch:*",
"docker:build:test": "npm run docker:cli -- build:test",
"docker:build": "docker build -f Dockerfile -t docsify-test:local .",
"docker:clean": "docker rmi docsify-test:local",
"docker:cli": "docker run --rm -it --ipc=host --mount type=bind,source=$(pwd)/test,target=/app/test docsify-test:local",
"docker:rebuild": "npm run docker:clean && npm run docker:build",
"docker:rebuild": "run-s docker:clean docker:build",
"docker:test:e2e": "npm run docker:cli -- test:e2e",
"docker:test:integration": "npm run docker:cli -- test:integration",
"docker:test:unit": "npm run docker:cli -- test:unit",
"docker:test": "npm run docker:cli -- test",
"jest": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
"lint:fix": "eslint . --fix",
"lint": "prettier . --check && eslint .",
"postinstall": "opencollective-postinstall && npx husky install",
Expand All @@ -51,9 +50,12 @@
"serve:dev": "npm run serve -- --dev",
"serve": "node server",
"test:e2e": "playwright test",
"test:integration": "npm run jest -- --selectProjects integration",
"test:unit": "npm run jest -- --selectProjects unit",
"test": "npm run jest && run-s test:e2e",
"test:e2e:chromium": "playwright test --project='chromium'",
"test:e2e:ui": "playwright test --ui",
"test:integration": "npm run test:jest -- --selectProjects integration",
"test:jest": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
"test:unit": "npm run test:jest -- --selectProjects unit",
"test": "run-s test:jest test:e2e",
"watch:css": "npm run build:css -- -w",
"watch:js": "node build/build.js"
},
Expand All @@ -66,8 +68,7 @@
"opencollective-postinstall": "^2.0.2",
"prismjs": "^1.29.0",
"strip-indent": "^3.0.0",
"tinydate": "^1.3.0",
"tweezer.js": "^1.4.0"
"tinydate": "^1.3.0"
},
"devDependencies": {
"@babel/core": "^7.11.6",
Expand Down

0 comments on commit bb902f8

Please sign in to comment.