diff --git a/README.md b/README.md index 635915ad..3af391e1 100644 --- a/README.md +++ b/README.md @@ -108,25 +108,92 @@ In older versions, you might need to create such a role in the security configur ## Build Instructions -To build Studio yourself, execute these commands: +To clone Studio, execute these commands: ```sh % git clone git@github.com:elan-ev/opencast-studio.git % cd opencast-studio % npm install +``` + +### Serve From Build Folder + +You can serve the application from the `build/` folder. + +```sh % npm run build:release # or npm run build:dev for development ``` This will generate static content you can serve via any web server in `build/`. -That's it. -If you prefer to run a local development server directly, you can use this -instead: +### Serve From Local Development Server + +If you prefer to run a local development server directly, you can use this instead: + +#### Unix-like OS + +Unix-like (Linux and macOS) operating systems can use ```sh -% npm start +% npm run start ``` +#### Windows OS + +Windows-family operating systems can use + - Git Bash, + - PowerShell, + - Windows Command Prompt(CMD) or, + - Windows Subsystem for Linux 2(WSL2) + +```sh +% npm run winstart +``` + + +> [!CAUTION] +> ### PowerShell Execution Policy +> +> PowerShell’s execution policy may prevent npm scripts from running. +> +> You can temporarily or permanently allow running scripts by modifying PowerShell's execution policy. +> +> **Option 1: Use Git Bash, CMD or WSL2** +> - **Git Bash and Windows Command Prompt** don’t enforce execution policies like PowerShell. +> - **Windows Subsystem for Linux 2** allows the use of a GNU/Linux environment from within Windows. +> - **PowerShell** has security restrictions that prevent running scripts unless explicitly allowed. +> +> **Option 2: Temporary PowerShell Fix (For Current Session Only)** +> Run this in PowerShell before running your `npm` command: +> +> ```sh +> Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass +> ``` +> +> - This only affects the current PowerShell session. +> - After closing PowerShell, the original policy is restored. +> +> **Option 3: Permanent PowerShell Fix (For Your User Account)** +> If you want to allow scripts permanently (for your user account only), run: +> +> ```sh +> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned -Force +> ``` +> +> - This allows scripts to run if they are locally created or digitally signed. +> - Safer than Unrestricted, which allows all scripts. +> +> **Option 4: Completely Disable PowerShell Execution Policy (Not Recommended)** +> If you want to remove all script restrictions (**⚠ security risk**), run: +> +> ```sh +> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted -Force +> ``` +> +> **⚠ Warning**: This allows running any script, including potentially harmful ones. +> + + ### Additional Build Options By default, Studio expects to be deployed under the root path of a domain (e.g. https://studio.example.com/) and using a diff --git a/package-lock.json b/package-lock.json index 72ff0b3f..712e80c8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11001,4 +11001,4 @@ } } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 5eda3930..3069edca 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "homepage": "https://studio.opencast.org", "scripts": { "start": "COMMIT_SHA=$(git rev-parse --short HEAD) BUILD_DATE=$(date -u '+%Y-%m-%d') webpack serve --open --mode=development", + "winstart": "set COMMIT_SHA=%COMMIT_SHA% && set BUILD_DATE=%BUILD_DATE% && webpack serve --open --mode=development", "build:dev": "COMMIT_SHA=$(git rev-parse --short HEAD) BUILD_DATE=$(date -u '+%Y-%m-%d') webpack --progress --mode=development", "build:release": "COMMIT_SHA=$(git rev-parse --short HEAD) BUILD_DATE=$(date -u '+%Y-%m-%d') webpack --progress --mode=production", "typecheck": "tsc --skipLibCheck", diff --git a/webpack.config.ts b/webpack.config.ts index fb5384ac..92f6f061 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -87,27 +87,29 @@ const config: CallableWebpackConfiguration = (_env, argv) => ({ noErrorOnMissing: true, }] : [], - // Copy the font related files to output directory + // Copy individual font files to output directory { - from: path.join(__dirname, "node_modules/@fontsource-variable/@(roboto-flex|vazirmatn)/index.css"), - to: "font.css", - transformAll: assets => assets.map(assets => assets.data) - .join("\n") - .replace(/url\(.\/files\//g, "url(./fonts/"), + from: path.join(__dirname, "node_modules/@fontsource-variable/roboto-flex/index.css"), + to: path.join(OUT_PATH, "font-roboto.css"), + transform: (content) => content.toString().replace(/url\(.\/files\//g, "url(./fonts/"), }, - ...( - [ - "roboto-flex-cyrillic-ext-wght-normal.woff2", - "roboto-flex-cyrillic-wght-normal.woff2", - "roboto-flex-greek-wght-normal.woff2", - "roboto-flex-vietnamese-wght-normal.woff2", - "roboto-flex-latin-ext-wght-normal.woff2", - "roboto-flex-latin-wght-normal.woff2", - ].map(font => ({ - from: path.join(__dirname, "node_modules/@fontsource-variable/roboto-flex/files/", font), - to: path.join(OUT_PATH, "fonts", font), - })) - ), + { + from: path.join(__dirname, "node_modules/@fontsource-variable/vazirmatn/index.css"), + to: path.join(OUT_PATH, "font-vazirmatn.css"), + transform: (content) => content.toString().replace(/url\(.\/files\//g, "url(./fonts/"), + }, + // Copy font files + ...[ + "roboto-flex-cyrillic-ext-wght-normal.woff2", + "roboto-flex-cyrillic-wght-normal.woff2", + "roboto-flex-greek-wght-normal.woff2", + "roboto-flex-vietnamese-wght-normal.woff2", + "roboto-flex-latin-ext-wght-normal.woff2", + "roboto-flex-latin-wght-normal.woff2", + ].map((font) => ({ + from: path.join(__dirname, "node_modules/@fontsource-variable/roboto-flex/files/", font), + to: path.join(OUT_PATH, "fonts", font), + })), { from: path.join(__dirname, "node_modules/@fontsource-variable/vazirmatn/files/vazirmatn-arabic-wght-normal.woff2"),