Skip to content

Commit

Permalink
feat: only print tags and redir generation in debug mode (#907)
Browse files Browse the repository at this point in the history
Reduce the noise caused at build by too much output, so we don't
risk to miss important messages.

Building DEBUG=true re-enables the logs.

Also just use cp(1) and ln(1) instead of a node package.
  • Loading branch information
bfabio authored Nov 15, 2023
1 parent ad0aa8d commit 62f74f3
Show file tree
Hide file tree
Showing 546 changed files with 562 additions and 773 deletions.
13 changes: 10 additions & 3 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ exports.createPages = async ({ graphql, actions }) => {
}
`);
tags.data.tagsGroup.group.forEach((tag) => {
console.log(`Creating tag page: ${tag.fieldValue}`);
if (process.env.DEBUG === "true") {
console.log(`Creating tag page: ${tag.fieldValue}`);
}
createPage({
path: `/argomenti/${_.kebabCase(tag.fieldValue)}/`,
component: tagTemplate,
Expand All @@ -153,7 +155,9 @@ exports.createPages = async ({ graphql, actions }) => {
}
`);
tagsDesignSystem.data.tagsDesignSystemGroup.group.forEach((tag) => {
console.log(`Creating tag page: ${tag.fieldValue}`);
if (process.env.DEBUG === "true") {
console.log(`Creating tag page: ${tag.fieldValue}`);
}
createPage({
path: `/design-system/componenti/utili-per/${_.kebabCase(
tag.fieldValue,
Expand Down Expand Up @@ -187,7 +191,10 @@ exports.createPages = async ({ graphql, actions }) => {
const { node } = edge;
node.metadata.redirect_from.forEach((fromPath) => {
const toPath = edge.node.seo.pathname;
console.log(`Creating redirect: ${fromPath} -> ${toPath}...`);
if (process.env.DEBUG === "true") {
console.log(`Creating redirect: ${fromPath} -> ${toPath}...`);
}

createRedirect({ fromPath, toPath });
});
});
Expand Down
217 changes: 0 additions & 217 deletions package-lock.json

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

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"site"
],
"scripts": {
"prepare-lib": "recursive-copy -w ./node_modules/bootstrap-italia/dist/svg/ ./static/svg/ && recursive-copy -w ./node_modules/bootstrap-italia/dist/svg/ ./static/dist/svg/ && recursive-copy -w ./node_modules/bootstrap-italia/dist/fonts/ ./static/fonts/ && recursive-copy -w ./node_modules/bootstrap-italia/dist/fonts/ ./static/dist/fonts/",
"prepare-lib": "cp -r node_modules/bootstrap-italia/dist/svg/ static/ && cp -r node_modules/bootstrap-italia/dist/fonts static/",
"prepare-content": "node ./scripts/prepare.js",
"start": "npm run prepare-lib && gatsby develop",
"develop": "npm run start",
Expand Down Expand Up @@ -88,7 +88,6 @@
"gh-pages": "^6.0.0",
"mustache": "^4.2.0",
"prettier": "3.0.3",
"recursive-copy-cli": "^1.0.20",
"slugify": "^1.6.5"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
<script
src="https://cdn.jsdelivr.net/npm/bootstrap-italia@2.7.5/dist/js/bootstrap-italia.bundle.min.js"></script>
<script>
bootstrap.loadFonts(window.__PUBLIC_PATH__ = "/dist/fonts/");
bootstrap.loadFonts(window.__PUBLIC_PATH__ = "/fonts/");

// tooltip
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ <h2 class="accordion-header" id="heading3a">
<script
src="https://cdn.jsdelivr.net/npm/bootstrap-italia@2.7.5/dist/js/bootstrap-italia.bundle.min.js"></script>
<script>
bootstrap.loadFonts(window.__PUBLIC_PATH__ = "/dist/fonts/");
bootstrap.loadFonts(window.__PUBLIC_PATH__ = "/fonts/");

// tooltip
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
Expand Down
2 changes: 1 addition & 1 deletion static/examples/bsi/componenti/accordion/accordion.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ <h2 class="accordion-header" id="heading3">
<script
src="https://cdn.jsdelivr.net/npm/bootstrap-italia@2.7.5/dist/js/bootstrap-italia.bundle.min.js"></script>
<script>
bootstrap.loadFonts(window.__PUBLIC_PATH__ = "/dist/fonts/");
bootstrap.loadFonts(window.__PUBLIC_PATH__ = "/fonts/");

// tooltip
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
Expand Down
Loading

0 comments on commit 62f74f3

Please sign in to comment.