Skip to content

Feat: Vite migration #1653

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

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft
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
31,815 changes: 14,431 additions & 17,384 deletions package-lock.json

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions packages/distribution/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@
<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"
<link href="/google/fonts/roboto-v27.css"
rel="stylesheet">
<link href="%PUBLIC_URL%/public/google/fonts/roboto-mono-v13.css"
<link href="/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"
<link href="/google/icons/material-icons-outlined.css"
rel="stylesheet">
<link href="%PUBLIC_URL%/public/css/normalize.css"
<link href="/css/normalize.css"
rel="stylesheet">
<link rel="manifest"
href="%PUBLIC_URL%/manifest.json">
href="/manifest.json">
<link rel="icon"
type="image/png"
sizes="16x16"
href="%PUBLIC_URL%/public/favicon-16x16.png">
href="/favicon-16x16.png">
<link rel="icon"
type="image/png"
sizes="32x32"
href="%PUBLIC_URL%/public/favicon-32x32.png">
href="/favicon-32x32.png">
<link rel="icon"
type="image/png"
sizes="192x192"
href="%PUBLIC_URL%/public/icon-192x192.png">
href="/icon-192x192.png">

<title>OpenSCD</title>
</head>
Expand All @@ -49,7 +49,7 @@
};
</script>
<script type="module"
src="%PUBLIC_URL%/main.js"></script>
src="/main.js"></script>
<script>
if ('serviceWorker' in navigator)
navigator.serviceWorker.register('/sw.js');
Expand All @@ -65,4 +65,4 @@
</script>
</body>

</html>
</html>
9 changes: 4 additions & 5 deletions packages/distribution/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,16 @@
"doc:typedoc": "typedoc --plugin none --out doc src",
"doc:wca": "wca src --outDir doc/components",
"doc": "npm run doc:clean && npm run doc:typedoc && npm run doc:wca",
"build": "snowpack build && workbox generateSW workbox-config.cjs && cp .nojekyll build/",
"start": "snowpack dev",
"serve": "npm run build && http-server build"
"build": "vite build && workbox generateSW workbox-config.cjs && cp .nojekyll build/",
"start": "vite",
"serve": "npm run build && http-server build -c-1 --cors"
},
"devDependencies": {
"@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "^13.1.0",
"@open-wc/eslint-config": "^4.3.0",
"@open-wc/semantic-dom-diff": "^0.19.5",
"@open-wc/testing": "^2.5.33",
"@snowpack/plugin-typescript": "^1.2.1",
"@types/marked": "^2.0.4",
"@types/node": "^16.6.1",
"@typescript-eslint/eslint-plugin": "^4.29.2",
Expand All @@ -67,13 +66,13 @@
"lint-staged": "^11.1.2",
"prettier": "^2.3.2",
"sinon": "^17.0.1",
"snowpack": "3.8.6",
"source-map": "^0.7.4",
"standard-version": "^9.3.1",
"tslib": "^2.3.1",
"typedoc": "^0.21.10",
"typedoc-plugin-markdown": "3.10.4",
"typescript": "4.3.5",
"vite": "^6.2.4",
"web-component-analyzer": "^1.1.6",
"workbox-cli": "^6.2.4"
},
Expand Down
39 changes: 0 additions & 39 deletions packages/distribution/snowpack.config.mjs

This file was deleted.

19 changes: 19 additions & 0 deletions packages/distribution/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { defineConfig } from "vite";

export default defineConfig({
plugins: [],
server: {
cors: {
origin: '*', // Allow all origins
methods: ['GET', 'POST', 'PUT', 'DELETE'], // Allow specific methods
allowedHeaders: ['Content-Type', 'Authorization'], // Allow specific headers
credentials: true,
}
},
build: {
outDir: "build",
target: "es2022",
module: "es2022",
moduleResolution: "node"
}
})
4 changes: 1 addition & 3 deletions packages/openscd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
"@open-wc/eslint-config": "^4.3.0",
"@open-wc/semantic-dom-diff": "^0.19.5",
"@open-wc/testing": "^2.5.33",
"@snowpack/plugin-typescript": "^1.2.1",
"@types/marked": "^2.0.4",
"@types/node": "^16.6.1",
"@typescript-eslint/eslint-plugin": "^4.29.2",
Expand All @@ -98,7 +97,6 @@
"lint-staged": "^11.1.2",
"prettier": "^2.3.2",
"sinon": "^17.0.1",
"snowpack": "3.8.6",
"source-map": "^0.7.4",
"standard-version": "^9.3.1",
"tslib": "^2.3.1",
Expand Down Expand Up @@ -172,4 +170,4 @@
],
"commitUrlFormat": "https://github.com/openscd/open-scd/commits/{{hash}}"
}
}
}
10 changes: 5 additions & 5 deletions packages/openscd/src/foundation/nsd.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export const iec6185074 = fetch('public/xml/IEC_61850-7-4_2007B3.nsd')
export const iec6185074 = fetch('/xml/IEC_61850-7-4_2007B3.nsd')
.then(response => response.text())
.then(str => new DOMParser().parseFromString(str, 'application/xml'));

export const iec6185073 = fetch('public/xml/IEC_61850-7-3_2007B3.nsd')
export const iec6185073 = fetch('/xml/IEC_61850-7-3_2007B3.nsd')
.then(response => response.text())
.then(str => new DOMParser().parseFromString(str, 'application/xml'));

export const iec6185072 = fetch('public/xml/IEC_61850-7-2_2007B3.nsd')
export const iec6185072 = fetch('/xml/IEC_61850-7-2_2007B3.nsd')
.then(response => response.text())
.then(str => new DOMParser().parseFromString(str, 'application/xml'));

export const iec6185081 = fetch('public/xml/IEC_61850-8-1_2003A2.nsd')
export const iec6185081 = fetch('/xml/IEC_61850-8-1_2003A2.nsd')
.then(response => response.text())
.then(str => new DOMParser().parseFromString(str, 'application/xml'));
.then(str => new DOMParser().parseFromString(str, 'application/xml'));
Loading