SWE-Group6 / phase2

0 stars 1 forks source link

Implement Update Package Endpoint #3

Open celedoniogarcia opened 1 month ago

celedoniogarcia commented 1 month ago

Similar Process to Upload Packages Features

  1. Implement an update-package endpoint that accepts zipped TypeScript (TS) packages.

  2. Unzip the contents of the zipped package and verify the file structure:

    • Check if tsconfig.json, package.json, *.ts files are present.
    • If none are present, reject the package.
  3. Store the files in a temporary location.

  4. Verify the package:

    • Check the version and whether the package is already in the registry.
    • If the package version already exists, reject the update.
  5. Compare contents:

    • Identify any major changes (e.g., new dependencies, removed/added code).
  6. Begin the “de-bloating” process:

    • Ensure that types are preserved (this is important to avoid compilation errors down the line). They should not be tree-shaken or minified.
    • Use webpack to tree-shake the compiled .js files.
    • Use terser to minimize the compiled .js files.
  7. Repackage the optimized files:

    • Compress all optimized files into zip format, including:
      • The preserved type files.
      • Any configuration files.
  8. Store and version the package:

    • Store the final package.
    • Ensure that previous versions are stored alongside the newest version.
nikhildhoka8 commented 1 month ago

Image