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
66 changes: 49 additions & 17 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,28 @@ import * as path from "path";
export const OUT_DIR = "dist/";
fs.mkdir(OUT_DIR, { recursive: true });

async function copyOut(inFile) {
export function getOutPath(inFile) {
const pathParts = inFile.split(path.sep);
pathParts[0] = OUT_DIR;
const outFile = pathParts.join(path.sep).replace(/\.scss$/, ".css");
await fs.copyFile(inFile, outFile);
return pathParts.join(path.sep);
}

async function copyOut(inFile) {
await fs.copyFile(inFile, getOutPath(inFile));
}

// ============================================================================
// Web Components
// ============================================================================
//
// This section bundles the .wc.js source into .js dist

import { bundle } from "./rollup.js";

await bundle("wc/eth.wc.js", "ethComponents");

await processSCSS("scss/props");

// ============================================================================
// SCSS
// ============================================================================
Expand Down Expand Up @@ -39,6 +54,14 @@ await copyOut("fonts/Nunito-latin-italic.woff2");
await copyOut("fonts/Sen-latin.woff2");
await copyOut("fonts/Sen-latin-ext.woff2");

// ============================================================================
// Misc
// ============================================================================
//
// This section handles one-off miscellaneous assets

await copyOut("misc/favicon.ico");

// ============================================================================
// Hardpoint Verification
// ============================================================================
Expand All @@ -48,19 +71,28 @@ await copyOut("fonts/Sen-latin-ext.woff2");

import assert from "assert";

function hardpoint(path) {
assert(existsSync(path), `Hardpoint asset "${path}" not present in output`);
function hardpoint(inPath) {
assert(
existsSync(
path.join(OUT_DIR, inPath),
`Hardpoint asset "${inPath}" not present in output`,
),
);
}

hardpoint("dist/props.css");

hardpoint("fonts/Fira_Code.woff2");
hardpoint("fonts/Kenia.woff2");
hardpoint("fonts/Nunito-cyrillic.woff2");
hardpoint("fonts/Nunito-cyrillic-italic.woff2");
hardpoint("fonts/Nunito-latin.woff2");
hardpoint("fonts/Nunito-latin-ext.woff2");
hardpoint("fonts/Nunito-latin-ext-italic.woff2");
hardpoint("fonts/Nunito-latin-italic.woff2");
hardpoint("fonts/Sen-latin.woff2");
hardpoint("fonts/Sen-latin-ext.woff2");
hardpoint("eth.wc.js");

hardpoint("props.css");

hardpoint("Fira_Code.woff2");
hardpoint("Kenia.woff2");
hardpoint("Nunito-cyrillic.woff2");
hardpoint("Nunito-cyrillic-italic.woff2");
hardpoint("Nunito-latin.woff2");
hardpoint("Nunito-latin-ext.woff2");
hardpoint("Nunito-latin-ext-italic.woff2");
hardpoint("Nunito-latin-italic.woff2");
hardpoint("Sen-latin.woff2");
hardpoint("Sen-latin-ext.woff2");

hardpoint("favicon.ico");
Binary file added misc/favicon.ico
Binary file not shown.
Loading