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
Binary file added moci/icons/icon-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added moci/icons/icon-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions moci/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
type="image/svg+xml"
href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='480 400 250 280'%3E%3Cpath d='M608 668L497.149 604L497.149 476L608 412L718.851 476L718.851 604L608 668Z' fill='%23E2E2E5'/%3E%3C/svg%3E"
/>
<link rel="manifest" href="manifest.json" />
<meta name="theme-color" content="#000000" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="icons/icon-192.png" />
<link rel="stylesheet" href="app.css" />
</head>
<body>
Expand Down
20 changes: 20 additions & 0 deletions moci/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "MoCI",
"short_name": "MoCI",
"start_url": ".",
"display": "standalone",
"background_color": "#000000",
"theme_color": "#000000",
"icons": [
{
"src": "icons/icon-192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "icons/icon-512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
16 changes: 12 additions & 4 deletions scripts/build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { minify } from 'terser';
import { readFile, writeFile, mkdir } from 'fs/promises';
import { readFile, writeFile, mkdir, copyFile, readdir } from 'fs/promises';
import { join } from 'path';
import CleanCSS from 'clean-css';

Expand Down Expand Up @@ -52,17 +52,25 @@ async function buildCSS() {
);
}

async function copyHTML() {
console.log('Copying HTML...');
async function copyAssets() {
console.log('Copying assets...');
const html = await readFile('moci/index.html', 'utf8');
await writeFile(join(distDir, 'index.html'), html);

await copyFile('moci/manifest.json', join(distDir, 'manifest.json'));

await mkdir(join(distDir, 'icons'), { recursive: true });
const icons = await readdir('moci/icons');
for (const icon of icons) {
await copyFile(join('moci/icons', icon), join(distDir, 'icons', icon));
}
}

async function build() {
console.log('Building production bundle...\n');
await buildJS();
await buildCSS();
await copyHTML();
await copyAssets();
console.log('\nBuild complete! Output in dist/');
}

Expand Down