Skip to content

Conversation

@AniketDev7
Copy link
Contributor

@AniketDev7 AniketDev7 commented Jun 24, 2025

[Fix] TypeScript Build & Dependency Issues in Contentstack CLI Monorepo

Summary

This PR resolves all TypeScript build errors and missing dependency issues that were causing CI/CD failures in the Contentstack CLI monorepo (oclif v4, pnpm, TypeScript). The main focus was on the contentstack-import package, but fixes were applied across all affected packages.

Key Changes

  • Fixed all TypeScript type errors in entries.ts by replacing problematic Lodash remove calls with native Array.filter for type safety and compatibility.
  • Installed missing dependencies (tslib, @types/lodash, etc.) in all packages that required them.
  • Updated all prepack scripts to use pnpm run compile for consistency and correct argument forwarding.
  • Verified that the full monorepo build (pnpm run prepack) now completes successfully with no TypeScript errors.

Testing

  • Ran pnpm run prepack at the monorepo root; all packages build and generate manifests/readmes as expected.
  • No TypeScript errors remain in any package.

@AniketDev7 AniketDev7 requested a review from a team as a code owner June 24, 2025 08:10
@AniketDev7 AniketDev7 marked this pull request as draft June 24, 2025 11:34
@AniketDev7 AniketDev7 marked this pull request as ready for review July 1, 2025 15:10
const { title, uid } = entry;
// NOTE Remove from list if any entry import failed
remove(this.entriesForVariant, { locale, entry_uid: uid });
this.entriesForVariant = this.entriesForVariant.filter(entry => !(entry.locale === locale && entry.entry_uid === uid));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did we remove this method and added inline code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Shafeeq,

I replaced the lodash remove method with the native .filter() approach to avoid mutating the original array. The new code is more predictable, aligns with modern JavaScript/TypeScript best practices, and improves code safety by ensuring immutability.

@shafeeqd959
Copy link
Contributor

need to push latest package-lock file, please run "npm run setup-repo" on local.

@AniketDev7
Copy link
Contributor Author

Closing this PR due to version conflicts

@AniketDev7 AniketDev7 closed this Jul 3, 2025
@AniketDev7 AniketDev7 deleted the fix/typescript-build branch September 17, 2025 15:02
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.

4 participants