I'm working on a project that has multiple projects in a solution. I would like to be able to generate the documentation from an outside directory to keep the application code folders clean. When I try to set the src directory in my docfx.json, it doesn't seem to like absolute paths, nor does it like relative paths.
{
"metadata":
[{
"src":
[{
"files": ["../../../Repos/Wsi.Extranet.CommonServices/Wsi.Extranet.CommonServices/**/*.csproj"]
"exclude":
[
"**/obj/**",
"**/bin/**",
"_site/**"
]
}],
"dest": "api"
}],
"build": {
"content": [
{
"files": [
"api/**.yml",
"api/index.md"
]
},
{
"files": [
"articles/**.md",
"articles/**/toc.yml",
"toc.yml",
"*.md"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"resource": [
{
"files": [
"images/**"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"overwrite": [
{
"files": [
"apidoc/**.md"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"src": "../../../Repos/Wsi.Extranet.CommonServices/Wsi.Extranet.CommonServices",
"dest": "_site",
"globalMetadataFiles": [],
"fileMetadataFiles": [],
"template": [
"default"
],
"postProcessors": [],
"noLangKeyword": false
}
}
It says it built fine but didn't find any files and the directory that it searches for is staying in the current directory.
D:\temp\WsiApiDocs\docfx_project>docfx metadata
Info: Config file docfx.json found, start generating metadata...
Info: No files are found with glob pattern **/*.csproj, excluding
**/obj/**,**/bin/**,_site/**, under directory "D:\temp\WsiApiDocs\docfx_project"
Info: Completed executing in 54.0087 milliseconds.
Build succeeded.
0 Warning(s)
0 Error(s)
When I attempt to put the relative path in the files property, I get the following:
D:\temp\WsiApiDocs\docfx_project>docfx metadata
Info: Config file docfx.json found, start generating metadata...
Info: No files are found with glob pattern
../../../Repos/Wsi.Extranet.CommonServices/Wsi.Extranet.CommonServices/**/*.csproj,
excluding **/obj/**,**/bin/**,_site/**, under directory
"D:\temp\WsiApiDocs\docfx_project"
**Warning: NOTE that `../` is currently not supported in glob pattern, please use `../` in `src` option instead.**
Info: Completed executing in 48.9621 milliseconds.
Build succeeded with warning.
Warning: NOTE that `../` is currently not supported in glob pattern, please use `../` in `src` option instead.
1 Warning(s)
0 Error(s)
So my confusion seems to be in how to use the src option instead. If use the src in metadata, then it seems that I can't specify the file and exclusion info. I tried to use a src property on the same level as metadata but that seemed to do nothing.
Just as the error states
../ is currently not supported in glob pattern
files, exclude etc. use glob patterns. Set a base directory instead via src:
{
"metadata": [
{
"src": [
{
"files": "Repos/Wsi.Extranet.CommonServices/Wsi.Extranet.CommonServices/**.csproj",
"exclude": [
"**/obj/**",
"**/bin/**"
],
"src": "../../.." // <---- base directory
}
],
"dest": "api"
}
],
"content": [
{
"files": [
"api/**.yml",
"api/index.md"
]
}
// ...
]
}
Here is an exmaple of structuring multiple projects
Related
This is my package.json build data:
"build": {
"appId": "name.desktop",
"productName": "name",
"beforePack": "electron/beforePack.js",
"extraResources": [
{
"from": "bin/${os}",
"to": "bin",
"filter": [
"**/*"
]
}
],
"files": [
"build/**/*",
"electron/**/*",
"package.json"
],
"extends": null,
"mac": {
"target": "dmg",
"type": "distribution"
},
"win": {
"target": [
"portable",
"nsis"
]
},
"linux": {
"target": "AppImage"
}
}
I'm looking to add "portable" to the windows portable file name, so that the .exe is "name 1.0.0 portable.exe" instead of "name 1.0.0.exe"
It is possible to explicitely define the generated file names at each relevant level in the package.json file by making use of an "artifactName" property.
This is documented in the Overridable per Platform Options section of the Common Configuration - electron-builder page:
Following options can be set also per platform (top-level keys mac, linux and win) if need.
artifactName String | “undefined” - The artifact file name template. Defaults to ${productName}-${version}.${ext} (some target can have other defaults, see corresponding options).
which indirectly refers to the File Macros section of the File Patterns - electron-builder page.
In your specific case, you'll have to add the following "artifactName" property to your package.json file at the Windows version level:
"artifactName": "${name} ${version} portable.${ext}",
i.e.:
"build": {
"appId": "name.desktop",
"productName": "name",
"beforePack": "electron/beforePack.js",
"extraResources": [
{
"from": "bin/${os}",
"to": "bin",
"filter": [
"**/*"
]
}
],
"files": [
"build/**/*",
"electron/**/*",
"package.json"
],
"extends": null,
"mac": {
"target": "dmg",
"type": "distribution"
},
"win": {
"artifactName": "${name} ${version} portable.${ext}",
"target": [
"portable",
"nsis"
]
},
"linux": {
"target": "AppImage"
}
}
I tried to configure the module "Live Sass Compiler" to put css files in an other directory than the one with scss files, but either I got errors, or it does nothing.
I made a directory/project to test it.
Root : C:\\test_space\\sass_compiler_config
Tree:
+ sass_compiler_config
+ build
+ src
+ modules
+ variables.scss
+ style.scss
Here is the test configuration I want to use to check it works:
{
"liveSassCompile.settings.generateMap" : false,
"liveSassCompile.settings.showOutputWindow": true,
"liveSassCompile.settings.formats":[
{
"format": "expanded",
"extensionName": ".css",
"savePath": "/sass_compiler_config/build/styles"
}
],
"liveSassCompile.settings.excludeList": [
"**/node_modules/**",
".vscode/**"
],
"liveSassCompile.settings.includeItems": [
"/sass_compiler_config/src/style.scss",
],
"liveSassCompile.settings.autoprefix": [
"> 1%",
"last 2 versions"
]
}
I tried creating a directory named ".vscode" with a file "settings.json" inside and add it to the workspace.
I get this error : This setting can not be applied now. It is applied when you open this folder directly.
I tried putting it in the workspace configuration:
{
"folders": [
{
"path": "C:\\test_space\\.vscode"
},
{
"path": "C:\\test_space\\sass_compiler_config"
}
],
"settings": {
{
"liveSassCompile.settings.generateMap" : false,
"liveSassCompile.settings.showOutputWindow": true,
"liveSassCompile.settings.formats":[
{
"format": "expanded",
"extensionName": ".css",
"savePath": "/sass_compiler_config/build/styles"
}
],
"liveSassCompile.settings.excludeList": [
"**/node_modules/**",
".vscode/**"
],
"liveSassCompile.settings.includeItems": [
"/sass_compiler_config/src/style.scss",
],
"liveSassCompile.settings.autoprefix": [
"> 1%",
"last 2 versions"
]
}
}
}
No error, but does nothing.
Could be that my paths are wrong.
As I guess;
You want to Save location in relative from workspace root or your Sass files, if so;
* Default value is null. (null means, it will generate CSS in the location of scss/sass. By The Way, It is null, NOT "null").
* "/" denotes relative to root.
* "~" denotes relative to every sass file. - Complex Scenario.
Please check the documentation
and this is the result
Go to path: C:\Users\your user\AppData\Roaming\Code\User\settings.json
and change there the "liveSassCompile.settings.formats" section
for example:
the parameter : "savePath": "/Python/CSS",
I am using DocFx to automatically generate documentation in Visual Studio 2015.
Per the Getting Started instructions, I added an empty ASP.NET 4 Web Application and used the Nuget Console to install the DocFx build package (e.g. Install-Package docfx.msbuild). I built the site and it it generated documentation for code within the project.
I was wondering how to configure docfx.json to get DocFx to document code in other projects within the solution.
In docfx.json, there is an array of metadata. The example metadata has a src object with files and exclude properties.
To point to another project in your solution, add a cwd property to metadata and change folders (i.e. "../Another.Project").
{
"metadata": [
{
"src": [
{
"files": [ "**/*.csproj" ],
"exclude": [ "**/bin/**", "**/obj/**", "_site/**" ],
"cwd": "../Another.Project"
}
],
"dest": "obj/api"
}
],
"build": ...
}
This worked for me.
directory structure
+---ClassLibrary
| \---ClassLibrary.csproj
\---DocFxProject
\---docfx.json
docfx.json contents
cwd and src are synonyms for the same property
{
"metadata":
[
{
"src":
[
{
"files": [ "**/ClassLibrary.csproj" ],
"src": "..",
"exclude": [ "**/obj/**", "**/bin/**" ]
}
],
"dest": "obj/api"
}
],
"build": { ... }
}
In Visual Studio, right-click on a .ts file and "Run JS Tests", only the tests in the .ts file run and are counted in the total.
"Run JS Tests" at the folder level or project level and both the tests in the .ts and .js files are run and counted in the total.
Chutzpah.json settings:
{
"Framework": "jasmine",
"TypeScriptCodeGenTarget": "ES5",
"TestHarnessLocationMode": "SettingsFileAdjacent",
"RootReferencePathMode": "SettingsFileDirectory",
"Compile": {
"Mode": "External",
"Extensions": [ ".ts" ],
"ExtensionsWithNoOutput": [ ".d.ts" ]
},
"Tests": [
{ "Path": "Specs"}
]
}
I had the same issue. All my tests are written in TypeScript, so my *.ts files define what tests exist. I had solved it by including only *.ts files.
{
"Tests": [ { "Path": "Specs", "Includes": [ "*.ts" ] } ],
"Compile": {
"Mode": "External",
"Extensions": [ ".ts" ],
"ExtensionsWithNoOutput": [ ".d.ts" ]
}
}
Works like a charm.
Without seeing your full project it is hard to know for sure but something along the following should help achieve this. If you need to include some .js files you can change the exclude patterns accordingly.
```
{
"Framework": "jasmine",
"TestHarnessLocationMode": "SettingsFileAdjacent",
"RootReferencePathMode": "SettingsFileDirectory",
"Compile": {
"Mode": "External",
"Extensions": [ ".ts" ],
"ExtensionsWithNoOutput": [ ".d.ts" ]
},
"References": [
{ "Excludes": ["*.js"]}
],
"Tests": [
{ "Path": "Specs", "Excludes": ["*.js"]}
]
}
```
I have a SublimeText3 project which I use to show particular folders in the sidebar. This works, however subdirectories of the folders in folder_include_pattern are not visible in the project (they're obviously there if I open the project as a folder instead).
node_modules
my-module
('test' should be here but is not shown)
my-other-module
('test' should be here but is not shown)
Here is my .project file:
{
"folders": [
{
"path": "node_modules",
"folder_include_patterns": [
"my-module",
"my-other-module"
]
},
{
"path": "."
}
]
}
How can I show all the subdirs of the directories in folder_include_patterns?
Solved it: subdir names must also be in folder_include_patterns. Eg, to include /node_modules/my-module/test, I needed:
{
"folders": [
{
"path": "node_modules",
"folder_include_patterns": [
"my-module",
"my-other-module",
"test"
]
},
{
"path": "."
}
]
}
2018 updae: note if you're reading this in 2018, and want to do this for node_modules, the best way to handle monorepos (where you have some of your own modules included in the project) is via yarn workspaces