From ae8b1d8bf7077c93968ec9e949ba5092737a241e Mon Sep 17 00:00:00 2001 From: Aakansha Doshi Date: Wed, 9 Feb 2022 17:45:16 +0530 Subject: [PATCH] build: deploy excalidraw package example (#4762) * build: deploy excalidraw package example * deploy public * install deps script * new lines --- .gitignore | 4 ++++ src/packages/excalidraw/example/{ => public}/index.html | 0 src/packages/excalidraw/package.json | 4 +++- src/packages/excalidraw/webpack.dev-server.config.js | 2 +- src/packages/excalidraw/webpack.dev.config.js | 3 ++- 5 files changed, 10 insertions(+), 3 deletions(-) rename src/packages/excalidraw/example/{ => public}/index.html (100%) diff --git a/.gitignore b/.gitignore index 71a894772..9625ef16a 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 d31b1a005..a09649202 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 75ed9e540..41c40aeb1 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 685661907..4f193031f 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",