Skip to content
Merged
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
46 changes: 46 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build and deploy to pages

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Upload
uses: actions/upload-pages-artifact@v3
with:
path: dist/

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
if: github.event_name == 'push' && needs.build.result == 'success'
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
token: ${{ github.token }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/
node_modules/
*.tsbuildinfo
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "packages/skyltrendering"]
path = packages/skyltrendering
url = https://github.com/axelw3/skyltrendering
102 changes: 0 additions & 102 deletions config.json

This file was deleted.

1 change: 0 additions & 1 deletion formatver.json

This file was deleted.

125 changes: 0 additions & 125 deletions graphics.js

This file was deleted.

39 changes: 39 additions & 0 deletions package-lock.json

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

14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "skyltprogram",
"version": "1.0.0",
"description": "",
"scripts": {
"build": "tsc && ncp public/ dist/"
},
"author": "axelw3",
"license": "AGPL-3.0-or-later",
"devDependencies": {
"ncp": "^2.0.0",
"typescript": "^5.8.2"
}
}
1 change: 1 addition & 0 deletions packages/skyltrendering
Submodule skyltrendering added at 303c0e
File renamed without changes.
File renamed without changes.
24 changes: 2 additions & 22 deletions index.html → public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<title>Skyltprogram</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<div id="header"><select id="selectTemplate"><option value="-1" disabled selected>Ladda ett exempel...</option></select></div>
Expand All @@ -24,29 +24,11 @@
});
};

const PREVIOUS_FORMAT_VERSIONS = await getJSON("formatver.json");
const CURRENT_FORMAT_ID = PREVIOUS_FORMAT_VERSIONS.length;

let data_input = document.getElementById("input"), fr = document.getElementById("render");

data_input.addEventListener("change", () => {
let parsed = JSON.parse(data_input.value);

let dataVersion = parseInt(parsed.format);
if(isNaN(dataVersion)) dataVersion = 0;

if(dataVersion < 0 || dataVersion > CURRENT_FORMAT_ID){
alert("ERROR: Unknown data version " + dataVersion + ".");
return;
}

let url = "render.html?";

if(dataVersion !== CURRENT_FORMAT_ID){
url += "f=" + PREVIOUS_FORMAT_VERSIONS[dataVersion] + "&";
}

fr.setAttribute("src", url + "data=" + window.encodeURIComponent(JSON.stringify(parsed)));
fr.setAttribute("src", "render.html?data=" + window.encodeURIComponent(JSON.stringify(parsed)));
});

getJSON("templates.json").then(templateData => {
Expand All @@ -57,8 +39,6 @@
option_el.appendChild(document.createTextNode(template.name));
option_el.setAttribute("value", i.toString(10));
templateSelect.appendChild(option_el);

template.json = Object.assign({format: CURRENT_FORMAT_ID}, template.json);
});

templateSelect.value = data_input.value.length < 6 ? 0 : (-1);
Expand Down
Loading
Loading