chore: improve the configuration to build the npm package by tbouffard · Pull Request #87 · maxGraph/maxGraph

added 2 commits

May 9, 2022 17:56
Root and all package.json files
  - Fix license, version and authors
  - Remove the non-relevant .npmignore file at the project. It was designed for mxgraph, the whole directory structure
  changed, and we don't plan to publish the root package

`core` package
  - Generate type definition and javascript files for ESM output
    - dedicated folder for `esm` and `types` in the `dist` folder to clearly separate concerns
    - exported in the package.json
  - Add npm script for `npm pack` configuration
  - Drop the `postinstall` npm script that built the `core` bundle. It would have been run when the package is installed
  in dependent projects at dependencies install. And it would have failed as it tries to build the project from TypeScript
  sources that are not available in the npm package.

fix: ConstraintHandler now loads image as everywhere else in the code using `Client.imageBasePath`
Using import doesn't work as the image is not available in the npm package. It generated error like this in ViteJS
project:
Failed to resolve import "../../../images/point.gif" from "../core/dist/esm/view/handler/ConstraintHandler.js". Does the file exist?
This gif import had been introduced to make `Anchors.stories.js` retrieve the gif file. Configuring `imageBasePath` as
already done in other stories fixes the issue.

Don't export EditorCodec and StylesheetCodec as they generate errors.
This is a temporary solution to avoid error in dependent project (at least, with ViteJS projects).
Let test the mxgraph core npm package in a TypeScript project. This ensures that the types and the esm code is correctly
configured in the package and available for integration.

@tbouffard

Drop npm scripts in the root package.json file that only apply to the `core` package

@tbouffard

@tbouffard tbouffard changed the title chore: improve the configuration to be able to build the npm package chore: improve the configuration to build the npm package

May 10, 2022

This was referenced

Jun 4, 2022

@tbouffard tbouffard marked this pull request as ready for review

June 9, 2022 18:10

@tbouffard

- custom shapes
- activate rubberband
- panning and overflow hidden
- bump vite to 2.9.12

@tbouffard

tbouffard

@tbouffard

@tbouffard

not intended to be published

@tbouffard

@tbouffard

@tbouffard

@tbouffard tbouffard deleted the chore/prepare_npm_package branch

July 5, 2022 06:08

@tbouffard tbouffard added the chore

Build, CI/CD or repository tasks (issues/PR maintenance, environments, ...)

label

Nov 20, 2022