fix: use excalidraw asset path in fonts when exporting to svg (#5065)
* fix: use excalidraw asset path in fonts when exporting * fix * fix * introduce env variables and determine asset path correctly * fix snaps * use env vars to determine pkg name and version * update docs * quotespull/5111/head
parent
ea51251fe6
commit
da94eb1284
@ -1,14 +1,18 @@
|
||||
const dotenv = require("dotenv");
|
||||
const { readFileSync } = require("fs");
|
||||
|
||||
const pkg = require("./package.json");
|
||||
const parseEnvVariables = (filepath) => {
|
||||
return Object.entries(dotenv.parse(readFileSync(filepath))).reduce(
|
||||
const envVars = Object.entries(dotenv.parse(readFileSync(filepath))).reduce(
|
||||
(env, [key, value]) => {
|
||||
env[key] = JSON.stringify(value);
|
||||
return env;
|
||||
},
|
||||
{},
|
||||
);
|
||||
envVars.PKG_NAME = JSON.stringify(pkg.name);
|
||||
envVars.PKG_VERSION = JSON.stringify(pkg.version);
|
||||
envVars.IS_EXCALIDRAW_NPM_PACKAGE = JSON.stringify(true);
|
||||
return envVars;
|
||||
};
|
||||
|
||||
module.exports = { parseEnvVariables };
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { ENV } from "../../constants";
|
||||
import pkg from "./package.json";
|
||||
if (process.env.NODE_ENV !== ENV.TEST) {
|
||||
/* eslint-disable */
|
||||
/* global __webpack_public_path__:writable */
|
||||
__webpack_public_path__ =
|
||||
window.EXCALIDRAW_ASSET_PATH ||
|
||||
`https://unpkg.com/${pkg.name}@${pkg.version}/dist/`;
|
||||
`https://unpkg.com/${process.env.PKG_NAME}@${process.env.PKG_VERSION}/dist/`;
|
||||
}
|
||||
|
Loading…
Reference in New Issue