Browse Source

fix: use subdirectory for @excalidraw/excalidraw size limit (#6787)

* fix: use subdirectory for @excalidraw/excalidraw size limit

* fix

* update yml

* update path

* fix

* fix

* better
Aakansha Doshi 2 years ago
parent
commit
70888327a3

+ 7 - 1
.github/workflows/size-limit.yml

@@ -15,10 +15,16 @@ jobs:
         uses: actions/setup-node@v3
         uses: actions/setup-node@v3
         with:
         with:
           node-version: 18.x
           node-version: 18.x
+      - name: Install
+        run: yarn --frozen-lockfile
+      - name: Install in src/packages/excalidraw
+        run: yarn --frozen-lockfile
+        working-directory: src/packages/excalidraw
         env:
         env:
           CI: true
           CI: true
       - uses: andresz1/size-limit-action@v1
       - uses: andresz1/size-limit-action@v1
         with:
         with:
           github_token: ${{ secrets.GITHUB_TOKEN }}
           github_token: ${{ secrets.GITHUB_TOKEN }}
-          build_script: size
+          build_script: build:umd
           skip_step: install
           skip_step: install
+          directory: src/packages/excalidraw

+ 2 - 11
package.json

@@ -145,15 +145,6 @@
     "test:coverage": "react-scripts test --passWithNoTests --coverage --watchAll",
     "test:coverage": "react-scripts test --passWithNoTests --coverage --watchAll",
     "autorelease": "node scripts/autorelease.js",
     "autorelease": "node scripts/autorelease.js",
     "prerelease": "node scripts/prerelease.js",
     "prerelease": "node scripts/prerelease.js",
-    "release": "node scripts/release.js",
-    "size": "node scripts/buildPackageExcalidraw.js && size-limit"
-  },
-  "size-limit": [
-    {
-      "path": [
-        "src/packages/excalidraw/dist/excalidraw.development.js",
-        "src/packages/excalidraw/dist/excalidraw.production.min.js"
-      ]
-    }
-  ]
+    "release": "node scripts/release.js"
+  }
 }
 }

+ 0 - 16
scripts/buildPackageExcalidraw.js

@@ -1,16 +0,0 @@
-const { execSync } = require("child_process");
-
-const excalidrawDir = `${__dirname}/../src/packages/excalidraw`;
-
-const build = () => {
-  try {
-    execSync(`yarn  --frozen-lockfile`);
-    execSync(`yarn --frozen-lockfile`, { cwd: excalidrawDir });
-    execSync(`yarn run build:umd`, { cwd: excalidrawDir });
-  } catch (err) {
-    console.error(err);
-    process.exit(1);
-  }
-};
-
-build();

+ 11 - 2
src/packages/excalidraw/package.json

@@ -80,6 +80,15 @@
     "pack": "yarn build:umd && yarn pack",
     "pack": "yarn build:umd && yarn pack",
     "start": "webpack serve --config webpack.dev-server.config.js",
     "start": "webpack serve --config webpack.dev-server.config.js",
     "install:deps": "yarn install --frozen-lockfile && yarn --cwd ../../../",
     "install:deps": "yarn install --frozen-lockfile && yarn --cwd ../../../",
-    "build:example": "EXAMPLE=true webpack --config webpack.dev-server.config.js && yarn gen:types"
-  }
+    "build:example": "EXAMPLE=true webpack --config webpack.dev-server.config.js && yarn gen:types",
+    "size": "yarn build:umd && size-limit"
+  },
+  "size-limit": [
+    {
+      "path": "dist/excalidraw.development.js"
+    },
+    {
+      "path": "dist/excalidraw.production.min.js"
+    }
+  ]
 }
 }