Add node_modules directory to ignored list of files and directories.#776
Add node_modules directory to ignored list of files and directories.#776yazeedobaid wants to merge 2 commits intofsprojects:mainfrom
Conversation
|
I don't know node project structure, so my comment might be off base. But is an alternative to use If you have a hierarchy like below, |
|
It will not be straightforward, since node_modules will reside in the root level of the NPM project, besides the entry point ( The issue is when you enter development mode, so want to watch both directories then, and on the update of NPM, we need to copy them to FSDocs directory, which is a lot of work. What I'm trying to reach is using the same directory for both, since both operate on HTML files, and node_modules is considered not part of the source root, so it should be ignored by both; NPM and FSDocs. |
|
Could we use an |
|
I like the idea of a config file, either in I can propose the file to have the following structure for the moment: {
"ignoredPaths": ["node_modules/", "docs/md-file-that-is-not-part-of-site.md"]
}So, the ignored paths array will have paths relative to the root of the project, either directory or specific files. The tool will keep ignoring directories or files that start with a dot, and will check this file for these ignored paths. Is this a good proposal that we can proceed with? |
|
@yazeedobaid Sounds good! please go with that! |
Motivation
In a recent project I was working on, I customized the theme that FSDocs operate on. The customized theme was first processed with NPM, then template files were fed to FSDocs to use. So as a general highlight of the pipeline:
npm installto install node dependencies,npm run buildto generate the final build output from NPM, this includes final template HTML files as well as styling and JavaScript files,dotnet fsdocsto generate the site and API documentation.One issue that results from this flow is that we have
node_modulesdirectory that resulted fromnpm installand is needed innpm run build. That directory got processed by FSDocs when it runs. Hence we get in output anode_modulesdirectory with thousands of files! In addition, the run time for FSDocs has doubled.The workaround I did was to rename the
node_modulesdirectory to.node_modulesbefore running step number 3 above. Since FSDocs ignore files and directories that start with a dot. Once FSDocs is done, I rename it back tonode_modules.The issue with this approach is that, during development, we need to run FSDocs and NPM both in watch modes, but we cannot, since
node_modulesdirectory has been renamed, hence NPM cannot be run. So we run either of them.The Change
This PR adds an ignore list-like function that has the
node_modulesdirectory and "." criteria. In which it will ignore either of them. Also, I updated the documentation page to highlight this in the Ignored Content section.