Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: move build to default directory, add sitemap (resolves #254) #257

Merged
merged 6 commits into from
Aug 15, 2023
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
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.git
node_modules
out
_site
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
HEADLESS: true

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Cache node modules
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
Expand Down
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/node_modules/
/dist/
*~
.project
.DS_Store
_site
node_modules
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ FROM node:18-alpine AS builder

WORKDIR /app

RUN apk add --no-cache git

COPY package.json ./

RUN apk add --no-cache git

RUN npm install

COPY . ./

RUN echo | npm run build

RUN npm run build

FROM nginx:1.18.0-alpine

COPY --from=builder /app/out /usr/share/nginx/html
COPY --from=builder /app/_site /usr/share/nginx/html
3 changes: 1 addition & 2 deletions eleventy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ module.exports = function (eleventyConfig) {

return {
dir: {
input: "src",
output: "dist"
input: "src"
}
};
};
4 changes: 2 additions & 2 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[build]
command = "npm run build"
publish = "dist"
publish = "_site"
ignore = "git log -1 --pretty=%B | grep dependabot"

[dev]
command = "npm run start"
targetPort = 8080
publish = "dist"
publish = "_site"
autoLaunch = false
framework = "#custom"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"start": "npm-run-all -l clean dev",
"build": "npm-run-all -l clean build:*",
"build:eleventy": "cross-env ELEVENTY_ENV=production eleventy",
"clean": "npx rimraf dist",
"clean": "rimraf _site",
"dev": "cross-env ELEVENTY_ENV=development eleventy --serve",
"lint": "fluid-lint-all",
"pretest": "npm run build",
Expand Down
5 changes: 5 additions & 0 deletions src/_data/site.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

module.exports = {
url: process.env.DEPLOY_PRIME_URL || "http://localhost:8080"
};
11 changes: 11 additions & 0 deletions src/robots.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
permalink: /robots.txt
eleventyExcludeFromCollections: true
---
Sitemap: {{ site.url }}/sitemap.xml

User-Agent: *
Disallow: /404.html

User-agent: GPTBot
Disallow: /
2 changes: 1 addition & 1 deletion src/scripts/create-search-digest.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ fluid.docs.search.digester.stripTags = function (rawHTML) {
fluid.defaults("fluid.docs.search.digester", {
gradeNames: ["fluid.component"],
documentsRoot: "%infusion-docs/src/documents",
outputPath: "%infusion-docs/dist/js/search-digest.js",
outputPath: "%infusion-docs/_site/js/search-digest.js",
outputTemplate: "(function (fluid) {\n \"use strict\";\n fluid.registerNamespace(\"fluid.docs.search\");\n fluid.docs.search.digest = %digest;\n\n fluid.docs.search.index = %index; \n})(fluid);\n",
members: {
digestBlocks: []
Expand Down
15 changes: 15 additions & 0 deletions src/sitemap.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
permalink: /sitemap.xml
eleventyExcludeFromCollections: true
---
<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% for page in collections.all %}
{%- if page.url -%}
<url>
<loc>{{ site.url }}{{ page.url | url }}</loc>
<lastmod>{{ page.date.toISOString() }}</lastmod>
</url>
{% endif -%}
{%- endfor -%}
</urlset>
2 changes: 1 addition & 1 deletion tests/browser/test-search-manipulation.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<script type="text/javascript" src="../../node_modules/infusion/tests/test-core/utils/js/IoCTestUtils.js"></script>

<script type="text/javascript" src="../../node_modules/lunr/lunr.js"></script>
<script type="text/javascript" src="../../dist/js/search-digest.js"></script>
<script type="text/javascript" src="../../_site/js/search-digest.js"></script>
<script type="text/javascript" src="../../src/static/js/search-string-parser.js"></script>
<script type="text/javascript" src="../../src/static/js/search.js"></script>

Expand Down
2 changes: 1 addition & 1 deletion tests/browser/test-search-string-parser.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<script type="text/javascript" src="../../node_modules/fluid-binder/src/js/transforms.js"></script>
<script type="text/javascript" src="../../node_modules/fluid-binder/src/js/binder.js"></script>
<script type="text/javascript" src="../../node_modules/fluid-location-bar-relay/src/js/locationBar.js"></script>
<script type="text/javascript" src="../../dist/js/search-digest.js"></script>
<script type="text/javascript" src="../../_site/js/search-digest.js"></script>
<script type="text/javascript" src="../../src/static/js/search-string-parser.js"></script>

<!-- QUnit/jqUnit dependencies -->
Expand Down
2 changes: 1 addition & 1 deletion tests/browser/test-search.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<script type="text/javascript" src="../../node_modules/fluid-binder/src/js/binder.js"></script>
<script type="text/javascript" src="../../node_modules/fluid-location-bar-relay/src/js/locationBar.js"></script>
<script type="text/javascript" src="../../node_modules/lunr/lunr.js"></script>
<script type="text/javascript" src="../../dist/js/search-digest.js"></script>
<script type="text/javascript" src="../../_site/js/search-digest.js"></script>
<script type="text/javascript" src="../../src/static/js/search-string-parser.js"></script>
<script type="text/javascript" src="../../src/static/js/search.js"></script>

Expand Down