Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
respondeo/scripts/check-template-sync.sh at main · sebdanielsson/respondeo · GitHub
Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
sebdanielsson
respondeo
Repository navigation
Code
Issues
6
(6)
Pull requests
2
(2)
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
respondeo
/
scripts
/
check-template-sync.sh
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
executable file
·
161 lines (139 loc) · 5.42 KB
main
Breadcrumbs
respondeo
/
scripts
/
check-template-sync.sh
Copy path
Top
File metadata and controls
Code
Blame
executable file
·
161 lines (139 loc) · 5.42 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!
/usr/bin/env bash
#
#
Fail if the published template has drifted from apps/web.
#
#
examples/respondeo is what `npx create-respondeo-app` downloads, but it is not
#
a pnpm workspace member, so CI never typechecks, lints or builds it. Drift is
#
therefore invisible until it reaches a user: the template had silently fallen
#
a migration behind its own schema, kept an `images.remotePatterns` entry of
#
"*.*.*" (an open image proxy) after apps/web was hardened, and shipped a whole
#
major of the AI SDK behind the app along with the pre-hardening quiz player
#
that sent the answer key to the client.
#
#
The template is now kept as a full mirror of apps/web's application source and
#
dependency set. Only the files listed under DIVERGENT_PATHS may differ, and
#
each one differs because the template is standalone rather than a workspace
#
member. Everything else must match byte for byte.
set
-uo pipefail
cd
"
$(
dirname
"
$0
"
)
/..
"
WEB=
"
apps/web
"
TEMPLATE=
"
examples/respondeo
"
#
Must be byte-identical between the app and the template. Directories are
#
compared recursively, so a file added to apps/web but not the template fails
#
here too.
SHARED_PATHS=(
"
app
"
"
components
"
"
lib
"
"
drizzle
"
"
public
"
"
.env.compose.example
"
"
.env.example
"
"
components.json
"
"
compose.yaml
"
"
drizzle.config.ts
"
"
next.config.ts
"
"
scripts/test-integration.sh
"
"
stylelint.config.ts
"
"
vitest.config.ts
"
)
#
Deliberately different, and why. Listed here so the divergence is a documented
#
decision rather than an oversight:
#
#
package.json name/scripts are the template's; deps are checked below.
#
tsconfig.json inlines the root tsconfig instead of extending it.
#
.oxlintrc.json inlines the root oxlint config instead of extending it.
#
eslint.config.ts drops eslint-config-turbo, which needs a turbo.json.
#
README.md template-only, documents scaffolding rather than the app.
#
vercel.json apps/web sets git.deploymentEnabled: false because it is
#
deployed from GitHub Actions; a scaffolded app should keep
#
Vercel's Git deploys. Everything else is checked below.
#
#
apps/web additionally keeps turbo.json, docs/ and tests/, which are monorepo
#
infrastructure and are intentionally absent from the template.
status=0
for
path
in
"
${SHARED_PATHS[@]}
"
;
do
if
[
!
-e
"
$WEB
/
$path
"
]
;
then
echo
"
error:
$WEB
/
$path
does not exist
"
status=1
continue
fi
if
[
!
-e
"
$TEMPLATE
/
$path
"
]
;
then
echo
"
error:
$TEMPLATE
/
$path
is missing (present in
$WEB
)
"
status=1
continue
fi
if
!
diff -r -q
"
$WEB
/
$path
"
"
$TEMPLATE
/
$path
"
>
/dev/null
2>&1
;
then
echo
"
error:
$path
differs between
$WEB
and
$TEMPLATE
"
diff -r -u
"
$WEB
/
$path
"
"
$TEMPLATE
/
$path
"
|
head -40
status=1
fi
done
#
vercel.json must match apart from the `git` key, which only apps/web sets.
if
!
node --input-type=module -e
'
import { readFileSync } from "node:fs";
import { isDeepStrictEqual } from "node:util";
const read = (p) => {
const { git, ...rest } = JSON.parse(readFileSync(p, "utf8"));
return rest;
};
if (!isDeepStrictEqual(read("apps/web/vercel.json"), read("examples/respondeo/vercel.json"))) {
console.error("error: vercel.json differs between apps/web and examples/respondeo (beyond the git key)");
process.exit(1);
}
'
;
then
status=1
fi
#
Dependency ranges must match so the template never ships a different major of
#
a runtime dependency than the app it is a copy of. The two documented
#
exceptions are tooling the workspace root supplies to apps/web but a
#
standalone template has to declare (oxfmt), or that only makes sense inside
#
the monorepo (eslint-config-turbo).
if
!
node --input-type=module -e
'
import { readFileSync } from "node:fs";
const read = (p) => JSON.parse(readFileSync(p, "utf8"));
const web = read("apps/web/package.json");
const template = read("examples/respondeo/package.json");
const WEB_ONLY = new Set(["eslint-config-turbo"]);
const TEMPLATE_ONLY = new Set(["oxfmt"]);
let ok = true;
for (const field of ["dependencies", "devDependencies"]) {
const a = web[field] ?? {};
const b = template[field] ?? {};
for (const [name, range] of Object.entries(a)) {
if (WEB_ONLY.has(name)) continue;
if (!(name in b)) {
console.error(`error: ${field}.${name} is in apps/web but not the template`);
ok = false;
} else if (b[name] !== range) {
console.error(`error: ${field}.${name} is "${range}" in apps/web but "${b[name]}" in the template`);
ok = false;
}
}
for (const name of Object.keys(b)) {
if (TEMPLATE_ONLY.has(name)) continue;
if (!(name in a)) {
console.error(`error: ${field}.${name} is in the template but not apps/web`);
ok = false;
}
}
}
process.exit(ok ? 0 : 1);
'
;
then
status=1
fi
if
[
"
$status
"
-ne
0 ]
;
then
cat
<<
'
MSG
'
The published template has drifted from apps/web.
examples/respondeo is downloaded verbatim by create-respondeo-app, so it must
stay a mirror of the app. Copy the changed paths across, e.g.:
rm -rf examples/respondeo/lib && cp -a apps/web/lib examples/respondeo/lib
cp apps/web/next.config.ts examples/respondeo/next.config.ts
and mirror any dependency range you changed in apps/web/package.json into
examples/respondeo/package.json.
If a difference is deliberate, add the path to DIVERGENT_PATHS in this script
with a one-line reason instead of leaving it to be rediscovered later.
MSG
exit
1
fi
echo
"
Template is in sync with apps/web on all shared paths and dependencies.
"
You can’t perform that action at this time.