Skip to content

Commit 8bba7b4

Browse files
authored
Update scrubber config and allow nested tags (#13)
1 parent 79ad353 commit 8bba7b4

File tree

3 files changed

+30
-8
lines changed

3 files changed

+30
-8
lines changed

cli/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ async function cli(args: CommandLineArgs): Promise<Options> {
302302

303303
if (!commandLineOptions.testing) {
304304
const clone = shell.exec(
305-
"git clone https://github.com/uwblueprint/starter-code-v2.git",
305+
"git clone --single-branch --branch alex/test-scrubber https://github.com/uwblueprint/starter-code-v2.git",
306306
);
307307

308308
if (clone.code !== 0) {

scrubber/scrubUtils.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ const FILE_TYPE_COMMENT: { [key: string]: string } = {
1111
json: "//",
1212
ts: "//",
1313
py: "#",
14+
tsx: "//",
15+
jsx: "//",
1416
};
1517

1618
export function getAllTagsAndSetToRemove(
@@ -40,6 +42,7 @@ export function scrubFile(
4042
const commentType = ext && FILE_TYPE_COMMENT[ext];
4143
const scrubbedLines: string[] = [];
4244
let skip = false;
45+
let currentTag = "";
4346

4447
const lines: string[] = text.split("\n");
4548

@@ -99,10 +102,14 @@ export function scrubFile(
99102
);
100103
}
101104

102-
// NOTE: nested tagging is not currently supported and will lead to unexpected behaviour.
103-
104105
if (tags[tag] === "remove") {
105-
skip = brace === TAG_START_CHAR;
106+
if (!skip && brace === TAG_START_CHAR) {
107+
currentTag = tag;
108+
skip = true;
109+
} else if (tag === currentTag) {
110+
currentTag = "";
111+
skip = false;
112+
}
106113
}
107114

108115
// We always scrub tags from the final file.

scrubber/scrubberConfig.json

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,38 @@
2626
"tagsToKeep": ["auth"]
2727
},
2828
"no-auth": {
29-
"tagsToKeep": [],
29+
"tagsToKeep": ["no-auth"],
3030
"filesToDelete": [
3131
"backend/typescript/services/implementations/userService.ts",
3232
"backend/typescript/services/interfaces/userService.ts",
3333
"backend/typescript/services/implementations/authService.ts",
3434
"backend/typescript/services/interfaces/authService.ts",
3535
"backend/typescript/rest/userRoutes.ts",
3636
"backend/typescript/rest/authRoutes.ts",
37-
"backend/typescript/middlewares/auth.ts",
38-
"backend/typescript/middlewares/auth.graphql.ts",
37+
"backend/typescript/graphql/resolvers/userResolvers.ts",
38+
"backend/typescript/graphql/resolvers/authResolvers.ts",
39+
"backend/typescript/graphql/types/userType.ts",
40+
"backend/typescript/graphql/types/authType.ts",
41+
"backend/typescript/models/user.ts",
42+
"backend/typescript/middlewares",
43+
"backend/typescript/utilities/firebaseRestClient.ts",
3944
"backend/python/app/services/implementations/user_service.py",
4045
"backend/python/app/services/interfaces/user_service.py",
4146
"backend/python/app/services/implementations/auth_service.py",
4247
"backend/python/app/services/interfaces/auth_service.py",
4348
"backend/python/app/rest/user_routes.py",
4449
"backend/python/app/rest/auth_routes.py",
45-
"backend/python/app/middlewares/auth.py"
50+
"backend/python/app/middlewares",
51+
"backend/python/app/resources/create_user_dto.py",
52+
"backend/python/app/resources/token.py",
53+
"backend/python/app/resources/update_user_dto.py",
54+
"backend/python/app/resources/user_dto.py",
55+
"backend/python/app/utilities/firebase_rest_client.py",
56+
"frontend/src/APIClients/AuthAPIClient.ts",
57+
"frontend/src/components/auth",
58+
"frontend/src/components/pages/Default.tsx",
59+
"frontend/src/constants/AuthConstants.ts",
60+
"frontend/src/contexts/AuthContext.ts"
4661
]
4762
}
4863
},

0 commit comments

Comments
 (0)