Skip to content
Closed
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
45 changes: 45 additions & 0 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Deploy PR previews

on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed

concurrency: preview-${{ github.ref }}
env:
PR_NUMBER: ${{ github.event.number }}

jobs:
deploy-preview:
permissions: write-all
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: "true"

- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: "20.x"

- name: Install dependencies
if: github.event.action != 'closed'
run: |
npm i @nx/nx-linux-x64-gnu
npm clean-install

- name: Build compas-open-scd
if: github.event.action != 'closed'
run: |
PUBLIC_URL=compas-open-scd/pr-preview/pr-$PR_NUMBER npm run-script build

- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: packages/compas-open-scd/build
umbrella-dir: pr-preview
143 changes: 90 additions & 53 deletions packages/compas-open-scd/index.html
Original file line number Diff line number Diff line change
@@ -1,61 +1,98 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />

<head>
<meta charset="utf-8">
<meta
http-equiv="Cache-control"
content="no-cache, no-store, must-revalidate"
/>
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />

<meta http-equiv="Cache-control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, viewport-fit=cover"
/>
<meta
name="Description"
content="Open Substation Communication Designer is a bottom-up system configuration tool for projects described using IEC 61850-6 Edition 2 or greater."
/>
<base href="/" />

<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<meta name="Description"
content="Open Substation Communication Designer is a bottom-up system configuration tool for projects described using IEC 61850-6 Edition 2 or greater.">
<base href="/">
<!-- Original URL from Google: https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300&family=Roboto:wght@300;400;500&display=swap -->
<link
href="%PUBLIC_URL%/public/google/fonts/roboto-v27.css"
rel="stylesheet"
/>
<link
href="%PUBLIC_URL%/public/google/fonts/roboto-mono-v13.css"
rel="stylesheet"
/>
<!-- Original URL from Google: https://fonts.googleapis.com/css?family=Material+Icons+Outlined&display=block -->
<link
href="%PUBLIC_URL%/public/google/icons/material-icons-outlined.css"
rel="stylesheet"
/>
<link
href="%PUBLIC_URL%/public/google/icons/material-symbols-outlined.css"
rel="stylesheet"
/>
<link href="%PUBLIC_URL%/public/css/normalize.css" rel="stylesheet" />
<link
rel="manifest"
href="%PUBLIC_URL%/manifest.json"
crossorigin="use-credentials"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="%PUBLIC_URL%/public/favicon-16x16.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="%PUBLIC_URL%/public/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="192x192"
href="%PUBLIC_URL%/public/icon-192x192.png"
/>

<!-- Original URL from Google: https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300&family=Roboto:wght@300;400;500&display=swap -->
<link href="/public/google/fonts/roboto-v27.css" rel="stylesheet">
<link href="/public/google/fonts/roboto-mono-v13.css" rel="stylesheet">
<!-- Original URL from Google: https://fonts.googleapis.com/css?family=Material+Icons+Outlined&display=block -->
<link href="/public/google/icons/material-icons-outlined.css" rel="stylesheet">
<link href="/public/google/icons/material-symbols-outlined.css" rel="stylesheet">
<link href="/public/css/normalize.css" rel="stylesheet">
<link rel="manifest" href="manifest.json" crossorigin="use-credentials">
<link rel="icon" type="image/png" sizes="16x16" href="public/favicon-16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="public/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="192x192" href="public/icon-192x192.png">
<title>CoMPAS - OpenSCD</title>
</head>

<title>CoMPAS - OpenSCD</title>
</head>
<body>
<open-scd></open-scd>

<body>
<open-scd></open-scd>
<script src="./src/polyfill/scoped-custom-elements-polyfill.js"></script>

<script src="./src/polyfill/scoped-custom-elements-polyfill.js"></script>

<script>
const _customElementsDefine = window.customElements.define;
window.customElements.define = (name, cl, conf) => {
if (!customElements.get(name)) {
_customElementsDefine.call(window.customElements, name, cl, conf);
}
};
</script>
<script type="module" src="./src/open-scd.js"></script>
<script src="./public/init-js/init.js"></script>
<script>
if ('serviceWorker' in navigator)
navigator.serviceWorker.register('/sw.js');
</script>
<script>
const openScd = document.querySelector("open-scd");
addEventListener("beforeunload", e => {
if (openScd && openScd.doc) {
e.preventDefault();
return e.returnValue = "Are you sure you want to exit?";
}
});
</script>
</body>

</html>
<script>
const _customElementsDefine = window.customElements.define;
window.customElements.define = (name, cl, conf) => {
if (!customElements.get(name)) {
_customElementsDefine.call(window.customElements, name, cl, conf);
}
};
</script>
<script type="module" src="./src/open-scd.js"></script>
<script src="%PUBLIC_URL%/public/init-js/init.js"></script>
<script>
if ('serviceWorker' in navigator)
navigator.serviceWorker.register('/sw.js');
</script>
<script>
const openScd = document.querySelector('open-scd');
addEventListener('beforeunload', e => {
if (openScd && openScd.doc) {
e.preventDefault();
return (e.returnValue = 'Are you sure you want to exit?');
}
});
</script>
</body>
</html>
4 changes: 2 additions & 2 deletions packages/compas-open-scd/snowpack.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ export default ({
},
buildOptions: {
htmlFragments: true,
}
baseUrl: process.env.PUBLIC_URL || '/',
},
});