Skip to content

fix(windows): add Windows compatibility for env vars and glob patterns #1230

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
77 changes: 72 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected]: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
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
40 changes: 21 additions & 19 deletions webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down