Repository navigation
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
Conversation
…trip publishedAt from relation entities
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does it do?
Two one-line fixes:
server/cli.js:alreadyCompiledbecomes!!outDir && fs.existsSync(outDir).server/utils/index.js: insanitizeConfig, the loop over the relation entities deletesrelationEntity.publishedAtinstead ofconfig.publishedAt.Why is it needed?
tsUtils.resolveOutDir()returnsundefined, so the CLI callsfs.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 diffprints:[DEP0187] DeprecationWarning: Passing invalid argument types to fs.existsSync is deprecatedThe result stays
false, only the warning goes. I also dropped theawait, sinceexistsSyncis synchronous.config.publishedAtis already deleted a few lines above, and every other line in that loop works onrelationEntity. 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.