From b8241e2c5c44d77544a518a4c5385f3bcb2ca3fe Mon Sep 17 00:00:00 2001 From: Jan Cizmar Date: Thu, 28 Nov 2024 11:58:27 +0100 Subject: [PATCH] chore: Make EE plugin on frontend > fix build --- webapp/package.json | 2 +- webapp/scripts/prepareEE.cjs | 20 -------------------- webapp/scripts/prepareEE.js | 25 +++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 21 deletions(-) delete mode 100644 webapp/scripts/prepareEE.cjs create mode 100644 webapp/scripts/prepareEE.js diff --git a/webapp/package.json b/webapp/package.json index fd1f778eb2..e3dbfb9a76 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -83,7 +83,7 @@ "tag-keys:deprecated": "tolgee tag --filter-not-extracted --filter-tag production --tag deprecated", "tag-keys:production": "tolgee tag --filter-extracted --tag production --untag deprecated 'draft: *' --untag-other production", "tag-keys": "npm run tag-keys:deprecated && npm run tag-keys:production", - "prepare": "npm run --prefix .. init-husky && node ./scripts/updateBranchInfo.mjs && node ./scripts/prepareEe.cjs" + "prepare": "npm run --prefix .. init-husky && node ./scripts/updateBranchInfo.mjs && node ./scripts/prepareEe.js" }, "eslintConfig": { "extends": [ diff --git a/webapp/scripts/prepareEE.cjs b/webapp/scripts/prepareEE.cjs deleted file mode 100644 index a0aca9e6e8..0000000000 --- a/webapp/scripts/prepareEE.cjs +++ /dev/null @@ -1,20 +0,0 @@ -// if src/ee exists copy the webapp/src/eePlugin.ee.tsx to webapp/src/eePlugin.local.tsx -// else copy the webapp/src/eePlugin.oss.tsx to webapp/src/eePlugin.local.tsx - -const { existsSync, symlinkSync, unlinkSync } = require('fs'); -const { join } = require('path'); - -const srcDir = join(__dirname, '../src/ee'); -const eePluginEe = join(__dirname, '../src/eePlugin.ee.tsx'); -const eePluginOss = join(__dirname, '../src/eePlugin.oss.tsx'); -const eePluginLocal = join(__dirname, '../src/eePlugin.local.tsx'); - -if (existsSync(eePluginLocal)) { - unlinkSync(eePluginLocal); -} - -if (existsSync(srcDir)) { - symlinkSync(eePluginEe, eePluginLocal); -} else { - symlinkSync(eePluginOss, eePluginLocal); -} diff --git a/webapp/scripts/prepareEE.js b/webapp/scripts/prepareEE.js new file mode 100644 index 0000000000..a422cb61fb --- /dev/null +++ b/webapp/scripts/prepareEE.js @@ -0,0 +1,25 @@ +// if src/ee exists copy the webapp/src/eePlugin.ee.tsx to webapp/src/eePlugin.local.tsx +// else copy the webapp/src/eePlugin.oss.tsx to webapp/src/eePlugin.local.tsx + +import { existsSync, symlinkSync, unlinkSync } from 'fs'; + +import path from 'path'; +import { fileURLToPath } from 'url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +const srcDir = path.join(__dirname, '../src/ee'); +const eePluginEe = path.join(__dirname, '../src/eePlugin.ee.tsx'); +const eePluginOss = path.join(__dirname, '../src/eePlugin.oss.tsx'); +const eePluginLocal = path.join(__dirname, '../src/eePlugin.local.tsx'); + +if (existsSync(eePluginLocal)) { + unlinkSync(eePluginLocal); +} + +if (existsSync(srcDir)) { + symlinkSync(eePluginEe, eePluginLocal); +} else { + symlinkSync(eePluginOss, eePluginLocal); +}