Skip to content
Open
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 .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
// Lint & Prettify TS and JS files - only the staged files
"**/*.(ts|tsx|js|jsx)": (filenames) => [
`cross-env NODE_ENV=test npx eslint --fix --max-warnings=0 ${filenames.map((f) => `'${f.replace(/'/g, "'\\''")}'`).join(" ")}`,
`cross-env NODE_ENV=test npx eslint --fix --max-warnings=0 --no-warn-ignored ${filenames.map((f) => `'${f.replace(/'/g, "'\\''")}'`).join(" ")}`,
`npx prettier --write ${filenames.map((f) => `'${f.replace(/'/g, "'\\''")}'`).join(" ")}`,
],

Expand Down
59 changes: 47 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,82 @@ setup:
npm install --legacy-peer-deps

# "make site" - The default lightweight build keeps the dev server fast by skipping heavy collections.
## Run a partial build of layer5.io on your local machine.
## Run a lightweight dev server (core profile: excludes blog, events, integrations, members, news, resources).
site:
@echo "🏗️ Building lightweight site version (core profile excludes Members, Integrations, Blog, News, Events, and Resources collections)..."
@echo " Use LITE_BUILD_PROFILE=content make site to include content collections while still skipping the heaviest routes."
@echo "🏗️ Starting dev server — core profile (fastest startup)"
@echo " Excluded: blog, events, integrations, members, news, resources"
@echo " → To include blog/news/events/resources: make site-content"
@echo " → To include all collections: make site-full"
@echo " → See all profiles: make profiles"
@npm run develop:lite

## Run a content dev server (content profile: includes blog, news, events, resources; skips members and integrations).
site-content:
@echo "🏗️ Starting dev server — content profile"
@echo " Excluded: integrations, members"
@echo " → For the lightest build: make site"
@echo " → To include all collections: make site-full"
@npm run develop:content

# "make site-full" forces the dev server to include every collection.
## Run a full build of layer5.io on your local machine.
## Run a full dev server (all collections; slowest startup — includes members and integrations).
site-full:
@echo "🏗️ Building full site version (including Members and Integrations collections)..."
@echo "🏗️ Starting dev server — full profile (all collections)"
@echo " → For a faster dev server: make site"
@npm run develop

## Run layer5.io on your local machine. Alternate method.
## Run dev server directly via gatsby CLI, bypassing env-cmd (skips .env.development; Linux/macOS only).
site-fast:
BUILD_FULL_SITE=false LITE_BUILD_PROFILE=core GATSBY_CPU_COUNT=4 SHARP_CONCURRENCY=4 UV_THREADPOOL_SIZE=4 NODE_OPTIONS=--max-old-space-size=8192 gatsby develop

## Build layer5.io on your local machine.
## Build layer5.io for production.
build:
npm run build

## Empty build cache and rebuild layer5.io on your local machine (developer use only; CI uses `npm run build` directly).
## Clear Gatsby build cache without rebuilding (use before switching profiles or after dependency changes).
cache-clean:
npm run clean

## Clear Gatsby build cache and run a full production build (slow; use make cache-clean to skip the rebuild).
clean:
npm run clean && make build

## Run Eslint on your local machine.
lint:
npm run lint

## Kill process running the site
## Kill process running the site.
kill:
lsof -ti:8000 | xargs kill -9 2>/dev/null || true

## Prepare a list of features for the pricing page.
features:
features:
curl -L https://docs.google.com/spreadsheets/d/e/2PACX-1vQwzrUSKfuSRcpkp7sJTw1cSB63s4HCjYLJeGPWECsvqn222hjaaONQlN4X8auKvlaB0es3BqV5rQyz/pub\?gid\=1153419764\&single\=true\&output\=csv -o .github/build/spreadsheet.csv
node .github/build/features-to-json.js .github/build/spreadsheet.csv src/sections/Pricing/feature_data.json
rm .github/build/spreadsheet.csv

.PHONY: setup build site site-full clean site-fast lint features
## List available build profiles and the collections each excludes.
profiles:
@echo "Build profiles:"
@echo ""
@echo " core (make site) — excludes: blog, events, integrations, members, news, resources"
@echo " content (make site-content) — excludes: integrations, members"
@echo " full (make site-full) — excludes: nothing (all collections included)"
@echo " none (make site-custom) — excludes: only what BUILD_COLLECTIONS_EXCLUDE specifies"
@echo ""
@echo "À la carte (comma-separated collection names to exclude):"
@echo " BUILD_COLLECTIONS_EXCLUDE=members,events make site-custom"

## Analyze webpack bundle with FCP optimization
## Run dev server with only the collections you specify (set BUILD_COLLECTIONS_EXCLUDE to exclude by name).
site-custom:
@echo "🏗️ Starting dev server — custom profile (none base + explicit exclusions)"
@echo " Excluded: $${BUILD_COLLECTIONS_EXCLUDE:-none}"
@echo " Example: BUILD_COLLECTIONS_EXCLUDE=members,events make site-custom"
@npm run develop:custom

## Analyze webpack bundle composition (opens browser with interactive bundle breakdown).
site-analyze:
@echo "🏗️ Building site with webpack bundle analyzer..."
ANALYZE_BUNDLE=true npm run build

.PHONY: setup build site site-content site-full site-fast site-custom cache-clean clean lint kill features profiles site-analyze
8 changes: 7 additions & 1 deletion gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
heading: "Member profiles disabled in lite mode",
description:
"The members collection is intentionally skipped when BUILD_FULL_SITE=false to keep local builds fast.",
enabledBy: "full",
},
},
{
Expand All @@ -646,6 +647,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
heading: "Integrations disabled in lite mode",
description:
"Integrations are heavy to source, so this route shows a placeholder during lightweight builds.",
enabledBy: "full",
},
},
{
Expand All @@ -657,6 +659,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
heading: "Blog posts disabled in lite mode",
description:
"The default lightweight build skips the blog collection to keep local builds responsive.",
enabledBy: "content",
},
},
{
Expand All @@ -668,6 +671,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
heading: "News posts disabled in lite mode",
description:
"The default lightweight build skips the news collection to reduce local memory consumption.",
enabledBy: "content",
},
},
{
Expand All @@ -679,6 +683,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
heading: "Resources disabled in lite mode",
description:
"The default lightweight build skips the resources collection to reduce local memory consumption.",
enabledBy: "content",
},
},
{
Expand All @@ -690,6 +695,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
heading: "Events disabled in lite mode",
description:
"The default lightweight build skips the events collection to keep local builds responsive.",
enabledBy: "content",
},
},
];
Expand All @@ -700,7 +706,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
envCreatePage({
path: page.path,
matchPath: page.matchPath,
context: page.context,
context: { ...page.context, collection: page.collection },
component: LitePlaceholderTemplate,
}),
);
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
"clean:all": "gatsby clean && rimraf node_modules",
"develop": "cross-env BUILD_FULL_SITE=true GATSBY_CPU_COUNT=4 SHARP_CONCURRENCY=4 UV_THREADPOOL_SIZE=4 NODE_OPTIONS=--max-old-space-size=8192 env-cmd -f .env.development gatsby develop",
"develop:lite": "cross-env BUILD_FULL_SITE=false LITE_BUILD_PROFILE=core GATSBY_CPU_COUNT=4 SHARP_CONCURRENCY=4 UV_THREADPOOL_SIZE=4 NODE_OPTIONS=--max-old-space-size=8192 env-cmd -f .env.development gatsby develop",
"develop:content": "cross-env BUILD_FULL_SITE=false LITE_BUILD_PROFILE=content GATSBY_CPU_COUNT=4 SHARP_CONCURRENCY=4 UV_THREADPOOL_SIZE=4 NODE_OPTIONS=--max-old-space-size=8192 env-cmd -f .env.development gatsby develop",
"develop:custom": "cross-env BUILD_FULL_SITE=false LITE_BUILD_PROFILE=none GATSBY_CPU_COUNT=4 SHARP_CONCURRENCY=4 UV_THREADPOOL_SIZE=4 NODE_OPTIONS=--max-old-space-size=8192 env-cmd -f .env.development gatsby develop",
"dev": "npm run develop:lite",
"start": "npm run develop:lite",
"start:content": "npm run develop:content",
"start:full": "npm run develop",
"serve": "gatsby serve",
"lint": "eslint --fix .",
Expand Down
Loading
Loading