Skip to content

fix: no fs.existsSync(undefined) in the CLI on JavaScript projects; strip publishedAt from relation entities - #246

Open
PaulRichez wants to merge 1 commit into
pluginpal:masterfrom
PaulRichez:fix/cli-outdir-and-publishedat
Open

PaulRichez wants to merge 1 commit into
pluginpal:masterfrom
PaulRichez:fix/cli-outdir-and-publishedat

Conversation

@PaulRichez

Copy link
Copy Markdown
Contributor

What does it do?

Two one-line fixes:

  • server/cli.js: alreadyCompiled becomes !!outDir && fs.existsSync(outDir).
  • server/utils/index.js: in sanitizeConfig, the loop over the relation entities deletes relationEntity.publishedAt instead of config.publishedAt.

Why is it needed?

  • On a JavaScript project, tsUtils.resolveOutDir() returns undefined, so the CLI calls fs.existsSync(undefined). Recent Node versions print a warning for it on every CLI command that loads the app. With 3.3.0 on Node 24.14, npx config-sync diff prints:
    [DEP0187] DeprecationWarning: Passing invalid argument types to fs.existsSync is deprecated
    The result stays false, only the warning goes. I also dropped the await, since existsSync is synchronous.
  • The second one looks like a typo: config.publishedAt is already deleted a few lines above, and every other line in that loop works on relationEntity. I didn't find a case where it changes the output, so it's mostly for consistency.

How to test it?

In a JavaScript Strapi app on Node 24, run npx config-sync diff: the DEP0187 warning shows before this change, not after. The diff itself is unchanged.

Related issue(s)/PR(s)

None.

@codecov

codecov Bot commented Nov 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (7166c56) to head (17532ef).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #246   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines           22        22           
  Branches         3         3           
=========================================
  Hits            22        22           
Flag Coverage Δ
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant