diff --git a/index.ts b/index.ts index 0e4a270..4fb9ed5 100644 --- a/index.ts +++ b/index.ts @@ -7,7 +7,7 @@ import Bundler from 'parcel-bundler'; import { dirname, join } from 'path'; import ProgressBar from 'progress'; import rimraf from 'rimraf'; -import { range } from 'underscore'; +import { mapObject, range } from 'underscore'; interface Account { image: string; @@ -29,6 +29,16 @@ const BUNDLER_OPTIONS = { minify: true, }; +function readAccounts(): ReadonlyArray { + const rawAccounts: Object = jsyaml.safeLoad(readFileSync(join(__dirname, 'accounts.yml')).toString()); + return Object.values(mapObject(rawAccounts, (val, key) => { + return { + ...val, + name: key + }; + })); +} + function statusOutput(message: string) { console.log('> ' + message + '...'); @@ -52,10 +62,11 @@ function writeTemplate( rimraf.sync(BUILD_DIR); statusOutput("Reading accounts") - const accounts: ReadonlyArray = jsyaml.safeLoad(readFileSync(join(__dirname, 'accounts.yml')).toString()); + const accounts = readAccounts(); statusOutput('Creating template'); const bundler = new Bundler(join(SRC_DIR, 'template.html'), BUNDLER_OPTIONS); + console.log((bundler as any)); await bundler.bundle(); statusOutput('Compiling HTML template'); diff --git a/package-lock.json b/package-lock.json index ebbe1e7..613d30e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4001,6 +4001,11 @@ "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, + "jquery": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.1.tgz", + "integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw==" + }, "js-beautify": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.10.0.tgz", @@ -4836,6 +4841,11 @@ "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==" }, + "popper.js": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.15.0.tgz", + "integrity": "sha512-w010cY1oCUmI+9KwwlWki+r5jxKfTFDVoadl7MSrIujHU5MJ5OR6HTDj6Xo8aoR/QsA56x8jKjA59qGH4ELtrA==" + }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", diff --git a/package.json b/package.json index 344e874..254d0ac 100644 --- a/package.json +++ b/package.json @@ -26,12 +26,14 @@ "@types/rimraf": "^2.0.2", "@types/underscore": "^1.9.1", "animate.css": "3.7.0", - "bootstrap": "4.2.1", + "bootstrap": "^4.2.1", "glob": "^7.1.4", "handlebars": "^4.1.2", + "jquery": "^3.4.1", "js-yaml": "^3.13.1", "mkdirp": "^0.5.1", "parcel-bundler": "1.12.3", + "popper.js": "^1.15.0", "prettier": "^1.18.2", "progress": "^2.0.3", "rimraf": "^2.6.3", diff --git a/src/template.html b/src/template.html index 7220e46..7589191 100644 --- a/src/template.html +++ b/src/template.html @@ -1,8 +1,34 @@ + + - {{ value }} +
+
+

+

You should give me money. Here's how:

+

+ +

+
+
+ +
+
+
+ {{#list accounts }} +
+ + {{ name }} logo + +
+ {{/list}} +
+
+
+ +