diff --git a/app/.eleventy.js b/app/.eleventy.js index 2f4732487a..bb5510e861 100644 --- a/app/.eleventy.js +++ b/app/.eleventy.js @@ -71,6 +71,7 @@ module.exports = function (eleventyConfig) { eleventyConfig.addPassthroughCopy({ "src/img": "assets/img", + "src/js": "src/js", "site/img": "assets/img", "site/_includes/css": "css", "site/_includes/js": "assets/js", @@ -88,7 +89,7 @@ module.exports = function (eleventyConfig) { "stroke-width": 2, }) - const pathPrefix = process.env.NODE_ENV === "production" ? "/metrics" : "" + const pathPrefix = process.env.NODE_ENV.includes("production") ? "/metrics" : "" return { dir: { diff --git a/app/package.json b/app/package.json index 843e4eb742..cacb07c4dc 100644 --- a/app/package.json +++ b/app/package.json @@ -8,6 +8,11 @@ "start:eleventy": "eleventy --serve", "start:rollup": "rollup --config rollup.config.mjs -w", "start:postcss": "postcss ./src/css -d ./site/_includes/css -w", + "prod": "NODE_ENV=test-production run-s -l prod:*", + "prod:clean": "rm -rf dist", + "prod:rollup": "rollup --config rollup.config.mjs --bundleConfigAsCjs", + "prod:postcss": "postcss ./src/css -d ./site/_includes/css", + "prod:eleventy": "eleventy --serve", "build": "NODE_ENV=production run-s -l build:*", "build:clean": "rm -rf dist", "build:rollup": "rollup --config rollup.config.mjs --bundleConfigAsCjs", diff --git a/app/postcss.config.js b/app/postcss.config.js index 0173ea5fee..81de268979 100644 --- a/app/postcss.config.js +++ b/app/postcss.config.js @@ -2,7 +2,7 @@ module.exports = { plugins: [ require("postcss-import"), require("autoprefixer"), - ...(process.env.NODE_ENV === "production" + ...(process.env.NODE_ENV.includes("production") ? [ require("cssnano"), require("@fullhuman/postcss-purgecss")({ diff --git a/app/rollup.config.mjs b/app/rollup.config.mjs index 05b7f3c529..627beb0670 100644 --- a/app/rollup.config.mjs +++ b/app/rollup.config.mjs @@ -14,7 +14,7 @@ export default [ resolve(), babel(), commonjs(), - ...(process.env.NODE_ENV === "production" ? [terser()] : []), + ...(process.env.NODE_ENV.includes("production") ? [terser()] : []), ], }, ] diff --git a/app/site/_data/projects.js b/app/site/_data/projects.js index fcf5651d3b..dbded66961 100644 --- a/app/site/_data/projects.js +++ b/app/site/_data/projects.js @@ -3,10 +3,10 @@ const path = require("path"); module.exports = function () { const dataDirectory = path.join(__dirname); - var projects = []; + const projects = []; // Read the list of organization directories - var orgDirectories = fs.readdirSync(dataDirectory); + const orgDirectories = fs.readdirSync(dataDirectory); // Iterate through organization directories orgDirectories.forEach((orgDirectory) => { @@ -37,7 +37,8 @@ module.exports = function () { } }); } + }); - - return projects; + + return projects }; diff --git a/app/site/_data/site.js b/app/site/_data/site.js index dc94bb5e9e..5d74e4ba3f 100644 --- a/app/site/_data/site.js +++ b/app/site/_data/site.js @@ -1,9 +1,10 @@ -const production = process.env.NODE_ENV === "production" +const isProduction = process.env.NODE_ENV.includes("production") +const isTest = process.env.NODE_ENV.includes("test") -const host = production ? "https://dsacms.github.io" : "http://0.0.0.0:8080" +const host = (isProduction && !isTest) ? "https://dsacms.github.io" : "http://localhost:8080" // For modifying the tag -const baseurl = production ? "/metrics" : "" +const baseurl = isProduction ? "/metrics" : "" module.exports = { name: "CMS Metrics Website", @@ -13,8 +14,8 @@ module.exports = { baseurl, url: `${host}${baseurl}`, domain: (host || "").replace("https://", ""), - production, - robots: production, + production: isProduction, + robots: isProduction, locale: "en-US", // TODO: Add nav elements for deployment nav: [{ url: "/about/", label: "About" }], diff --git a/app/site/_includes/assets.liquid b/app/site/_includes/assets.liquid index ddaa6be481..09e5a2cf5c 100644 --- a/app/site/_includes/assets.liquid +++ b/app/site/_includes/assets.liquid @@ -31,3 +31,5 @@ + + diff --git a/app/site/_includes/banner.liquid b/app/site/_includes/banner.liquid index f0d72cebd2..fbfd6f2bc4 100644 --- a/app/site/_includes/banner.liquid +++ b/app/site/_includes/banner.liquid @@ -12,7 +12,8 @@

-{% comment %}
+
@@ -100,4 +101,5 @@ -
{% endcomment %} +
+ diff --git a/app/site/_includes/graph-section.liquid b/app/site/_includes/graph-section.liquid index 685f5ce053..2acf3ead46 100644 --- a/app/site/_includes/graph-section.liquid +++ b/app/site/_includes/graph-section.liquid @@ -1,17 +1,31 @@ -{% assign className = class | default: 'graph-container' %} +{% assign className = class | default: 'graph-container-{{ title | slugify}}' %} {% assign devPath = 'site/_graphs' | append: path %} {% assign distPath = baseurl | append: '/assets/img/graphs' | append: path %} {% assign fileExtension = path | split: '.' | last %} +{% assign modal_description = modal_description %} {% if devPath | fileExists %}
-

{{ title }}

-
- {% if fileExtension == 'svg' %} - - {% else %} - - {% endif %} -
+
+

{{ title }}

+
+ {% if fileExtension == 'svg' %} + + {% else %} + + {% endif %} +
+ + {% render "modal-content", title: title, modal_description: modal_description %} +
{% endif %} diff --git a/app/site/_includes/graph-toggle.liquid b/app/site/_includes/graph-toggle.liquid index bc693f6ed9..e3eef876dd 100644 --- a/app/site/_includes/graph-toggle.liquid +++ b/app/site/_includes/graph-toggle.liquid @@ -1,6 +1,7 @@ {% assign graphName = name| append: "-graph" %} {% assign buttonName = name | append: "-button-" %} {% assign graphsCheck = true %} +{% assign modal_description = modal_description %} {% comment %} Check for file existence of graphs {% endcomment %} {% for path in graphs %} @@ -13,36 +14,49 @@ {% comment %} Render components accordingly {% endcomment %} {% if graphsCheck %} -
-

{{ title }}

-
{% endfor %} - - {% for graph in graphs %} - {% if forloop.first %} -
- {% else %} - - {% endfor %} +
{% endif %} \ No newline at end of file diff --git a/app/site/_includes/modal-content.liquid b/app/site/_includes/modal-content.liquid new file mode 100644 index 0000000000..74a422062e --- /dev/null +++ b/app/site/_includes/modal-content.liquid @@ -0,0 +1,37 @@ +
+ +
\ No newline at end of file diff --git a/app/site/_includes/nav.liquid b/app/site/_includes/nav.liquid index 76861cd8ce..22a5b9b326 100644 --- a/app/site/_includes/nav.liquid +++ b/app/site/_includes/nav.liquid @@ -1,39 +1,63 @@
-
-
+
+
+
+ +

Metrics Website

+
-
-