Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Convert to monorepo and revamp build system #350

Merged
merged 9 commits into from
Dec 4, 2023
Merged

Conversation

Methuselah96
Copy link
Collaborator

@Methuselah96 Methuselah96 commented Dec 2, 2023

Main code changes

  • Converts to monorepo, mainly so demos can use the master version of jsondiffpatch instead of using a URL. New directory structure is:
    • packages/jsondiffpatch
    • demos/console-demo
    • demos/html-demo
    • demos/numeric-plugin-demo
  • Revamp build system
    • Remove bundling with Rollup in favor of just transpiling the modules using TypeScript
    • Switch to ESM-only. The ecosystem has enough ESM-only packages, that consumers should know how to deal with it at this point.
    • Add "exports" field to "package.json"
  • Use esbuild to bundle code for html-demo
  • Remove formatter exports from main entry-point. This allows using jsondiffpatch without depending on DOM types from the HTML formatter, and excludes importing chalk by default (fixes compile errors when not including dom types #323).

Breaking changes for consumers

  • ESM-only
  • No default export. Import using import * as jsondiffpatch from 'jsondiffpatch or import individual methods.
  • Formatters must be imported from subpaths:
    • import * as annotatedFormatter from 'jsondiffpatch/formatters/annotated';
    • import * as baseFormatter from 'jsondiffpatch/formatters/base';
    • import * as consoleFormatter from 'jsondiffpatch/formatters/console';
    • import * as htmlFormatter from 'jsondiffpatch/formatters/html';
    • import * as jsonpatchFormatter from 'jsondiffpatch/formatters/jsonpatch';
  • Updated CSS imports:
    • import 'jsondiffpatch/formatters/styles/html.css';
    • import 'jsondiffpatch/formatters/styles/annotated.css';
  • Supported Node versions: ^18.0.0 || >=20.0.0

Remaining work before next release

  • Disable text diffing by default to reduce bundle size

@Methuselah96 Methuselah96 changed the title Convert to monorepo, convert demos to TypeScript, and revamp build system Convert to monorepo and revamp build system Dec 2, 2023
@Methuselah96 Methuselah96 marked this pull request as ready for review December 2, 2023 21:37
@Methuselah96 Methuselah96 merged commit ca8ecb9 into master Dec 4, 2023
1 check passed
@Methuselah96 Methuselah96 deleted the monorepo branch December 4, 2023 20:25
@Methuselah96 Methuselah96 mentioned this pull request Jan 5, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

compile errors when not including dom types
2 participants