Skip to content

Commit

Permalink
Add support for, and verify, all common web bundlers (#278)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucas Castro <lucasamonrc@gmail.com>
  • Loading branch information
janpieterz and lucasamonrc authored Sep 25, 2024
1 parent 8bf1da7 commit 7631e40
Show file tree
Hide file tree
Showing 34 changed files with 11,031 additions and 88 deletions.
30 changes: 30 additions & 0 deletions ui-web/build-bundler.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
param (
[Parameter(Mandatory = $true)]
[string]$bundlerName
)
try {
Push-Location "$PSScriptRoot/samples/bundlers/$bundlerName"

& npm ci

if ($LASTEXITCODE -ne 0) {
throw "npm ci failed"
}

Write-Host "Building bundler $bundlerName project..."

&npm run build

if ($LASTEXITCODE -ne 0) {
throw "npm build $bundlerName failed"
}
}
catch {
Write-Host "An error occurred: $_" -ForegroundColor Red
Exit 1
}
finally {
Pop-Location
}


14 changes: 14 additions & 0 deletions ui-web/build-samples.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ try {
if ($LASTEXITCODE -ne 0) {
throw "npm build failed"
}

Write-Host "Building bundlers"
$bundlers = Get-ChildItem "$PSScriptRoot/samples/bundlers" -Directory
foreach ($bundler in $bundlers) {
Write-Host "Building bundler $($bundler.Name) project..."
. "$PSScriptRoot/build-bundler.ps1" -bundlerName $bundler.Name

if ($LASTEXITCODE -ne 0) {
throw "build-bundler.ps1 failed for bundler $($bundler.Name)"
}
Write-Host "Bundler $($bundler.Name) project built successfully"
}
}
catch {
Write-Host "An error occurred: $_" -ForegroundColor Red
Expand All @@ -22,3 +34,5 @@ catch {
finally {
Pop-Location
}


1 change: 1 addition & 0 deletions ui-web/samples/bundlers/esbuild/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
8 changes: 8 additions & 0 deletions ui-web/samples/bundlers/esbuild/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// build.js
require("esbuild")
.build({
entryPoints: ["index.js"],
bundle: true,
outfile: "dist/bundle.js",
})
.catch(() => process.exit(1));
12 changes: 12 additions & 0 deletions ui-web/samples/bundlers/esbuild/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>esbuild Example</title>
</head>
<body>
<h1>Hello esbuild!</h1>
<script src="dist/bundle.js"></script> <!-- The bundled file -->
</body>
</html>
3 changes: 3 additions & 0 deletions ui-web/samples/bundlers/esbuild/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { launchPopup } from "@trinsic/web-ui";

launchPopup(() => Promise.resolve("https://google.com"));
Loading

0 comments on commit 7631e40

Please sign in to comment.