Skip to content

Commit

Permalink
feat(cli): Skip sourcemap files when creating bundle zip (#161)
Browse files Browse the repository at this point in the history
* chore: Skip sourcemap files when creating bundle zip

* change package name & version

* refactor: Modify createZip to accept excludeExts variable

* Revert "change package name & version"

This reverts commit f008cf7.

* Update packages/hot-updater/src/commands/init/aws/index.ts

Co-authored-by: Sungyu Kang <[email protected]>

* fix: biome

---------

Co-authored-by: Sungyu Kang <[email protected]>
  • Loading branch information
rjwu95 and gronxb authored Feb 28, 2025
1 parent 29d9992 commit c36f017
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/hot-updater/src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export const deploy = async (options: DeployOptions) => {
await createZip({
outfile: bundlePath,
targetDir: taskRef.buildResult.buildPath,
excludeExts: [".map"],
});

bundleId = taskRef.buildResult.bundleId;
Expand Down
7 changes: 6 additions & 1 deletion packages/hot-updater/src/utils/createZip.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import path from "path";
import fs from "fs/promises";

import JSZip from "jszip";

export const createZip = async ({
outfile,
targetDir,
excludeExts = [],
}: {
targetDir: string;
outfile: string;
excludeExts?: string[];
}) => {
const zip = new JSZip();
await fs.rm(outfile, { force: true });
Expand All @@ -18,6 +19,10 @@ export const createZip = async ({
files.sort();

for (const file of files) {
if (excludeExts.some((pattern) => file.includes(pattern))) {
continue;
}

const fullPath = path.join(dir, file);
const stats = await fs.stat(fullPath);

Expand Down

0 comments on commit c36f017

Please sign in to comment.