Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

build: deploy excalidraw package example (#4762)

Aakansha Doshiae8b1d8bf707
diff --git a/.gitignore b/.gitignore
index 71a894772f..9625ef16ad 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,3 +23,7 @@ static
yarn-debug.log*
yarn-error.log*
src/packages/excalidraw/types
+src/packages/excalidraw/example/public/bundle.js
+src/packages/excalidraw/example/public/excalidraw-assets-dev
+src/packages/excalidraw/example/public/excalidraw.development.js
+
diff --git a/src/packages/excalidraw/example/index.html b/src/packages/excalidraw/example/public/index.html
similarity index 100%
rename from src/packages/excalidraw/example/index.html
rename to src/packages/excalidraw/example/public/index.html
diff --git a/src/packages/excalidraw/package.json b/src/packages/excalidraw/package.json
index d31b1a005b..a09649202b 100644
--- a/src/packages/excalidraw/package.json
+++ b/src/packages/excalidraw/package.json
@@ -76,7 +76,9 @@
"build:umd": "rm -rf dist && cross-env NODE_ENV=production webpack --config webpack.prod.config.js && cross-env NODE_ENV=development webpack --config webpack.dev.config.js && yarn gen:types",
"build:umd:withAnalyzer": "cross-env NODE_ENV=production ANALYZER=true webpack --config webpack.prod.config.js",
"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 ../../../",
+ "build:example": "EXAMPLE=true webpack --config webpack.dev-server.config.js"
},
"dependencies": {
"dotenv": "10.0.0"
diff --git a/src/packages/excalidraw/webpack.dev-server.config.js b/src/packages/excalidraw/webpack.dev-server.config.js
index 75ed9e540d..41c40aeb18 100644
--- a/src/packages/excalidraw/webpack.dev-server.config.js
+++ b/src/packages/excalidraw/webpack.dev-server.config.js
@@ -14,7 +14,7 @@ const devServerConfig = {
hot: true,
compress: true,
static: {
- directory: path.join(__dirname, "example"),
+ directory: path.join(__dirname, "./example/public"),
},
client: {
progress: true,
diff --git a/src/packages/excalidraw/webpack.dev.config.js b/src/packages/excalidraw/webpack.dev.config.js
index 685661907c..4f193031f5 100644
--- a/src/packages/excalidraw/webpack.dev.config.js
+++ b/src/packages/excalidraw/webpack.dev.config.js
@@ -3,6 +3,7 @@ const webpack = require("webpack");
const autoprefixer = require("autoprefixer");
const { parseEnvVariables } = require("./env");
+const outputDir = process.env.EXAMPLE === "true" ? "example/public" : "dist";
module.exports = {
mode: "development",
devtool: false,
@@ -10,7 +11,7 @@ module.exports = {
"excalidraw.development": "./entry.js",
},
output: {
- path: path.resolve(__dirname, "dist"),
+ path: path.resolve(__dirname, outputDir),
library: "Excalidraw",
libraryTarget: "umd",
filename: "[name].js",