Skip to content

Commit 03ddfdb

Browse files
committed
imporve audit
1 parent b237906 commit 03ddfdb

File tree

28 files changed

+254
-208
lines changed

28 files changed

+254
-208
lines changed

examples/node/express-typescript/.napirc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"out": "napi_dist",
44
"openaiApiKeyFilePath": "../../.OPENAIKEY",
55
"audit": {
6+
"patterns": ["src/**"],
67
"targetMaxCharInFile": 5000,
78
"targetMaxLineInFile": 500,
89
"targetMaxDepPerFile": 4

examples/node/express-typescript/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ app.use('/api/v0/wizards', wizardsRouter);
1919
app.use('/api/v0/hobbits', hobbitsRouter);
2020

2121
app.listen(config.port, () => {
22-
console.log(`Server is running on port ${config.port}`);
22+
console.info(`Server is running on port ${config.port}`);
2323
});

examples/node/express/.napirc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"out": "napi_dist",
44
"openaiApiKeyFilePath": "../../.OPENAIKEY",
55
"audit": {
6+
"patterns": ["src/**"],
67
"targetMaxCharInFile": 5000,
78
"targetMaxLineInFile": 500,
89
"targetMaxDepPerFile": 4

examples/node/express/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ app.use("/api/v0/wizards", wizardsRouter);
1919
app.use("/api/v0/hobbits", hobbitsRouter);
2020

2121
app.listen(config.port, () => {
22-
console.log(`Server is running on port ${config.port}`);
22+
console.info(`Server is running on port ${config.port}`);
2323
});

examples/node/nestjs-typescript/.napirc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"out": "napi_dist",
44
"openaiApiKeyFilePath": "../../.OPENAIKEY",
55
"audit": {
6+
"patterns": ["src/**"],
67
"targetMaxCharInFile": 5000,
78
"targetMaxLineInFile": 500,
89
"targetMaxDepPerFile": 4

examples/python/flask/.napirc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"entrypoint": "app.py",
33
"out": "napi_dist",
4-
"include": ["app.py", "api/**"],
54
"openaiApiKeyFilePath": "../../.OPENAIKEY",
65
"audit": {
6+
"patterns": ["app.py", "api/**"],
77
"targetMaxCharInFile": 5000,
88
"targetMaxLineInFile": 500,
99
"targetMaxDepPerFile": 4

package-lock.json

Lines changed: 19 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/app/src/pages/splitConfigure/index.tsx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,18 @@ export default function SplitConfigure() {
2020
setBusy(true);
2121
setIsOutOfSynced(true);
2222

23-
console.log(111111111111, endpoint, group);
24-
25-
const targetEndpoint = endpoints.find(
26-
(e) => e.path === endpoint.path && e.method === endpoint.method,
27-
);
28-
29-
if (!targetEndpoint) {
30-
toast.error("Unescpected Error: Failed to find endpoint when updating");
31-
console.error("Unescpected Error: Failed to find endpoint when updating");
32-
} else {
33-
targetEndpoint.group = group;
34-
}
23+
const updatedEndpoints = endpoints.map((e) => {
24+
if (e.path === endpoint.path && e.method === endpoint.method) {
25+
return {
26+
...e,
27+
group,
28+
};
29+
} else {
30+
return e;
31+
}
32+
});
3533

36-
setEndpoints(endpoints);
34+
setEndpoints(updatedEndpoints);
3735
setBusy(false);
3836
}
3937

packages/cli/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
}
3737
},
3838
"scripts": {
39-
"dev": "cross-env NODE_ENV=development ts-node src/index.ts",
39+
"dev": "cross-env NODE_ENV=development nodemon src/index.ts",
4040
"build:cleanup": "rm -rf ./dist && rm -rf ../app/dist",
4141
"build:app": "npm run build --prefix ../app",
4242
"build:copy-app-dist": "cp -r ../app/dist ./dist/app_dist",
@@ -51,6 +51,7 @@
5151
"@release-it/bumper": "^6.0.1",
5252
"@release-it/keep-a-changelog": "^5.0.0",
5353
"@types/express": "^5.0.0",
54+
"@types/micromatch": "^4.0.9",
5455
"@types/node": "^22.10.2",
5556
"@types/prompts": "^2.4.9",
5657
"@types/uuid": "^10.0.0",

packages/cli/src/annotationManager.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
import { Group } from "./dependencyManager/types";
22
import { LanguagePlugin } from "./languagesPlugins/types";
33

4+
// Create cusotm error
5+
export class CannotParseAnnotationError extends Error {
6+
constructor() {
7+
super();
8+
this.message = "Could not parse path from annotation";
9+
this.name = "AnnotationError";
10+
}
11+
}
12+
413
class AnnotationManager {
514
private nanoapiRegex: RegExp;
615
private commentPrefix: string;
@@ -33,7 +42,7 @@ class AnnotationManager {
3342
const groupMatches = text.match(groupRegex);
3443

3544
if (!pathMatches) {
36-
throw new Error("Could not parse path from annotation");
45+
throw new CannotParseAnnotationError();
3746
}
3847

3948
const path = pathMatches[1];

0 commit comments

Comments
 (0)