Overview

I had the opportunity to publish a customized Mirador 4 as an npm package, so this is a memo of the process.

Fork

Fork the repository from the following official site.

https://github.com/projectmirador/mirador

The result looks like this:

Create a Branch

Clone and create a branch.

git clone https://github.com/nakamura196/mirador
cd mirador
git checkout -b feature-add-immediately-property

The following output appears:

Switched to a new branch 'feature-add-immediately-property'

Development

Make modifications as introduced in the following article.

Test

Test to confirm there are no issues.

pnpm test

Commit

git add .
git commit -a -m "feat: add immediately property"

Merge

Switch back to the master branch and merge the contents of feature-add-immediately-property.

git checkout master
git merge feature-add-immediately-property

Push

Push the changes on the master branch.

git push

Publish

Use the following command to temporarily ignore local changes. (There may be a better approach…)

git update-index --assume-unchanged package.json

Change the package name to a different name.

{
  "name": "@nakamura196/mirador",
  "version": "4.0.0-alpha.3",
  "description": "An open-source, web-based 'multi-up' viewer that supports zoom-pan-rotate functionality, ability to display/compare simple images, and images with annotations.",
  "main": "dist/cjs/src/index.js",
  "module": "dist/es/src/index.js",
  "files": [
    "dist"
  ],
  "sideEffects": false,
...

Publish.

pnpm publish

As a result, it is published as follows:

Press ENTER to open in the browser...

+ @nakamura196/mirador@4.0.0-alpha.3

https://www.npmjs.com/package/@nakamura196/mirador

Summary

Regarding pull requests for the changes, I plan to do this separately after investigating the impact of the modifications made this time.

Some steps included here may not be ideal, but we hope this serves as a useful reference.