add cleanup workspaces script and test-utils
This commit is contained in:
parent
5acb5c9d91
commit
d12d97bfcb
17
excalidraw-app/tests/test-utils.ts
Normal file
17
excalidraw-app/tests/test-utils.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { ImportedDataState } from "../../packages/excalidraw/data/types";
|
||||
import { STORAGE_KEYS } from "../app_constants";
|
||||
|
||||
export const initLocalStorage = (data: ImportedDataState) => {
|
||||
if (data.elements) {
|
||||
localStorage.setItem(
|
||||
STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS,
|
||||
JSON.stringify(data.elements),
|
||||
);
|
||||
}
|
||||
if (data.appState) {
|
||||
localStorage.setItem(
|
||||
STORAGE_KEYS.LOCAL_STORAGE_APP_STATE,
|
||||
JSON.stringify(data.appState),
|
||||
);
|
||||
}
|
||||
};
|
@ -64,6 +64,7 @@
|
||||
"build:app": "cross-env VITE_APP_GIT_SHA=$VERCEL_GIT_COMMIT_SHA vite build",
|
||||
"build:version": "node ./scripts/build-version.js",
|
||||
"build": "yarn workspace @excalidraw/utils build:esm && yarn --cwd ./excalidraw-app build",
|
||||
"clear:workspaces": "yarn workspace @excalidraw/utils run clear && yarn workspace @excalidraw/excalidraw run clear",
|
||||
"fix:code": "yarn test:code --fix",
|
||||
"fix:other": "yarn prettier --write",
|
||||
"fix": "yarn fix:other && yarn fix:code",
|
||||
@ -71,7 +72,7 @@
|
||||
"locales-coverage:description": "node scripts/locales-coverage-description.js",
|
||||
"prepare": "husky install",
|
||||
"prettier": "prettier \"**/*.{css,scss,json,md,html,yml}\" --ignore-path=.eslintignore",
|
||||
"start": "yarn workspace @excalidraw/utils build:esm && yarn --cwd ./excalidraw-app start",
|
||||
"start": "yarn workspace @excalidraw/utils run build:esm && yarn --cwd ./excalidraw-app start",
|
||||
"start:app:production": "npm run build && npx http-server build -a localhost -p 5001 -o",
|
||||
"test:all": "yarn test:typecheck && yarn test:code && yarn test:other && yarn test:app --watch=false",
|
||||
"test:app": "vitest",
|
||||
@ -79,7 +80,7 @@
|
||||
"test:other": "yarn prettier --list-different",
|
||||
"test:typecheck": "tsc",
|
||||
"test:update": "yarn test:app --update --watch=false",
|
||||
"test": "yarn workspace @excalidraw/utils build:esm && yarn test:app",
|
||||
"test": "yarn clear:workspaces && yarn workspace @excalidraw/utils build:esm && yarn test:app",
|
||||
"test:coverage": "vitest --coverage",
|
||||
"test:coverage:watch": "vitest --coverage --watch",
|
||||
"test:ui": "yarn test --ui --coverage.enabled=true",
|
||||
|
@ -132,6 +132,7 @@
|
||||
"pack": "yarn build:umd && yarn pack",
|
||||
"start": "node ../../scripts/buildExample.mjs && vite",
|
||||
"build:example": "node ../../scripts/buildExample.mjs",
|
||||
"clear": "rm -rf dist",
|
||||
"size": "yarn build:umd && size-limit"
|
||||
}
|
||||
}
|
||||
|
@ -81,6 +81,7 @@
|
||||
"build:umd": "cross-env NODE_ENV=production webpack --config webpack.prod.config.js",
|
||||
"build:esm": "rm -rf dist && node ../../scripts/buildUtils.js && yarn gen:types",
|
||||
"build:umd:withAnalyzer": "cross-env NODE_ENV=production ANALYZER=true webpack --config webpack.prod.config.js",
|
||||
"clear":"rm -rf dist",
|
||||
"pack": "yarn build:umd && yarn pack"
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user