Skip to content

Commit 3278d67

Browse files
committed
fix(scripts): update dist validation to check for index.js and cli.js.bz
- Changed required files from cli.js to index.js and cli.js.bz - Updated bundle size check for compressed .bz file (1-3 MB range)
1 parent b8d2445 commit 3278d67

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

scripts/pre-publish-validate.mjs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,23 +153,25 @@ async function validateDistStructure() {
153153
}
154154

155155
// Required files in dist.
156-
const requiredFiles = ['cli.js', 'package.json']
156+
const requiredFiles = ['index.js', 'cli.js.bz', 'package.json']
157157
for (const file of requiredFiles) {
158158
const filePath = path.join(distPath, file)
159159
if (!(await fileExists(filePath))) {
160160
errors.push(`Required file missing: dist/${file}`)
161161
}
162162
}
163163

164-
// Check CLI file size (sanity check).
165-
const cliPath = path.join(distPath, 'cli.js')
166-
if (await fileExists(cliPath)) {
167-
const stats = await fs.stat(cliPath)
164+
// Check CLI bundle size (sanity check).
165+
const cliBzPath = path.join(distPath, 'cli.js.bz')
166+
if (await fileExists(cliBzPath)) {
167+
const stats = await fs.stat(cliBzPath)
168168
const sizeMB = stats.size / 1_024 / 1_024
169169

170-
if (sizeMB < 5) {
171-
warnings.push(`CLI bundle is suspiciously small: ${sizeMB.toFixed(2)} MB`)
172-
} else if (sizeMB > 20) {
170+
if (sizeMB < 1) {
171+
warnings.push(
172+
`CLI bundle is suspiciously small: ${sizeMB.toFixed(2)} MB`,
173+
)
174+
} else if (sizeMB > 3) {
173175
warnings.push(
174176
`CLI bundle is larger than expected: ${sizeMB.toFixed(2)} MB`,
175177
)

0 commit comments

Comments
 (0)