Skip to content

Commit e5f029a

Browse files
committed
🚩(frontend) version MIT only
We have some packages that are not MIT compatible, so if the env var MIT_ONLY is set to true, we don't build the application with features that are not MIT compatible. For the moment, it concerns only the export packages.
1 parent bd79f84 commit e5f029a

File tree

14 files changed

+488
-192
lines changed

14 files changed

+488
-192
lines changed

.github/workflows/docker-hub.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ jobs:
7979
context: .
8080
file: ./src/frontend/Dockerfile
8181
target: frontend-production
82-
build-args: DOCKER_USER=${{ env.DOCKER_USER }}:-1000
82+
build-args: |
83+
DOCKER_USER=${{ env.DOCKER_USER }}:-1000
84+
PUBLISH_AS_MIT=false
8385
push: ${{ github.event_name != 'pull_request' }}
8486
tags: ${{ steps.meta.outputs.tags }}
8587
labels: ${{ steps.meta.outputs.labels }}

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ and this project adheres to
1010

1111
## Added
1212

13-
✨ Add a custom callout block to the editor #892
13+
- ✨ Add a custom callout block to the editor #892
14+
- 🚩(frontend) version MIT only #911
1415

1516
## [3.2.1] - 2025-05-06
1617

docker-compose.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ services:
155155
target: frontend-production
156156
args:
157157
API_ORIGIN: "http://localhost:8071"
158-
Y_PROVIDER_URL: "ws://localhost:4444"
159-
MEDIA_URL: "http://localhost:8083"
158+
PUBLISH_AS_MIT: "false"
160159
SW_DEACTIVATED: "true"
161160
image: impress:frontend-development
162161
ports:

src/frontend/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ ENV NEXT_PUBLIC_API_ORIGIN=${API_ORIGIN}
3939
ARG SW_DEACTIVATED
4040
ENV NEXT_PUBLIC_SW_DEACTIVATED=${SW_DEACTIVATED}
4141

42+
ARG PUBLISH_AS_MIT
43+
ENV NEXT_PUBLIC_PUBLISH_AS_MIT=${PUBLISH_AS_MIT}
44+
4245
RUN yarn build
4346

4447
# ---- Front-end image ----

src/frontend/apps/impress/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
NEXT_PUBLIC_API_ORIGIN=
22
NEXT_PUBLIC_SW_DEACTIVATED=
3+
NEXT_PUBLIC_PUBLISH_AS_MIT=true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
NEXT_PUBLIC_API_ORIGIN=http://localhost:8071
2+
NEXT_PUBLIC_PUBLISH_AS_MIT=false
23
NEXT_PUBLIC_SW_DEACTIVATED=true

src/frontend/apps/impress/src/custom-next.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ declare module '*.svg?url' {
2020
namespace NodeJS {
2121
interface ProcessEnv {
2222
NEXT_PUBLIC_API_ORIGIN?: string;
23+
NEXT_PUBLIC_PUBLISH_AS_MIT?: string;
2324
NEXT_PUBLIC_SW_DEACTIVATED?: string;
2425
}
2526
}

src/frontend/apps/impress/src/features/docs/doc-header/__tests__/DocToolBox.spec.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const doc = {
4242

4343
beforeEach(() => {
4444
Analytics.clearAnalytics();
45+
process.env.NEXT_PUBLIC_PUBLISH_AS_MIT = 'false';
4546
});
4647

4748
describe('DocToolBox "Copy as HTML" option', () => {
@@ -51,7 +52,9 @@ describe('DocToolBox "Copy as HTML" option', () => {
5152
render(<DocToolBox doc={doc as any} />, {
5253
wrapper: AppWrapper,
5354
});
54-
const optionsButton = screen.getByLabelText('Open the document options');
55+
const optionsButton = await screen.findByLabelText(
56+
'Open the document options',
57+
);
5558
await userEvent.click(optionsButton);
5659
expect(await screen.findByText('Copy as HTML')).toBeInTheDocument();
5760
});
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { render, screen } from '@testing-library/react';
2+
import React from 'react';
3+
4+
import { AppWrapper } from '@/tests/utils';
5+
6+
import { DocToolBox } from '../components/DocToolBox';
7+
8+
const doc = {
9+
nb_accesses: 1,
10+
abilities: {
11+
versions_list: true,
12+
destroy: true,
13+
},
14+
};
15+
16+
jest.mock('@/features/docs/doc-export/', () => ({
17+
ModalExport: () => <span>ModalExport</span>,
18+
}));
19+
20+
it('DocToolBox dynamic import: loads DocToolBox when NEXT_PUBLIC_PUBLISH_AS_MIT is false', async () => {
21+
process.env.NEXT_PUBLIC_PUBLISH_AS_MIT = 'false';
22+
23+
render(<DocToolBox doc={doc as any} />, {
24+
wrapper: AppWrapper,
25+
});
26+
27+
expect(await screen.findByText('download')).toBeInTheDocument();
28+
});
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { render, screen, waitFor } from '@testing-library/react';
2+
import React from 'react';
3+
4+
import { AppWrapper } from '@/tests/utils';
5+
6+
const doc = {
7+
nb_accesses: 1,
8+
abilities: {
9+
versions_list: true,
10+
destroy: true,
11+
},
12+
};
13+
14+
jest.mock('@/features/docs/doc-export/', () => ({
15+
ModalExport: () => <span>ModalExport</span>,
16+
}));
17+
18+
it('DocToolBox dynamic import: loads DocToolBox when NEXT_PUBLIC_PUBLISH_AS_MIT is true', async () => {
19+
process.env.NEXT_PUBLIC_PUBLISH_AS_MIT = 'true';
20+
21+
const { DocToolBox } = await import('../components/DocToolBox');
22+
23+
render(<DocToolBox doc={doc as any} />, {
24+
wrapper: AppWrapper,
25+
});
26+
27+
await waitFor(
28+
() => {
29+
expect(screen.queryByText('download')).not.toBeInTheDocument();
30+
},
31+
{
32+
timeout: 1000,
33+
},
34+
);
35+
});

0 commit comments

Comments
 (0)