@itwin/build-tools 3.1.0-dev.19 → 3.1.0-dev.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/scripts/docs.js +4 -0
- package/scripts/utils/addSourceDir.js +22 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@itwin/build-tools",
|
3
|
-
"version": "3.1.0-dev.
|
3
|
+
"version": "3.1.0-dev.20",
|
4
4
|
"description": "Bentley build tools",
|
5
5
|
"license": "MIT",
|
6
6
|
"repository": {
|
@@ -38,7 +38,7 @@
|
|
38
38
|
"yargs": "^16.0.0"
|
39
39
|
},
|
40
40
|
"devDependencies": {
|
41
|
-
"@itwin/eslint-plugin": "3.1.0-dev.
|
41
|
+
"@itwin/eslint-plugin": "3.1.0-dev.20",
|
42
42
|
"@types/node": "14.14.31",
|
43
43
|
"eslint": "^7.11.0"
|
44
44
|
},
|
package/scripts/docs.js
CHANGED
@@ -12,6 +12,7 @@ const cpx = require("cpx2");
|
|
12
12
|
const fs = require("fs");
|
13
13
|
const { spawn, handleInterrupts } = require("./utils/simpleSpawn");
|
14
14
|
const { validateTags } = require("./utils/validateTags");
|
15
|
+
const { addSourceDir } = require("./utils/addSourceDir");
|
15
16
|
const argv = require("yargs").argv;
|
16
17
|
|
17
18
|
// Makes the script crash on unhandled rejections instead of silently
|
@@ -88,6 +89,9 @@ spawn(require.resolve(".bin/typedoc"), args).then((code) => {
|
|
88
89
|
cpx.copySync(path.join(process.cwd(), 'CHANGELOG.json'), outputDir);
|
89
90
|
}
|
90
91
|
|
92
|
+
// Append the directory of the package to the output
|
93
|
+
addSourceDir(json, process.cwd());
|
94
|
+
|
91
95
|
if (code === 0) {
|
92
96
|
let tagErrors = validateTags(json);
|
93
97
|
if (tagErrors.toString()) {
|
@@ -0,0 +1,22 @@
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
5
|
+
|
6
|
+
const FS = require('fs-extra');
|
7
|
+
const rootPackageJson = require('../../../../package.json');
|
8
|
+
|
9
|
+
// Appends the directory of the package root to the Typedoc JSON output
|
10
|
+
function addSourceDir(file, directory) {
|
11
|
+
if (FS.existsSync(file) && FS.statSync(file).isFile()) {
|
12
|
+
const contents = FS.readFileSync(file, 'utf-8');
|
13
|
+
let packageRoot = directory.substring(directory.indexOf(rootPackageJson.name) + rootPackageJson.name.length + 1);
|
14
|
+
let jsonContents = JSON.parse(contents);
|
15
|
+
jsonContents['packageRoot'] = packageRoot.endsWith('src') ? packageRoot : `${packageRoot}\\${'src'}`;
|
16
|
+
FS.writeFileSync(file, Buffer.from(JSON.stringify(jsonContents, null, 2)));
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
module.exports = {
|
21
|
+
addSourceDir
|
22
|
+
};
|