Skip to content

Commit

Permalink
Initial commit POC with templartes
Browse files Browse the repository at this point in the history
  • Loading branch information
stvp-qld committed Dec 18, 2023
1 parent 24c5a08 commit 95858f2
Show file tree
Hide file tree
Showing 7,794 changed files with 1,727,188 additions and 2 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# QGDS - Queensland Online MVP
MVP development space for Queensland Online Design System
# qgds-bootstrap-poc
73 changes: 73 additions & 0 deletions build-template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/// DEV NOTE
/// This build file is used for the demo/POC template rendering only
/// Full templating system to be planned and implemented in the future

import fs from "fs";
import mustache from "mustache";

import QGDSTemplate from "./src/js/qgds-template.js";
import QGDSComponent from "./src/js/qgds-component.js";

const breadcrumbs = QGDSComponent.make("breadcrumbs");
const banner = QGDSComponent.make("banner", {
data: {
breadcrumbs: breadcrumbs,
title: "Register your vehicle or motorcycles",
content: "Motor vehicles and motorcycles (including mopeds and tricycles) used on Queensland roads must be registered.",
classes: "banner-default",
}
});

//Build a static content page with some components
QGDSTemplate.make({
layout: "contentpage", // HTML template - similar to design file
content: "main", // Primary content - similar to paint layout
outfile: "index.html", // ...compiles into /dist/index.html
theme: "", // adds a "data-bs-theme" attribute to the <html> tag
banner: banner, // Banner component is compiled above using QDSComponent.make("banner", {...})

//Components that will be used on either the layout or content
components: {
inpagenav: QGDSComponent.make("inpagenav"),
accordion: QGDSComponent.make("accordion"),

// Different ways to load an alert:
// 1. No datafile, no data
// 2. Pass custom data object
// 3. Pass datafile
alerts: {
closure: QGDSComponent.make("alert"),
receipt: QGDSComponent.make("alert", {
data: {
classes: "alert-success",
title: "Your transaction is complete",
content:
"<p>You're reference number is ATMR-1234-456. <a href='#'>Download a receipt</a></p>",
},
}),
reminder: QGDSComponent.make("alert", {
datafile: "./src/components/alert/service-unavailable.json",
}),
},

button: QGDSComponent.make("button"),
card: QGDSComponent.make("card"),
table: QGDSComponent.make("table"),
blockquote: QGDSComponent.make("blockquote"),
callout: QGDSComponent.make("callout", {
data: {
title: "This is a callout title",
content: "This is a callout description",
classes: "mb-5",
},
}),
cardblock: QGDSComponent.make("cardblock", {
path: "./src/components/card/cardblock.bs5.html",
datafile: "./src/components/card/cardblock.data.json",
}),
},
});

console.log(
`HTML template builds completed\n===============================\n`
);
90 changes: 90 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
// PROJECT ESBUILD CONFIGURATION and BUILD FILE
import * as esbuild from 'esbuild';
import * as path from 'path';

//Required libraries
import {sassPlugin} from 'esbuild-sass-plugin';
import handlebarsPlugin from "esbuild-plugin-handlebars";
import postcss from 'postcss';
import autoprefixer from 'autoprefixer';
import { copy } from 'esbuild-plugin-copy';

// Configuration
// https://esbuild.github.io/getting-started/#build-scripts

const buildConfig = {
outdir: './dist/',
external: ['fs', 'path', "../img/*"],
entryPoints: [
{ out: './assets/js/bootstrap.min', in: './node_modules/bootstrap/dist/js/bootstrap.js' },
{ out: './assets/js/main', in: './src/main.js' },
{ out: './assets/css/qld.bootstrap', in: './src/main.scss' },
],
bundle: true,
minify: false,
loader: {
'.html' : 'text',
'.js': 'jsx',
'.jpg': 'file',
},
target: ['es6'],
plugins: [
//Pass the following plugins to ESBuild to help with compiling
// SASS processing, includes POSTCSS
sassPlugin({
type: 'css',
async transform(source) {
const { css } = await postcss([autoprefixer]).process(source, {
from: 'src/main.scss',
to: 'dist/assets/css/qld.bootstrap.css',
map: true
});
return css;
},
}),
// Handlebars processing
handlebarsPlugin(),

// 1. Copy various files from /src to /dist as part of workflow.
// 2. Copy files from /dist to /docs as part of workflow.
copy({
// this is equal to process.cwd(), which means we use cwd path as base path to resolve `to` path
// if not specified, this plugin uses ESBuild.build outdir/outfile options as base path.
resolveFrom: 'cwd',
assets: [
{
from: ['./src/templates/*.html'],
to: ['./dist/'],
},
{
from: ['./src/components/**/*.dxp.html'],
to: ['./dist/components/dxp/'],
},
{
from: ['./src/components/**/*.bs5.html'],
to: ['./dist/components/bs5/'],
},
{
from: ['./src/components/**/*.hbs.html'],
to: ['./dist/components/dxp/'],
},
{
from: ['./src/img/*'],
to: ['./dist/assets/img'],
},
{
from: ['./dist/**/*'],
to: ['./docs/'],
}
],
watch: true,
}),
]
};

// Call esbuild's build() function with our configuration
// This is the default project build function, it runs when we call "node build.js", or "npm run build"
(async () => {
await esbuild.build(buildConfig);
console.log('⚡ Build successful ⚡');
})();
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const server = Bun.serve({
port: Bun.env.port || 8000,
fetch(req) {
return new Response('Hello world 123')
}
})

console.log(`Listening on port ${server.port}`);
18 changes: 18 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"lib": ["ES6"],
"target": "ES6",
"module": "ES2015",
"moduleResolution": "bundler",
"moduleDetection": "force",
"allowImportingTsExtensions": true,
"noEmit": true,
"composite": true,
"strict": true,
"downlevelIteration": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"allowJs": true
}
}
4 changes: 4 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
git:
git add .
git commit -m "$m"
git push -u origin main
1 change: 1 addition & 0 deletions node_modules/.bin/acorn

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

1 change: 1 addition & 0 deletions node_modules/.bin/atob

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

1 change: 1 addition & 0 deletions node_modules/.bin/autoprefixer

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

1 change: 1 addition & 0 deletions node_modules/.bin/browserslist

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

1 change: 1 addition & 0 deletions node_modules/.bin/envinfo

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

1 change: 1 addition & 0 deletions node_modules/.bin/esbuild

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

1 change: 1 addition & 0 deletions node_modules/.bin/flat

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

1 change: 1 addition & 0 deletions node_modules/.bin/glob

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

1 change: 1 addition & 0 deletions node_modules/.bin/handlebars

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

1 change: 1 addition & 0 deletions node_modules/.bin/import-local-fixture

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

1 change: 1 addition & 0 deletions node_modules/.bin/live-server

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

1 change: 1 addition & 0 deletions node_modules/.bin/mime

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

1 change: 1 addition & 0 deletions node_modules/.bin/mustache

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

1 change: 1 addition & 0 deletions node_modules/.bin/nanoid

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

1 change: 1 addition & 0 deletions node_modules/.bin/node-which

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

1 change: 1 addition & 0 deletions node_modules/.bin/onchange

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

1 change: 1 addition & 0 deletions node_modules/.bin/resolve

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

1 change: 1 addition & 0 deletions node_modules/.bin/rimraf

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

1 change: 1 addition & 0 deletions node_modules/.bin/sass

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

1 change: 1 addition & 0 deletions node_modules/.bin/terser

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

1 change: 1 addition & 0 deletions node_modules/.bin/tree-kill

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

1 change: 1 addition & 0 deletions node_modules/.bin/tsc

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

1 change: 1 addition & 0 deletions node_modules/.bin/tsserver

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

1 change: 1 addition & 0 deletions node_modules/.bin/uglifyjs

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

1 change: 1 addition & 0 deletions node_modules/.bin/update-browserslist-db

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

1 change: 1 addition & 0 deletions node_modules/.bin/uuid

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

1 change: 1 addition & 0 deletions node_modules/.bin/watch

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

1 change: 1 addition & 0 deletions node_modules/.bin/webpack

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

1 change: 1 addition & 0 deletions node_modules/.bin/webpack-cli

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

Loading

0 comments on commit 95858f2

Please sign in to comment.