Skip to content

Commit 7e33e1a

Browse files
chore: lastModified fix
1 parent 37e7657 commit 7e33e1a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

packages/example-nextjs16/next.config.mjs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@ const ROOT = path.resolve(import.meta.dirname, '../..');
1818
* without a .git directory).
1919
*/
2020
function contentLastModified() {
21-
try {
22-
const iso = execSync('git log -1 --format=%cI', {
21+
const gitDate = (args) =>
22+
execSync(`git log -1 --format=%cI ${args}`, {
2323
cwd: ROOT,
2424
encoding: 'utf8',
2525
stdio: ['ignore', 'pipe', 'ignore'],
2626
}).trim();
27+
try {
28+
// Scoped to this package: a library release is not a change to any page
29+
// here, yet this date moved on every commit. HEAD stays the fallback for
30+
// a shallow clone, where a path-scoped log can find nothing.
31+
const iso = gitDate('-- packages/example-nextjs16') || gitDate('');
2732
if (iso) return new Date(iso).toISOString();
2833
} catch {
2934
// Not a git checkout — fall through.

0 commit comments

Comments
 (0)