Skip to content

During deployment, the packaging command did not exclude the ignore files. #250

@KaneOne

Description

@KaneOne

👟 Reproduction steps

When executing push sites or push functions and selecting deploy, all files under the site or function directory will be packaged.

👍 Expected behavior

Filter and exclude based on the .gitignore file in the directory or the ignore configuration in appwrite.config.json.

👎 Actual Behavior

In the deployment.ts file,'packageDirectory' function, the tar command does not filter files based on ignore rules, resulting in all files under the site or function directories being packaged into the .tar.gz file, including directories like node_modules.

/**
 * Package a directory into a tar.gz File object for deployment
 * @private - Only used internally by pushDeployment
 */
async function packageDirectory(dirPath: string): Promise<File> {
  const tempFile = `${dirPath.replace(/[^a-zA-Z0-9]/g, "_")}-${Date.now()}.tar.gz`;

  await tar.create(
    {
      gzip: true,
      file: tempFile,
      cwd: dirPath,
    },
    ["."],
  );

  const buffer = fs.readFileSync(tempFile);
  fs.unlinkSync(tempFile);

  return new File([buffer], path.basename(tempFile), {
    type: "application/gzip",
  });
}

🎲 Appwrite version

Version 1.8.x

💻 Operating system

Linux

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions