Skip to content

Commit e03fca3

Browse files
committed
fixup!
1 parent 5e6f4ec commit e03fca3

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

bin/commands/generate.mjs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
import { publicGenerators } from '../../src/generators/index.mjs';
1111
import createGenerator from '../../src/generators.mjs';
1212
import { parseChangelog, parseIndex } from '../../src/parsers/markdown.mjs';
13+
import { DEFAULT_TYPE_MAP } from '../../src/utils/parser/constants.mjs';
1314
import { loadFromURL } from '../../src/utils/parser.mjs';
1415
import { loadAndParse } from '../utils.mjs';
1516

@@ -120,9 +121,7 @@ export default {
120121
prompt: {
121122
message: 'Path to doc/api/type_map.json',
122123
type: 'text',
123-
initialValue: import.meta.resolve(
124-
'../../src/utils/parser/typeMap.json'
125-
),
124+
initialValue: DEFAULT_TYPE_MAP,
126125
},
127126
},
128127
},

src/utils/parser.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const loadFromURL = async url => {
1212

1313
if (!parsedUrl || parsedUrl.protocol === 'file:') {
1414
// Load from file system
15-
return readFile(parsedUrl || url, 'utf-8');
15+
return readFile(parsedUrl ?? url, 'utf-8');
1616
} else {
1717
// Load from network
1818
const response = await fetch(parsedUrl);

src/utils/parser/constants.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import globals from 'globals';
22

3+
// The default type map path
4+
export const DEFAULT_TYPE_MAP = import.meta.resolve('./typeMap.json');
5+
36
// These are string replacements specific to Node.js API docs for anchor IDs
47
export const DOC_API_SLUGS_REPLACEMENTS = [
58
{ from: /node.js/i, to: 'nodejs' }, // Replace Node.js

0 commit comments

Comments
 (0)