Skip to content

Commit

Permalink
chore: Make EE plugin on frontend > fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
JanCizmar committed Nov 28, 2024
1 parent 589ff98 commit b8241e2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
2 changes: 1 addition & 1 deletion webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
20 changes: 0 additions & 20 deletions webapp/scripts/prepareEE.cjs

This file was deleted.

25 changes: 25 additions & 0 deletions webapp/scripts/prepareEE.js
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit b8241e2

Please sign in to comment.