Skip to content

Commit

Permalink
use flag instead of options
Browse files Browse the repository at this point in the history
  • Loading branch information
technophile-04 committed Dec 4, 2024
1 parent 7f10c6b commit 68f32a0
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/dev/create-extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ const getProjectPath = (rawArgs: string[]) => {

const getDiffFilesFromFirstCommit = async ({
projectPath,
diffFilter,
isDeleted = false,
}: {
projectPath: string;
diffFilter?: "d" | "D";
isDeleted?: boolean;
}): Promise<string[]> => {
if (diffFilter === "D") {
if (isDeleted) {
// all files that have ever existed in the repo's history
const { stdout: allFiles } = await execa(
"git",
Expand All @@ -66,8 +66,7 @@ const getDiffFilesFromFirstCommit = async ({
cwd: projectPath,
});

const diffFilterArg = diffFilter ? `--diff-filter=${diffFilter}` : "";
const { stdout } = await execa("git", ["diff", diffFilterArg, "--name-only", `${firstCommit.trim()}..HEAD`], {
const { stdout } = await execa("git", ["diff", "--diff-filter=d", "--name-only", `${firstCommit.trim()}..HEAD`], {
cwd: projectPath,
});

Expand Down Expand Up @@ -211,8 +210,8 @@ const main = async (rawArgs: string[]) => {
prettyLog.info(`Extension name: ${projectName}\n`);

prettyLog.info("Getting list of changed files...", 1);
const changedFiles = await getDiffFilesFromFirstCommit({ projectPath, diffFilter: "d" });
const deletedFiles = await getDiffFilesFromFirstCommit({ projectPath, diffFilter: "D" });
const changedFiles = await getDiffFilesFromFirstCommit({ projectPath });
const deletedFiles = await getDiffFilesFromFirstCommit({ projectPath, isDeleted: true });

if (changedFiles.length === 0 && deletedFiles.length === 0) {
prettyLog.warning("No changed files to copy.", 1);
Expand Down

0 comments on commit 68f32a0

Please sign in to comment.