Skip to content

Conversation

@trusktr
Copy link
Member

@trusktr trusktr commented Jan 17, 2026

Summary

Changes:

  • add a build:v4 script to build the legacy v4 lib/ and themes/ folders
  • append deprecation console warnings to the v4 JS files during the v4 build
  • add a clean:v4 script to clean v4 build outputs
  • hook the v4 build/clean scripts into the build/release.sh script
  • test the v4 build and clean in CI

This makes is so that when we publish 5.0, the published files will include the legacy v4 lib/ and themes/ folders. This will prevent websites that are still using unversioned URLs (such as https://unpkg.com/docsify/lib/docsify.js, due to v4 docs and CLI instructing people to use unversioned URLs and the docsify-cli initializing projects with unversioned URLs) from breaking when we release 5.0. Existing v4 websites will simply continue to load the v4 files as if nothing changed despite that the library version will be v5 instead of v4, while new 5.0 users will opt into the new paths in the dist/ folder, will be instructed to use versioned URLs in our docs, and will have projects initialized by docsify-cli using versioned URLs by default.

Related issue, if any:

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

For any code change,

  • Related documentation has been updated, if needed
  • Related tests have been added or updated, if needed

Does this PR introduce a breaking change?

  • Yes
  • No

Tested in the following browsers:

  • Chrome
  • Firefox
  • Safari
  • Edge

Copilot AI review requested due to automatic review settings January 17, 2026 20:44
@vercel
Copy link

vercel bot commented Jan 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
docsify-preview Ready Ready Preview, Comment Jan 17, 2026 9:21pm

npm publish --tag "$RELEASE_TAG"
fi

npm run clean:v4 # clean up legacy v4 build files
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sy-records now that release.sh is updated, can you try this out with a --dry run to verify it works? The dry run output will show which files would be published (without publishing).

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds build infrastructure to maintain v4 backwards compatibility in the v5 release by building and publishing the legacy lib/ and themes/ folders alongside the new v5 dist/ folder. This prevents existing v4 sites using unversioned CDN URLs from breaking when v5 is published.

Changes:

  • Added v4 build and clean scripts to package.json
  • Integrated v4 build/clean into the release process
  • Added CI tests to verify v4 build and cleanup work correctly

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
package.json Adds build:v4, build:v4:deprecate, and clean:v4 scripts; includes lib/ and themes/ in published files
build/release.sh Integrates v4 build after tests and v4 cleanup after npm publish
.gitignore Adds lib/ and themes/ to ignored files
.github/workflows/test.yml Adds CI test to verify v4 build creates expected files and cleanup removes them
docs/quickstart.md Updates versioning documentation with improved formatting and additional semver examples

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@docsifyjs docsifyjs deleted a comment from Copilot AI Jan 17, 2026
@docsifyjs docsifyjs deleted a comment from Copilot AI Jan 17, 2026
@docsifyjs docsifyjs deleted a comment from Copilot AI Jan 17, 2026
@docsifyjs docsifyjs deleted a comment from Copilot AI Jan 17, 2026
@docsifyjs docsifyjs deleted a comment from Copilot AI Jan 17, 2026
package.json Outdated
"build:emoji": "node ./build/emoji.js",
"build:js": "rollup -c",
"build:types": "tsc",
"build:v4": "git checkout v4 && npm clean-install && git co docs/emoji.md src/core/render/emoji-data.js && rimraf packages/ && git checkout - && npm clean-install && npm run build:v4:deprecate -- lib/docsify.js && npm run build:v4:deprecate -- lib/docsify.min.js",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sy-records note here, it relies on a new v4 tag. If we update v4 for any reason (f.e. a security patch of some really annoying and compelling bug without workaround that a user has and they can't migrate to 5.0 yet), then we should also update the v4 tag to point to the latest v4 version. That way this script will work without modification, and will simply build the latest v4 version.

…lity while users transition to v5.

- add a script to build the legacy v4 lib/ and themes/ folders
- append deprecation console warnings to the v4 JS files during the v4 build
- add a script to clean v4 build outputs
- hook the v4 build/clean scripts into the release.sh script
- test the v4 build and clean in CI
"build:emoji": "node ./build/emoji.js",
"build:js": "rollup -c",
"build:types": "tsc",
"build:v4": "git checkout v4 && npm clean-install && git checkout docs/emoji.md src/core/render/emoji-data.js && rimraf packages/ && git checkout - && npm clean-install && npm run build:v4:deprecate -- lib/docsify.js && npm run build:v4:deprecate -- lib/docsify.min.js",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If version 5.0.0 is released, will the version in package.json update after checking out v4?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants