Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ jobs:
- name: Build all packages
run: pnpm build

- name: Verify publishable dist manifests
run: node tools/check-dist-manifests.mjs

- name: Run all tests (parser, rendering, corpus, units)
run: pnpm test

Expand Down
34 changes: 18 additions & 16 deletions PUBLISHING.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
## publishing
## Publishing

```sh
pnpm dlx lerna version patch
pnpm build
pnpm dlx lerna publish from-package
pnpm exec lerna version patch
pnpm exec lerna publish from-package
```

Notes:

- **Order matters**: version first, then build. The build writes each
package's `dist/package.json` (via `tools/write-dist-manifest.mjs`),
resolving `workspace:^` deps to the sibling packages' real versions —
so the manifests must be generated *after* the version bump.
- Packages publish from `dist/` (`publishConfig.directory`). pnpm/lerna
publish that directory verbatim, which is why the manifest rewrite
happens at build time. Never copy the raw `package.json` into `dist`.
- `lerna publish from-package` publishes whatever versions are missing
from the registry, so it is safe to re-run after a partial publish.
- npm permanently blocks reusing a version number that was unpublished —
if a release goes out broken, bump and publish a new patch; do not
unpublish and retry the same version.
- `lerna version` (or `lerna publish`) updates package versions and tags.
`lerna publish from-package` publishes whatever versions are missing from
the registry, so it is safe to re-run after a partial publish.
- TypeScript packages publish from `dist/` (`publishConfig.directory`), which
becomes the published package root. Their `prepack` hook runs the build as
each package is packed, so the dist manifest is produced at pack time with
the current package version. No manual build step is needed.
- A plain local build leaves `workspace:` dependency specs in `dist` because
Lerna resolves those specs in the package-root manifest immediately before
packing. The packed manifest therefore contains concrete versions, and
`prepack` runs `makage check-publish` after the build to fail the publish if
an unresolved `workspace:` spec would ever reach a tarball.
- npm permanently blocks reusing a version number that was unpublished. If a
release goes out broken, bump and publish a new patch; do not unpublish and
retry the same version.
19 changes: 17 additions & 2 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "independent",
"npmClient": "pnpm"
}
"npmClient": "pnpm",
"registry": "https://registry.npmjs.org",
"packages": [
"packages/*",
"playground"
],
"command": {
"version": {
"syncWorkspaceLock": true
},
"publish": {
"allowBranch": "main",
"message": "chore(release): publish",
"conventionalCommits": true
}
}
}
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"private": true,
"scripts": {
"build": "lerna run build",
"clean": "pnpm -r run clean",
"dev": "pnpm --filter @latex2js/playground dev",
"dev:build": "pnpm --filter @latex2js/playground build",
"e2e": "pnpm --filter @latex2js/playground e2e",
Expand All @@ -16,23 +17,20 @@
"bundle:watch": "node tools/build-bundle.mjs --watch"
},
"devDependencies": {
"copyfiles": "^2.4.1",
"prettier": "^3.0.0",
"rimraf": "^5.0.5",
"ts-jest": "^29.1.0",
"@types/jest": "^29.5.0",
"@types/node": "^20.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"lerna": "^8.2.3",
"lerna": "^8.2.4",
"typescript": "^5.2.0",
"ts-node": "^10.9.2",
"esbuild": "^0.28.0"
},
"workspaces": [
"packages/*",
"website/*",
"examples/*"
"playground"
],
"repository": {
"type": "git",
Expand Down
5 changes: 4 additions & 1 deletion packages/css/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
],
"scripts": {
"build": "pnpm run copy",
"copy": "copyfiles latex2js.css latex2js.mathapedia.css ../latex2js"
"copy": "makage copy latex2js.css latex2js.mathapedia.css ../latex2js"
},
"devDependencies": {
"makage": "^0.6.0"
},
"bugs": {
"url": "https://github.com/Mathapedia/LaTeX2JS/issues"
Expand Down
12 changes: 7 additions & 5 deletions packages/html5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
"url": "https://github.com/Mathapedia/LaTeX2JS"
},
"scripts": {
"copy": "copyfiles -f ../../LICENSE README.md dist && node ../../tools/write-dist-manifest.mjs",
"clean": "rimraf dist",
"build": "pnpm run clean && tsc && tsc -p tsconfig.esm.json && pnpm run copy && pnpm run bundle",
"build:dev": "pnpm run clean && tsc --declarationMap && tsc -p tsconfig.esm.json && pnpm run copy && pnpm run bundle",
"bundle": "node ../../tools/build-bundle.mjs --dist",
"clean": "makage clean",
"prepack": "pnpm run build && makage check-publish",
"build": "makage clean && makage build-ts && makage assets && node ../../tools/build-bundle.mjs --dist",
"build:dev": "makage clean && makage build-ts --dev && makage assets && node ../../tools/build-bundle.mjs --dist",
"test": "jest",
"test:watch": "jest --watch",
"test:debug": "node --inspect node_modules/.bin/jest --runInBand"
Expand All @@ -35,5 +34,8 @@
"@latex2js/utils": "workspace:^",
"latex2js": "workspace:^",
"mathjaxjs": "workspace:^"
},
"devDependencies": {
"makage": "^0.6.0"
}
}
9 changes: 5 additions & 4 deletions packages/latex2js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
"math diagrams"
],
"scripts": {
"copy": "copyfiles -f ../../LICENSE README.md latex2js.css latex2js.mathapedia.css dist && node ../../tools/write-dist-manifest.mjs",
"copy:grammar": "mkdir -p dist/grammar dist/esm/grammar && cp src/grammar/parser.js src/grammar/parser.d.ts src/grammar/grammar.pegjs dist/grammar/ && cp src/grammar/parser.js dist/esm/grammar/",
"clean": "rimraf dist",
"build": "pnpm run clean && tsc && tsc -p tsconfig.esm.json && pnpm run copy && pnpm run copy:grammar && cp latex2js.css ../../bundle/latex2js.css",
"build:dev": "pnpm run clean && tsc --declarationMap && tsc -p tsconfig.esm.json && pnpm run copy && pnpm run copy:grammar",
"clean": "makage clean",
"prepack": "pnpm run build && makage check-publish",
"build": "makage clean && makage build-ts && makage assets && makage copy latex2js.css latex2js.mathapedia.css dist --flat && pnpm run copy:grammar && cp latex2js.css ../../bundle/latex2js.css",
"build:dev": "makage clean && makage build-ts --dev && makage assets && makage copy latex2js.css latex2js.mathapedia.css dist --flat && pnpm run copy:grammar",
"grammar": "peggy -o src/grammar/parser.js --dts src/grammar/grammar.pegjs",
"test": "jest",
"test:watch": "jest --watch",
Expand All @@ -45,6 +45,7 @@
"@latex2js/utils": "workspace:^"
},
"devDependencies": {
"makage": "^0.6.0",
"@mathapedia/css": "workspace:^",
"peggy": "^5.1.0"
},
Expand Down
11 changes: 7 additions & 4 deletions packages/macros/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@
"mathjax"
],
"scripts": {
"copy": "copyfiles -f ../../LICENSE README.md dist && node ../../tools/write-dist-manifest.mjs",
"clean": "rimraf dist",
"build": "pnpm run clean && tsc && tsc -p tsconfig.esm.json && pnpm run copy",
"build:dev": "pnpm run clean && tsc --declarationMap && tsc -p tsconfig.esm.json && pnpm run copy",
"clean": "makage clean",
"prepack": "pnpm run build && makage check-publish",
"build": "makage clean && makage build-ts && makage assets",
"build:dev": "makage clean && makage build-ts --dev && makage assets",
"test": "jest",
"test:watch": "jest --watch",
"test:debug": "node --inspect node_modules/.bin/jest --runInBand"
},
"devDependencies": {
"makage": "^0.6.0"
},
"bugs": {
"url": "https://github.com/Mathapedia/LaTeX2JS/issues"
}
Expand Down
9 changes: 5 additions & 4 deletions packages/mathjaxjs-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
"component"
],
"scripts": {
"copy": "copyfiles -f ../../LICENSE README.md dist && node ../../tools/write-dist-manifest.mjs",
"clean": "rimraf dist",
"build": "pnpm run clean && tsc && tsc -p tsconfig.esm.json && pnpm run copy",
"build:dev": "pnpm run clean && tsc --declarationMap && tsc -p tsconfig.esm.json && pnpm run copy",
"clean": "makage clean",
"prepack": "pnpm run build && makage check-publish",
"build": "makage clean && makage build-ts && makage assets",
"build:dev": "makage clean && makage build-ts --dev && makage assets",
"test": "jest",
"test:watch": "jest --watch",
"test:debug": "node --inspect node_modules/.bin/jest --runInBand"
Expand All @@ -42,6 +42,7 @@
},
"devDependencies": {
"@types/react": "^18.0.0",
"makage": "^0.6.0",
"react": "^18.0.0"
}
}
11 changes: 7 additions & 4 deletions packages/mathjaxjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@
"javascript"
],
"scripts": {
"copy": "copyfiles -f ../../LICENSE README.md dist && node ../../tools/write-dist-manifest.mjs",
"clean": "rimraf dist",
"build": "pnpm run clean && tsc && tsc -p tsconfig.esm.json && pnpm run copy",
"build:dev": "pnpm run clean && tsc --declarationMap && tsc -p tsconfig.esm.json && pnpm run copy",
"clean": "makage clean",
"prepack": "pnpm run build && makage check-publish",
"build": "makage clean && makage build-ts && makage assets",
"build:dev": "makage clean && makage build-ts --dev && makage assets",
"test": "jest",
"test:watch": "jest --watch",
"test:debug": "node --inspect node_modules/.bin/jest --runInBand"
},
"devDependencies": {
"makage": "^0.6.0"
},
"bugs": {
"url": "https://github.com/Mathapedia/LaTeX2JS/issues"
}
Expand Down
11 changes: 7 additions & 4 deletions packages/pstricks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@
"url": "https://github.com/Mathapedia/LaTeX2JS"
},
"scripts": {
"copy": "copyfiles -f ../../LICENSE README.md dist && node ../../tools/write-dist-manifest.mjs",
"clean": "rimraf dist",
"build": "pnpm run clean && tsc && tsc -p tsconfig.esm.json && pnpm run copy",
"build:dev": "pnpm run clean && tsc --declarationMap && tsc -p tsconfig.esm.json && pnpm run copy",
"clean": "makage clean",
"prepack": "pnpm run build && makage check-publish",
"build": "makage clean && makage build-ts && makage assets",
"build:dev": "makage clean && makage build-ts --dev && makage assets",
"test": "jest",
"test:watch": "jest --watch",
"test:debug": "node --inspect node_modules/.bin/jest --runInBand"
},
"devDependencies": {
"makage": "^0.6.0"
},
"bugs": {
"url": "https://github.com/Mathapedia/LaTeX2JS/issues"
},
Expand Down
11 changes: 6 additions & 5 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
"react"
],
"scripts": {
"copy": "copyfiles -f ../../LICENSE README.md dist && node ../../tools/write-dist-manifest.mjs",
"clean": "rimraf dist",
"build": "pnpm run clean && tsc && tsc -p tsconfig.esm.json && pnpm run copy",
"build:dev": "pnpm run clean && tsc --declarationMap && tsc -p tsconfig.esm.json && pnpm run copy",
"clean": "makage clean",
"prepack": "pnpm run build && makage check-publish",
"build": "makage clean && makage build-ts && makage assets",
"build:dev": "makage clean && makage build-ts --dev && makage assets",
"test": "jest",
"test:watch": "jest --watch",
"test:debug": "node --inspect node_modules/.bin/jest --runInBand"
Expand All @@ -39,7 +39,8 @@
},
"devDependencies": {
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0"
"@types/react-dom": "^18.2.0",
"makage": "^0.6.0"
},
"dependencies": {
"@latex2js/macros": "workspace:^",
Expand Down
11 changes: 7 additions & 4 deletions packages/settings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@
"url": "https://github.com/Mathapedia/LaTeX2JS"
},
"scripts": {
"copy": "copyfiles -f ../../LICENSE README.md dist && node ../../tools/write-dist-manifest.mjs",
"clean": "rimraf dist",
"build": "pnpm run clean && tsc && tsc -p tsconfig.esm.json && pnpm run copy",
"build:dev": "pnpm run clean && tsc --declarationMap && tsc -p tsconfig.esm.json && pnpm run copy",
"clean": "makage clean",
"prepack": "pnpm run build && makage check-publish",
"build": "makage clean && makage build-ts && makage assets",
"build:dev": "makage clean && makage build-ts --dev && makage assets",
"test": "jest",
"test:watch": "jest --watch",
"test:debug": "node --inspect node_modules/.bin/jest --runInBand"
},
"devDependencies": {
"makage": "^0.6.0"
},
"bugs": {
"url": "https://github.com/Mathapedia/LaTeX2JS/issues"
},
Expand Down
11 changes: 7 additions & 4 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@
"mathjax"
],
"scripts": {
"copy": "copyfiles -f ../../LICENSE README.md dist && node ../../tools/write-dist-manifest.mjs",
"clean": "rimraf dist",
"build": "pnpm run clean && tsc && tsc -p tsconfig.esm.json && pnpm run copy",
"build:dev": "pnpm run clean && tsc --declarationMap && tsc -p tsconfig.esm.json && pnpm run copy",
"clean": "makage clean",
"prepack": "pnpm run build && makage check-publish",
"build": "makage clean && makage build-ts && makage assets",
"build:dev": "makage clean && makage build-ts --dev && makage assets",
"test": "jest",
"test:watch": "jest --watch",
"test:debug": "node --inspect node_modules/.bin/jest --runInBand"
},
"devDependencies": {
"makage": "^0.6.0"
},
"bugs": {
"url": "https://github.com/Mathapedia/LaTeX2JS/issues"
}
Expand Down
9 changes: 5 additions & 4 deletions packages/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"vue.js"
],
"scripts": {
"copy": "copyfiles -f ../../LICENSE README.md dist && node ../../tools/write-dist-manifest.mjs && copyfiles -u 1 src/latex.vue src/components/**/* dist/",
"clean": "rimraf dist",
"build": "pnpm run clean && tsc && tsc -p tsconfig.esm.json && pnpm run copy",
"build:dev": "pnpm run clean && tsc --declarationMap && tsc -p tsconfig.esm.json && pnpm run copy",
"clean": "makage clean",
"prepack": "pnpm run build && makage check-publish",
"build": "makage clean && makage build-ts && makage assets && mkdir -p dist/components && cp src/latex.vue dist/latex.vue && cp src/components/* dist/components/",
"build:dev": "makage clean && makage build-ts --dev && makage assets && mkdir -p dist/components && cp src/latex.vue dist/latex.vue && cp src/components/* dist/components/",
"test": "jest",
"test:watch": "jest --watch",
"test:debug": "node --inspect node_modules/.bin/jest --runInBand"
Expand All @@ -39,6 +39,7 @@
"url": "https://github.com/Mathapedia/LaTeX2JS/issues"
},
"devDependencies": {
"makage": "^0.6.0",
"vue-tsc": "^1.8.0"
},
"dependencies": {
Expand Down
Loading
Loading