Skip to content

Commit 037389f

Browse files
authored
Remove dist during clean (#1622)
## Checklist - [ ] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [ ] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [ ] I have not broken the cheatsheet
1 parent dc0afc0 commit 037389f

File tree

2 files changed

+32
-16
lines changed

2 files changed

+32
-16
lines changed

packages/cursorless-vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@
846846
"hat-adjustment-average": "tsx --conditions=cursorless:bundler src/scripts/hatAssignments/add.ts",
847847
"compile": "tsc --build",
848848
"watch": "tsc --build --watch",
849-
"clean": "rm -rf ./out tsconfig.tsbuildinfo"
849+
"clean": "rm -rf ./out tsconfig.tsbuildinfo ./dist"
850850
},
851851
"devDependencies": {
852852
"@types/chai": "^4.3.3",

packages/meta-updater/src/updatePackageJson.ts

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,44 @@ export async function updatePackageJson(
5656
},
5757
};
5858

59-
const extraFields =
60-
input.name === "@cursorless/cursorless-vscode"
61-
? getCursorlessVscodeFields(input)
62-
: {};
59+
const isCursorlessVscode = input.name === "@cursorless/cursorless-vscode";
6360

64-
const extraScripts = isRoot
65-
? {}
66-
: {
67-
clean: "rm -rf ./out tsconfig.tsbuildinfo",
68-
};
61+
const extraFields = isCursorlessVscode
62+
? getCursorlessVscodeFields(input)
63+
: {};
6964

7065
return {
7166
...input,
7267
name,
7368
license: "MIT",
74-
scripts: {
75-
...(input.scripts ?? {}),
76-
compile: "tsc --build",
77-
watch: "tsc --build --watch",
78-
...extraScripts,
79-
},
69+
scripts: getScripts(input.scripts, isRoot, isCursorlessVscode),
8070
...exportFields,
8171
...extraFields,
8272
} as PackageJson;
8373
}
74+
75+
function getScripts(
76+
inputScripts: PackageJson.Scripts | undefined,
77+
isRoot: boolean,
78+
isCursorlessVscode: boolean,
79+
) {
80+
const scripts: PackageJson.Scripts = {
81+
...(inputScripts ?? {}),
82+
compile: "tsc --build",
83+
watch: "tsc --build --watch",
84+
};
85+
86+
if (isRoot) {
87+
return scripts;
88+
}
89+
90+
const cleanDirs = ["./out", "tsconfig.tsbuildinfo"];
91+
92+
if (isCursorlessVscode) {
93+
cleanDirs.push("./dist");
94+
}
95+
96+
scripts.clean = `rm -rf ${cleanDirs.join(" ")}`;
97+
98+
return scripts;
99+
}

0 commit comments

Comments
 (0)