create-mercato-app 0.6.3-develop.3510.1.e3b22be026 → 0.6.3-develop.3525.2.cc18b8a43f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
|
|
4
|
+
// Greenfield must not inherit the prior run's compiler state. Wiping the
|
|
5
|
+
// configured Next.js distDir (`.mercato/next`) plus the legacy `.next` location guarantees Turbopack rebuilds the route table
|
|
6
|
+
// and middleware manifest from scratch on the next launch.
|
|
7
|
+
export const GREENFIELD_PURGE_TARGETS = Object.freeze([
|
|
8
|
+
Object.freeze(['.mercato', 'next']),
|
|
9
|
+
Object.freeze(['.next']),
|
|
10
|
+
])
|
|
11
|
+
|
|
12
|
+
export function purgeAppBuildCaches({
|
|
13
|
+
rootDir = process.cwd(),
|
|
14
|
+
fsImpl = fs,
|
|
15
|
+
logger = console,
|
|
16
|
+
targets = GREENFIELD_PURGE_TARGETS,
|
|
17
|
+
} = {}) {
|
|
18
|
+
const removed = []
|
|
19
|
+
for (const segments of targets) {
|
|
20
|
+
const target = path.join(rootDir, ...segments)
|
|
21
|
+
if (!fsImpl.existsSync(target)) continue
|
|
22
|
+
fsImpl.rmSync(target, { recursive: true, force: true })
|
|
23
|
+
removed.push(segments.join('/'))
|
|
24
|
+
}
|
|
25
|
+
if (removed.length === 0) {
|
|
26
|
+
logger.log('🧹 [dev:greenfield] no stale Next/Turbopack build directories to purge')
|
|
27
|
+
} else {
|
|
28
|
+
for (const relPath of removed) {
|
|
29
|
+
logger.log(`🧹 [dev:greenfield] removed ${relPath}`)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return { removed }
|
|
33
|
+
}
|
package/template/scripts/dev.mjs
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
resolveProgressPercent,
|
|
23
23
|
stripAnsi,
|
|
24
24
|
} from './dev-splash-helpers.mjs'
|
|
25
|
+
import { purgeAppBuildCaches } from './dev-cache-purge.mjs'
|
|
25
26
|
import { resolveSpawnCommand } from './dev-spawn-utils.mjs'
|
|
26
27
|
import { createDevSplashCodingFlow } from './dev-splash-coding-flow.mjs'
|
|
27
28
|
import { createDevSplashGitRepoFlow } from './dev-splash-git-repo-flow.mjs'
|
|
@@ -1647,6 +1648,7 @@ async function runClassicStandardDev() {
|
|
|
1647
1648
|
}
|
|
1648
1649
|
|
|
1649
1650
|
async function runGreenfieldDev() {
|
|
1651
|
+
purgeAppBuildCaches()
|
|
1650
1652
|
await runStage('🧱 Greenfield build packages', ['build:packages'], { stageCurrent: 1, stageTotal: 5 })
|
|
1651
1653
|
await runStage('🧬 Greenfield generate artifacts', ['generate'], { stageCurrent: 2, stageTotal: 5 })
|
|
1652
1654
|
await runStage('🧱 Greenfield rebuild packages', ['build:packages'], { stageCurrent: 3, stageTotal: 5 })
|
|
@@ -1657,6 +1659,7 @@ async function runGreenfieldDev() {
|
|
|
1657
1659
|
}
|
|
1658
1660
|
|
|
1659
1661
|
async function runClassicGreenfieldDev() {
|
|
1662
|
+
purgeAppBuildCaches()
|
|
1660
1663
|
await runRawYarnCommand(['build:packages'])
|
|
1661
1664
|
await runRawYarnCommand(['generate'])
|
|
1662
1665
|
await runRawYarnCommand(['build:packages'])
|