Skip to content

Commit b45284d

Browse files
authored
Merge pull request #27 from Himenon/fix-some-bugs
fix: some dependency not parsed error
2 parents d08df06 + 41f5c9c commit b45284d

File tree

15 files changed

+56
-60
lines changed

15 files changed

+56
-60
lines changed

.lintstagedrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"*.{js,jsx,json,yml,yaml,html,md}": ["prettier --write", "git add"],
2+
"*.{js,jsx,json,yml,yaml,html}": ["prettier --write", "git add"],
33
"*.{ts,tsx}": ["yarn run format", "yarn run lint", "git add"],
44
"package.json": ["sort-package-json", "git add"]
5-
}
5+
}

CHANGELOG.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

66
<a name="0.3.2"></a>
7+
78
## 0.3.2 (2020-01-07)
89

910
**Note:** Version bump only for package code-dependency
1011

11-
12-
13-
14-
1512
<a name="0.3.1"></a>
1613

1714
## [0.3.1](https://github.com/Himenon/code-dependency/compare/v0.3.0...v0.3.1) (2020-01-06)

lerna.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,10 @@
1111
"publish": {
1212
"access": "public",
1313
"allowBranch": "master",
14-
"ignoreChanges": [
15-
"CHANGELOG.md"
16-
]
14+
"ignoreChanges": ["CHANGELOG.md"]
1715
}
1816
},
19-
"packages": [
20-
"packages/*"
21-
],
17+
"packages": ["packages/*"],
2218
"version": "0.3.2",
2319
"npmClient": "yarn",
2420
"registry": "https://registry.npmjs.org/",

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"initialize": "run-s bootstrap clean:all setup build:lib",
2222
"lint": "eslint -c ./.eslintrc.js 'packages/**/*.{ts,tsx}'",
2323
"lint:fix": "yarn lint --fix",
24-
"publish": "lerna publish from-package",
2524
"test": "lerna run test",
2625
"version_up": "lerna version --yes"
2726
},

packages/cli/CHANGELOG.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

66
<a name="0.3.2"></a>
7+
78
## 0.3.2 (2020-01-07)
89

910
**Note:** Version bump only for package @code-dependency/cli
1011

11-
12-
13-
14-
1512
<a name="0.3.1"></a>
1613

1714
## [0.3.1](https://github.com/Himenon/code-dependency/packages/cli/compare/v0.3.0...v0.3.1) (2020-01-06)

packages/cli/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
},
4242
"dependencies": {
4343
"@code-dependency/view": "^0.3.2",
44-
"chalk": "^3.0.0",
4544
"commander": "4.0.1",
4645
"compression": "^1.7.4",
4746
"cors": "^2.8.5",
@@ -57,7 +56,7 @@
5756
"react-router-dom": "^5.1.2",
5857
"recursive-readdir": "^2.2.2",
5958
"resolve-pkg": "^2.0.0",
60-
"viz.js": "^2.1.2"
59+
"tsconfig": "^7.0.0"
6160
},
6261
"devDependencies": {
6362
"@types/compression": "^1.0.1",

packages/cli/src/controller/ApiController.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import express from "express";
22
import * as path from "path";
3-
import * as Service from "../service";
43
import * as Config from "../config";
4+
import * as Service from "../service";
5+
import { logger } from "../logger";
56
import { Api } from "@code-dependency/view";
67

78
export const createApiResponse = <T>(data: T): Api.ApiResponse<T> => {
@@ -18,12 +19,17 @@ export const create = (service: Service.Type, config: Config.Type) => {
1819

1920
router.post("/graph", async (req, res) => {
2021
const filename = path.join(config.absoluteRootDirPath, req.body.path);
21-
const dot = service.dependencyCruiser.getDependenciesDot(filename);
22-
const data = createApiResponse<Api.GraphResponseData>({
23-
element: dot,
24-
});
25-
res.json(data);
26-
res.end();
22+
try {
23+
const dot = service.dependencyCruiser.getDependenciesDot(filename);
24+
const data = createApiResponse<Api.GraphResponseData>({
25+
element: dot,
26+
});
27+
res.json(data);
28+
} catch (error) {
29+
res.status(500).send(error.message);
30+
logger.error(error);
31+
res.end();
32+
}
2733
});
2834

2935
router.use("/paths", async (req, res) => {

packages/cli/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const main = async () => {
2323
const server = createServer(service, config);
2424

2525
logger.info(`Start: http://localhost:${args.port}`);
26-
server.listen(3000);
26+
server.listen(args.port);
2727
};
2828

2929
main().catch(error => {

packages/cli/src/service/DependencyCruiserService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export interface Option {
88
export const create = (option: Option) => {
99
const getDependenciesDot = (source: string): string => {
1010
logger.info(`cruise: ${source}`);
11-
const dependencies = cruise([source], { exclude: "node_modules", maxDepth: 99, combinedDependencies: true }, undefined, option.tsConfig);
11+
const dependencies = cruise([source], { tsPreCompilationDeps: true }, undefined, option.tsConfig);
1212
if (typeof dependencies.output !== "string") {
1313
return format(dependencies.output, "dot").output.toString();
1414
}

packages/cli/src/service/VizJsService.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)