Skip to content

Commit 4a996f7

Browse files
authored
Merge branch 'main' into feat/standard-yaml-support
2 parents e2a2bd3 + 3a17176 commit 4a996f7

70 files changed

Lines changed: 891 additions & 472 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/auto-merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ jobs:
2222

2323
- uses: nodejs/web-team/actions/auto-merge-prs@b087df186d25f8792fb85cc7794f68718726b8ee
2424
with:
25-
merge-method: queue
25+
merge-method: squash

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,5 @@ jobs:
9595
:bust_in_silhouette: *Published by*: ${{ github.triggering_actor }}
9696
:octocat: *Commit*: <https://github.com/${{ github.repository }}/commit/${{ env.COMMIT_SHA }}|${{ env.COMMIT_SHA }}>
9797
SLACK_USERNAME: nodejs-bot
98-
SLACK_CHANNEL: nodejs-web-infra
98+
SLACK_CHANNEL: nodejs-web-infra-alerts
9999
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}

package-lock.json

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

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@node-core/doc-kit",
33
"type": "module",
4-
"version": "1.0.1",
4+
"version": "1.2.0",
55
"repository": {
66
"type": "git",
77
"url": "git+https://github.com/nodejs/doc-kit.git"
@@ -57,6 +57,7 @@
5757
"estree-util-to-js": "^2.0.0",
5858
"estree-util-visit": "^2.0.0",
5959
"github-slugger": "^2.0.0",
60+
"glob-parent": "^6.0.2",
6061
"globals": "^17.3.0",
6162
"hast-util-to-string": "^3.0.1",
6263
"hastscript": "^9.0.1",
@@ -85,7 +86,6 @@
8586
"unist-util-remove": "^4.0.0",
8687
"unist-util-select": "^5.1.0",
8788
"unist-util-visit": "^5.1.0",
88-
"vfile": "^6.0.3",
8989
"yaml": "^2.8.2"
9090
}
9191
}

src/generators/addon-verify/generate.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
import { mkdir, writeFile } from 'node:fs/promises';
3+
import { mkdir } from 'node:fs/promises';
44
import { join } from 'node:path';
55

66
import { visit } from 'unist-util-visit';
@@ -13,6 +13,7 @@ import {
1313
normalizeSectionName,
1414
} from './utils/section.mjs';
1515
import getConfig from '../../utils/configuration/index.mjs';
16+
import { writeFile } from '../../utils/file.mjs';
1617

1718
/**
1819
* Generates a file list from code blocks.

src/generators/api-links/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ The `api-links` generator creates a mapping of publicly accessible functions to
66

77
The `api-links` generator accepts the following configuration options:
88

9-
| Name | Type | Default | Description |
10-
| -------- | --------- | ----------------------- | --------------------------------------------------- |
11-
| `output` | `string` | - | The directory where `apilinks.json` will be written |
12-
| `minify` | `boolean` | Inherited from `global` | Whether to minify the output JSON |
9+
| Name | Type | Default | Description |
10+
| ----------- | --------- | ------------------------------------ | --------------------------------------------------- |
11+
| `output` | `string` | - | The directory where `apilinks.json` will be written |
12+
| `sourceURL` | `string` | `'${GITHUB_BLOB_URL}lib/{fileName}'` | URL template for linking to source files |
13+
| `minify` | `boolean` | Inherited from `global` | Whether to minify the output JSON |

src/generators/api-links/generate.mjs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
'use strict';
22

3-
import { writeFile } from 'node:fs/promises';
43
import { basename, join } from 'node:path';
54

65
import { checkIndirectReferences } from './utils/checkIndirectReferences.mjs';
76
import { extractExports } from './utils/extractExports.mjs';
87
import { findDefinitions } from './utils/findDefinitions.mjs';
98
import getConfig from '../../utils/configuration/index.mjs';
10-
import {
11-
GITHUB_BLOB_URL,
12-
populate,
13-
} from '../../utils/configuration/templates.mjs';
9+
import { populate } from '../../utils/configuration/templates.mjs';
10+
import { withExt, writeFile } from '../../utils/file.mjs';
1411

1512
/**
1613
* Generates the `apilinks.json` file.
@@ -33,16 +30,19 @@ export async function generate(input) {
3330
*/
3431
const nameToLineNumberMap = {};
3532

36-
// `http.js` -> `http`
37-
const baseName = basename(program.path, '.js');
33+
const fileName = basename(program.path);
34+
const baseName = withExt(fileName);
3835

3936
const exports = extractExports(program, baseName, nameToLineNumberMap);
4037

4138
findDefinitions(program, baseName, nameToLineNumberMap, exports);
4239

4340
checkIndirectReferences(program, exports, nameToLineNumberMap);
4441

45-
const fullGitUrl = `${populate(GITHUB_BLOB_URL, config)}lib/${baseName}.js`;
42+
const fullGitUrl = populate(config.sourceURL, {
43+
...config,
44+
fileName,
45+
});
4646

4747
// Add the exports we found in this program to our output
4848
Object.keys(nameToLineNumberMap).forEach(key => {

src/generators/api-links/index.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
import { GITHUB_BLOB_URL } from '../../utils/configuration/templates.mjs';
34
import { createLazyGenerator } from '../../utils/generators.mjs';
45

56
/**
@@ -23,4 +24,8 @@ export default createLazyGenerator({
2324
// Unlike the rest of the generators, this utilizes Javascript sources being
2425
// passed into the input field rather than Markdown.
2526
dependsOn: 'ast-js',
27+
28+
defaultConfiguration: {
29+
sourceURL: `${GITHUB_BLOB_URL}lib/{fileName}`,
30+
},
2631
});

src/generators/api-links/types.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ export interface ProgramExports {
55
}
66

77
export type Generator = GeneratorMetadata<
8-
{},
8+
{
9+
sourceURL: string;
10+
},
911
Generate<undefined, Promise<Record<string, string>>>
1012
>;

src/generators/json-simple/generate.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
'use strict';
22

3-
import { writeFile } from 'node:fs/promises';
43
import { join } from 'node:path';
54

65
import { remove } from 'unist-util-remove';
76

87
import getConfig from '../../utils/configuration/index.mjs';
8+
import { writeFile } from '../../utils/file.mjs';
99
import { UNIST } from '../../utils/queries/index.mjs';
1010

1111
/**

0 commit comments

Comments
 (0)