Browse Source

add @excalidraw/utils to external and fixes

Aakansha Doshi 1 year ago
parent
commit
45ff9d1053

+ 1 - 1
package.json

@@ -63,7 +63,7 @@
     "build:app:docker": "cross-env VITE_APP_DISABLE_SENTRY=true VITE_APP_DISABLE_TRACKING=true vite build",
     "build:app": "cross-env VITE_APP_GIT_SHA=$VERCEL_GIT_COMMIT_SHA vite build",
     "build:version": "node ./scripts/build-version.js",
-    "build": "yarn --cwd ./excalidraw-app build",
+    "build": "yarn workspace @excalidraw/utils build:esm && yarn --cwd ./excalidraw-app build",
     "fix:code": "yarn test:code --fix",
     "fix:other": "yarn prettier --write",
     "fix": "yarn fix:other && yarn fix:code",

+ 1 - 1
packages/excalidraw/element/binding.ts

@@ -26,7 +26,7 @@ import {
 
 import { getElementAbsoluteCoords } from "./bounds";
 import { AppClassProperties, AppState, Point } from "../types";
-import { isPointOnShape } from "../../utils/collision";
+import { isPointOnShape } from "@excalidraw/utils";
 import { getElementAtPosition } from "../scene";
 import {
   isArrowElement,

+ 1 - 1
packages/excalidraw/element/collision.ts

@@ -13,7 +13,7 @@ import {
   GeometricShape,
   getPolygonShape,
 } from "../../utils/geometry/shape";
-import { isPointInShape, isPointOnShape } from "../../utils/collision";
+import { isPointInShape, isPointOnShape } from "@excalidraw/utils";
 import { isTransparent } from "../utils";
 import {
   hasBoundTextElement,

+ 1 - 1
packages/excalidraw/package.json

@@ -59,7 +59,7 @@
     "@braintree/sanitize-url": "6.0.2",
     "@excalidraw/laser-pointer": "1.3.1",
     "@excalidraw/mermaid-to-excalidraw": "0.3.0",
-    "@excalidraw/utils": "workspace:^",
+    "@excalidraw/utils": "*",
     "@excalidraw/random-username": "1.1.0",
     "@radix-ui/react-popover": "1.0.3",
     "@radix-ui/react-tabs": "1.0.2",

+ 2 - 0
packages/utils/export.ts

@@ -171,6 +171,8 @@ export const exportToSvg = async ({
   exportPadding?: number;
   renderEmbeddables?: boolean;
 }): Promise<SVGSVGElement> => {
+  console.log("HIIII TGEREE122");
+
   const { elements: restoredElements, appState: restoredAppState } = restore(
     { elements, appState },
     null,

+ 1 - 0
packages/utils/index.ts

@@ -1,3 +1,4 @@
 export * from "./export";
 export * from "./withinBounds";
 export * from "./bbox";
+export * from "./collision";

+ 2 - 0
scripts/buildUtils.js

@@ -8,6 +8,7 @@ const browserConfig = {
   bundle: true,
   format: "esm",
   plugins: [sassPlugin()],
+  external: ["@excalidraw/utils"],
 };
 
 // Will be used later for treeshaking
@@ -80,6 +81,7 @@ const rawConfig = {
   format: "esm",
   packages: "external",
   plugins: [sassPlugin()],
+  external: ["@excalidraw/utils"],
 };
 
 // const BASE_PATH = `${path.resolve(`${__dirname}/..`)}`;

+ 0 - 5
yarn.lock

@@ -2022,11 +2022,6 @@
   resolved "https://registry.npmjs.org/@excalidraw/random-username/-/random-username-1.1.0.tgz#6f388d6a9708cf655b8c9c6aa3fa569ee71ecf0f"
   integrity sha512-nULYsQxkWHnbmHvcs+efMkJ4/9TtvNyFeLyHdeGxW0zHs6P+jYVqcRff9A6Vq9w9JXeDRnRh2VKvTtS19GW2qA==
 
-"@excalidraw/utils@workspace:^":
-  version "0.1.2"
-  resolved "https://registry.yarnpkg.com/@excalidraw/utils/-/utils-0.1.2.tgz#69b931772b5d06ea655743a85557f001b585c352"
-  integrity sha512-hypi3np+Do3e8Eb0Y1ug52EyJP4JAP3RPQRfAgiMN0ftag7M49vahiWVXd9yX4wsviCKYacTbBDs2mRqt3nyUQ==
-
 "@firebase/[email protected]":
   version "0.4.0"
   resolved "https://registry.npmjs.org/@firebase/analytics-types/-/analytics-types-0.4.0.tgz#d6716f9fa36a6e340bc0ecfe68af325aa6f60508"