Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Big project cleanup (use Typescript, move files around, update stuff, remove unused code, ...) #996

Merged
merged 52 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
b245f82
Add Typescript, fix imports and change file endings from .js to .tsx
LukasKalbertodt Jan 24, 2023
da9c91f
Fix and improve `settings.tsx` for Typescript
LukasKalbertodt Jan 24, 2023
59abea5
Improve and add types to `studio-state`
LukasKalbertodt Jan 25, 2023
d61d3dc
Fix type of `Theme` used throughout the code
LukasKalbertodt Jan 25, 2023
6d14144
Fix type error by using integers instead of strings for `tabIndex`
LukasKalbertodt Jan 25, 2023
87ddce9
Type and improve `opencast.tsx`
LukasKalbertodt Jan 25, 2023
bc33e0b
Remove unused file `use-local-storage.tsx`
LukasKalbertodt Jan 25, 2023
f773636
Fix some tsc errors
LukasKalbertodt Jan 25, 2023
1a128ab
Refactor shortcut definition and UI to fix lots of type errors
LukasKalbertodt Jan 26, 2023
d559fd3
Remove faulty configuration about shortcuts in input/textarea/...
LukasKalbertodt Jan 26, 2023
98fa310
Deduplicate code used for defining own context hooks
LukasKalbertodt Jan 26, 2023
e8fc1b2
Make SVG import work with Typescript
LukasKalbertodt Jan 26, 2023
54eb216
Update `@emotion/core` to fix usage of removed `React.SFC`
LukasKalbertodt Jan 26, 2023
9f0e1d3
Fix more tsc errors
LukasKalbertodt Jan 27, 2023
63f9c33
Fix incorrect `danger` prop on `Button`
LukasKalbertodt Jan 27, 2023
4cd44fa
Fix even more tsc errors
LukasKalbertodt Jan 27, 2023
f77aec3
Fix more tsc errors again
LukasKalbertodt Jan 27, 2023
fe564ba
Fix compile error in 'react-hotkeys' by adding `React.SFC`
LukasKalbertodt Jan 30, 2023
f15d2b2
Fix more tsc errors once more
LukasKalbertodt Jan 30, 2023
304ba0f
Refactor and type `Steps` component
LukasKalbertodt Jan 30, 2023
f53c27b
Fix type error by dropping support for Safari 14.0
LukasKalbertodt Jan 30, 2023
8273ccf
Fix more typescript errors
LukasKalbertodt Jan 30, 2023
f92fc7d
Fix last error by using imperative handle instead of `document.query`
LukasKalbertodt Jan 30, 2023
f964138
Fix eslint warnings
LukasKalbertodt Jan 31, 2023
c8d24f3
Install additional `@types` packages
LukasKalbertodt Jan 31, 2023
21fc9bd
Move a bunch of files around to improve general structure
LukasKalbertodt Jan 31, 2023
b7c0b57
Enable stricter checking in tsconfig
LukasKalbertodt Feb 1, 2023
33eaef9
Fix warnings and remove useless lines in manifest
LukasKalbertodt Feb 1, 2023
bf1c12c
Remove unused service worker code
LukasKalbertodt Feb 1, 2023
1d81dd5
Get rid of Sentry
LukasKalbertodt Feb 1, 2023
b9bf1db
Remove unused crowdin config
LukasKalbertodt Feb 1, 2023
e517ae1
Move some docs to `doc` directory
LukasKalbertodt Feb 1, 2023
1690577
Move `.deploy-settings.toml` into `.github` folder
LukasKalbertodt Feb 1, 2023
d932588
Remove unused `prop-types` dependency
LukasKalbertodt Feb 1, 2023
c609bb3
Remove unused `.babelrc`
LukasKalbertodt Feb 1, 2023
69b7510
Replace string constants by type definition
LukasKalbertodt Feb 1, 2023
30b6c63
Replace a bunch of `//` comments with proper `/** */` doc comments
LukasKalbertodt Feb 1, 2023
10ab712
Update `use-resize-observer` to 9
LukasKalbertodt Feb 1, 2023
2371854
Add more type annotations and improve code accordingly
LukasKalbertodt Feb 1, 2023
13153f0
Use fully typed mode of `i18n` to have translation keys checked by tsc
LukasKalbertodt Feb 1, 2023
55e6897
Convert `function` to `const` arrow functions in `about.tsx`
LukasKalbertodt Feb 1, 2023
a978e22
Fix typing of `theme.colors`
LukasKalbertodt Feb 1, 2023
b8f86c6
Fix lots of `strictNullChecks` error and add useful functions in err.tsx
LukasKalbertodt Feb 1, 2023
23d850a
Use 'err' functions where appropriate
LukasKalbertodt Feb 1, 2023
bdfdc55
Update react-hook-form to 7
LukasKalbertodt Feb 1, 2023
0211e93
Enable `strictNullChecks` in tsconfig
LukasKalbertodt Feb 1, 2023
d5e5a14
Enforce single quotes everywhere (except JSX)
LukasKalbertodt Feb 1, 2023
a24c2b4
Remove use of `document.getElementById`
LukasKalbertodt Feb 1, 2023
94fdec0
Update GitHub actions dependencies
LukasKalbertodt Feb 2, 2023
24a76f6
Update eslint
LukasKalbertodt Feb 2, 2023
28530a0
Run eslint in CI and fail on any warnings
LukasKalbertodt Feb 2, 2023
6219cb2
Don't run CI and test deployments for dependabot PRs
LukasKalbertodt Feb 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"react/no-unknown-property": ["error", { "ignore": ["sx"] }],
"no-unused-expressions": "off",
"@babel/no-unused-expressions": "warn",
"quotes": ["warn", "single", { "avoidEscape": true }],

"arrow-parens": ["error", "as-needed"],
"arrow-spacing": "error",
Expand Down
File renamed without changes.
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@ on: [pull_request, push]

jobs:
main:
# We don't build PRs from dependabot, as we run everything for its branch push anyway
if: github.actor != 'dependabot[bot]' || github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm ci
- run: npx eslint src --max-warnings=0
- run: npm run build
- run: npm test


# Prepare test deployment
- name: Build for test deployment
env:
REACT_APP_ENABLE_SENTRY: 1
REACT_APP_INCLUDE_LEGAL_NOTICES: 1
run: |
builddate="$(date --utc '+%Y-%m-%d_%H-%M-%S')"
Expand All @@ -36,29 +38,28 @@ jobs:
PUBLIC_URL=${deploydir} npm run build

- name: Archive test deployment files as artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: test-deployment-files
path: |
build
.deploy-settings.toml
.github/.deploy-settings.toml
deploydir.tmp

# Prepare production deployment
- name: Build for prod deployment
if: github.repository_owner == 'elan-ev' && github.ref == 'refs/heads/master'
env:
REACT_APP_ENABLE_SENTRY: 1
REACT_APP_INCLUDE_LEGAL_NOTICES: 1
run: |
rm -rf build
PUBLIC_URL="/" npm run build

- name: Archive prod deployment files as artifact
if: github.repository_owner == 'elan-ev' && github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: prod-deployment-files
path: |
build
.deploy-settings.toml
.github/.deploy-settings.toml
10 changes: 5 additions & 5 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ jobs:
# Unfortunately we cannot use `actions/download-artifact` here since that
# only allows to download artifacts from the same run.
- name: Download artifacts from build workflow
uses: actions/github-script@v3.1.0
uses: actions/github-script@v6
with:
script: |
const artifacts = await github.actions.listWorkflowRunArtifacts({
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
const deployFiles = artifacts.data.artifacts
.filter(a => a.name == "prod-deployment-files")[0];
const download = await github.actions.downloadArtifact({
const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: deployFiles.id,
Expand All @@ -55,7 +55,7 @@ jobs:
fs.writeFileSync('${{github.workspace}}/artifacts.zip', Buffer.from(download.data));

// The artifact is not needed anymore
github.actions.deleteArtifact({
github.rest.actions.deleteArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: deployFiles.id,
Expand All @@ -66,7 +66,7 @@ jobs:

- name: Prepare deployment files
run: |
mv .deploy-settings.toml settings.toml
mv .github/.deploy-settings.toml settings.toml
mv build/* .
rmdir build

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ jobs:
# Unfortunately we cannot use `actions/download-artifact` here since that
# only allows to download artifacts from the same run.
- name: Download artifacts from build workflow
uses: actions/github-script@v3.1.0
uses: actions/github-script@v6
with:
script: |
const artifacts = await github.actions.listWorkflowRunArtifacts({
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
const deployFiles = artifacts.data.artifacts
.filter(a => a.name == "test-deployment-files")[0];
const download = await github.actions.downloadArtifact({
const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: deployFiles.id,
Expand All @@ -42,7 +42,7 @@ jobs:
fs.writeFileSync('${{github.workspace}}/artifacts.zip', Buffer.from(download.data));

// The artifact is not needed anymore
github.actions.deleteArtifact({
github.rest.actions.deleteArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: deployFiles.id,
Expand Down
28 changes: 2 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Opencast instance.
Opencast Studio uses somewhat new web technologies that are not yet (fully) supported by all browsers.
The following table depicts the current state of browser support (as of May 2022).

| | Firefox ≥ 68 | Chrome ≥ 77 | Edge ≥ 79 | Safari ≥ 14 |
| ---------- | -------------- | -------------- | -------------- | ----------- |
| | Firefox ≥ 68 | Chrome ≥ 77 | Edge ≥ 79 | Safari ≥ 14.1 |
| ---------- | -------------- | -------------- | -------------- | ------------- |
| Windows 11 | ✔ | ✔ | ✔ | -
| Windows 10 | ✔ | ✔ | ✔ | -
| Linux | ✔ | ✔ | ✔ | -
Expand Down Expand Up @@ -144,27 +144,3 @@ npm run build
| `PUBLIC_URL` | `/studio` | Path from which Studio will be served
| `REACT_APP_SETTINGS_PATH` | `/mysettings.toml` | Path from which to load the configuration (see `CONFIGURATION.md` for more information)
| `REACT_APP_INCLUDE_LEGAL_NOTICES` | `1` | Set to `1` to include legal notices and information about ELAN e.V., any other value or having this variable not set will not include them. Unless you are working for ELAN e.V. there is probably no reason for you to use this variable.


## How to release Opencast Studio

Checkout the branch `master` from Opencast Studio and make sure it is up-to-date (working directory should be clean!).
Execute `./create-release.sh`. Now there should be two new `*.tar.gz` files.

### Release

Go to [the release section on GitHub](https://github.com/elan-ev/opencast-studio/releases) and click "Draft a new release". Click on "choose a tag" and enter the current date in YYYY-MM-DD and then "Create new tag".
Make sure the target is still `master`.
As a release title, enter the current date again in the same format.
List all changes (since the last release) in the text box.
Upload the two `*.tar.gz` files and click "Publish release".

### Update Opencast

Checkout a new branch.
Go to `modules/studio/pom.xml`. You have to change two lines:
- `<opencast.studio.url>`: change the url to the new relase-url from `*-integrated.tar.gz`. (Usually only the date has to be adjusted here.)
- `<opencast.studio.sha256>`: update the sha256 hash. (Run `sha256sum *-integrated.tar.gz` in Opencast Studio folder)
Open a new pull request (optional: add a link to the release and changelog in the description)

Before opening a new pull request, you can build Opencast and test Opencast Studio. The release date should be on the info page.
3 changes: 0 additions & 3 deletions crowdin.yml

This file was deleted.

File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions doc/make-release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# How to release Opencast Studio

Checkout the branch `master` from Opencast Studio and make sure it is up-to-date (working directory should be clean!).
Execute `./create-release.sh`. Now there should be two new `*.tar.gz` files.

## Release

Go to [the release section on GitHub](https://github.com/elan-ev/opencast-studio/releases) and click "Draft a new release". Click on "choose a tag" and enter the current date in YYYY-MM-DD and then "Create new tag".
Make sure the target is still `master`.
As a release title, enter the current date again in the same format.
List all changes (since the last release) in the text box.
Upload the two `*.tar.gz` files and click "Publish release".

## Update Opencast

Checkout a new branch.
Go to `modules/studio/pom.xml`. You have to change two lines:
- `<opencast.studio.url>`: change the url to the new relase-url from `*-integrated.tar.gz`. (Usually only the date has to be adjusted here.)
- `<opencast.studio.sha256>`: update the sha256 hash. (Run `sha256sum *-integrated.tar.gz` in Opencast Studio folder)
Open a new pull request (optional: add a link to the release and changelog in the description)

Before opening a new pull request, you can build Opencast and test Opencast Studio. The release date should be on the info page.
6 changes: 0 additions & 6 deletions jsconfig.json

This file was deleted.

Loading