Skip to content

Commit a1d5a1a

Browse files
committed
fix(cli): remove sleep package | wait 10s if --inspect flag in CONTRIBUTING.md and docs/README.md
fix #1090
1 parent d2ad4fb commit a1d5a1a

File tree

5 files changed

+40
-29
lines changed

5 files changed

+40
-29
lines changed

CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ See this folder for more details : [DOCS](./docs/README.md)
2929

3030
### Debugging process
3131

32+
- install sleep package `npm i sleep`
33+
- add these lines in index-cli.ts, atfer --files check
34+
35+
```
36+
const sleep = require('sleep');
37+
const isInInspectMode = /--inspect/.test(process.execArgv.join(' '));
38+
if (isInInspectMode) {
39+
// wait 10 seconds for debugger to connect in Chrome devtools
40+
sleep.sleep(10);
41+
}
42+
```
43+
3244
- open one terminal and run inside compodoc folder : `npm run start`
3345
- add `debugger`statement where you want to debug your code
3446
- open Chrome and this url : chrome://inspect

docs/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,24 @@ This will put compodoc command available everywhere.
8787
> npm start
8888
8989
Launch watch process for source files and rollup build.
90+
91+
## Node.js inspecting
92+
93+
- install sleep package `npm i sleep`
94+
- add these lines in index-cli.ts, atfer --files check
95+
96+
```
97+
const sleep = require('sleep');
98+
const isInInspectMode = /--inspect/.test(process.execArgv.join(' '));
99+
if (isInInspectMode) {
100+
// wait 10 seconds for debugger to connect in Chrome devtools
101+
sleep.sleep(10);
102+
}
103+
```
104+
105+
- open one terminal and run inside compodoc folder : `npm run start`
106+
- add `debugger`statement where you want to debug your code
107+
- open Chrome and this url : chrome://inspect
108+
- open another terminal with the source code of the [demo project](https://github.com/compodoc/compodoc-demo-todomvc-angular), and run `node --inspect ../compodoc/bin/index-cli.js -p tsconfig.json -a screenshots -n 'TodoMVC Angular documentation' --includes additional-doc --toggleMenuItems "'all'" -s`
109+
- Compodoc will wait 10s before starting when it detects --inspect flag
110+
- open the debug window in Chrome, and click `inspect`

package-lock.json

Lines changed: 2 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@
113113
"os-name": "^4.0.0",
114114
"pdfmake": "^0.2.0",
115115
"semver": "^7.3.5",
116-
"sleep": "^6.3.0",
117116
"traverse": "^0.6.6",
118117
"ts-morph": "^11.0.0",
119118
"ts-simple-ast": "12.4.0",

src/index-cli.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@ import AngularVersionUtil from './utils/angular-version.util';
1313
import { COMPODOC_DEFAULTS } from './utils/defaults';
1414
import { logger } from './utils/logger';
1515
import { ParserUtil } from './utils/parser.util.class';
16-
import { handlePath, readConfig, ignoreDirectory } from './utils/utils';
16+
import { readConfig, ignoreDirectory } from './utils/utils';
1717

1818
import { cosmiconfigSync } from 'cosmiconfig';
1919

2020
const os = require('os');
2121
const osName = require('os-name');
2222
const pkg = require('../package.json');
2323
const program = require('commander');
24-
const sleep = require('sleep');
2524

2625
const cosmiconfigModuleName = 'compodoc';
2726

@@ -638,13 +637,6 @@ Note: Certain tabs will only be shown if applicable to a given dependency`,
638637
}
639638
}
640639

641-
const isInInspectMode = /--inspect/.test(process.execArgv.join(' '));
642-
643-
if (isInInspectMode) {
644-
// wait 10 seconds for debugger to connect in Chrome devtools
645-
sleep.sleep(10);
646-
}
647-
648640
if (programOptions.serve && !Configuration.mainData.tsconfig && programOptions.output) {
649641
// if -s & -d, serve it
650642
if (!FileEngine.existsSync(Configuration.mainData.output)) {
@@ -849,14 +841,16 @@ Note: Certain tabs will only be shown if applicable to a given dependency`,
849841

850842
let startCwd = sourceFolder;
851843

852-
let excludeParserTestFilesWithCwdDepth = excludeParser.testFilesWithCwdDepth();
844+
let excludeParserTestFilesWithCwdDepth =
845+
excludeParser.testFilesWithCwdDepth();
853846
if (!excludeParserTestFilesWithCwdDepth.status) {
854847
startCwd = excludeParser.updateCwd(
855848
cwd,
856849
excludeParserTestFilesWithCwdDepth.level
857850
);
858851
}
859-
let includeParserTestFilesWithCwdDepth = includeParser.testFilesWithCwdDepth();
852+
let includeParserTestFilesWithCwdDepth =
853+
includeParser.testFilesWithCwdDepth();
860854
if (!includeParser.testFilesWithCwdDepth().status) {
861855
startCwd = includeParser.updateCwd(
862856
cwd,

0 commit comments

Comments
 (0)