Skip to content

Commit

Permalink
Reorganized build
Browse files Browse the repository at this point in the history
  • Loading branch information
bakaq committed Oct 8, 2023
1 parent 9660879 commit 027b4a4
Show file tree
Hide file tree
Showing 18 changed files with 57 additions and 89 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,10 @@ jobs:
uses: actions/checkout@v4
- name: Build release
run: make all
- name: Assemble release folder
run: |
mkdir release-gh-pages
cp -r release release-gh-pages/
cp sw.js release-gh-pages/
cp index.css release-gh-pages/
cp index.html release-gh-pages/
cp manifest.json release-gh-pages/
cp kanjiInfo.json release-gh-pages/
cp radk.json release-gh-pages/
- name: Upload Github Pages artifact
uses: actions/upload-pages-artifact@v1
with:
path: "./release-gh-pages"
path: "./release"
deploy:
permissions:
contents: read
Expand Down
32 changes: 26 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
PROJECT_SOURCES = $(wildcard src/*.ts)
PROJECT_SOURCES = $(wildcard src/main/* src/sw/*)

all: release/index.js sw.js
.PHONY: all
all: release/main/index.js release/radk.json release/index.html release/index.css

release/index.js: $(PROJECT_SOURCES)
tsc
release/index.html: src/index.html
cp src/index.html release/

sw.js: src/service-worker/sw.ts
tsc src/service-worker/sw.ts --lib webworker,es6 --outFile sw.js
release/index.css: src/index.css
cp src/index.css release/

# This is actually all the .js files, including sw.js
release/main/index.js: $(PROJECT_SOURCES) | release
tsc --build src/main
mv release/sw/sw.js release/
rm release/sw -r

# This is actually both radk.json and kanjiInfo.json
release/radk.json: scripts/buildjson.py | release
./scripts/buildjson.py
mv radk.json release/
mv kanjiInfo.json release/

release:
mkdir -p release

.PHONY: clean
clean:
rm -rf release
1 change: 0 additions & 1 deletion kanjiInfo.json

This file was deleted.

1 change: 0 additions & 1 deletion radk.json

This file was deleted.

16 changes: 2 additions & 14 deletions buildjson.py → scripts/buildjson.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,7 @@
# information from RADKFILE and KANJIDICT2
#
# Copyright 2022 Kauê Hunnicutt Bazilli
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https:#www.gnu.org/licenses/>.
# SPDX-License-Identifier: GPL-3.0-or-later

import asyncio
import json
Expand Down Expand Up @@ -117,7 +105,7 @@ async def main():
# Invert the radkfile to create a easily parsable kradfile-like json
kradjson = invert_radkjson(radkjson)

# Create the kanjiinfo.json
# Create the kanjiInfo.json
kanji_info = build_kanji_info(await kanjidict2_task, kradjson)

# Write files
Expand Down
10 changes: 10 additions & 0 deletions src/generic-tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"rootDir": ".",
"outDir": "../release",
"target": "ES2016",
"strict": true,
"composite": true,
"declarationMap": true
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion index.html → src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<!-- TODO: serve icons locally -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Scripts -->
<script type="module" src="release/index.js" defer></script>
<script type="module" src="main/index.js" defer></script>
</head>
<body>
<div class="ui-wrapper">
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions src/main/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../generic-tsconfig.json",
"compilerOptions": {
"lib": ["es2020", "dom", "dom.iterable"]
},
"include": ["./*"],
"references": [{ "path": "../sw" }]
}
2 changes: 2 additions & 0 deletions src/service-worker/sw.ts → src/sw/sw.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference no-default-lib="true" />
/// <reference lib="ES2020" />
/// <reference lib="WebWorker" />

const _self = (self as unknown) as ServiceWorkerGlobalScope;
Expand Down
7 changes: 7 additions & 0 deletions src/sw/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../generic-tsconfig.json",
"compilerOptions": {
"lib": ["es2020", "webworker"]
},
"files": ["sw.ts"]
}
41 changes: 0 additions & 41 deletions sw.js

This file was deleted.

14 changes: 0 additions & 14 deletions tsconfig.json

This file was deleted.

0 comments on commit 027b4a4

Please sign in to comment.