ethers.js/docs.wrm/config.mjs

87 lines
2.5 KiB
JavaScript
Raw Permalink Normal View History

import { inspect } from "util";
2022-12-10 02:25:39 +03:00
import * as ethers from "../lib.esm/index.js";
2022-12-03 23:13:51 +03:00
import { version } from "../lib.esm/_version.js";
import { getModifiedTime } from "../lib.esm/_admin/utils/git.js";
2022-12-03 23:13:51 +03:00
const title = "ethers";
const subtitle = (function(version) {
const dash = version.indexOf("-");
if (dash === -1) { return version; }
return version.substring(dash + 1);
})(version);
2022-12-03 06:56:29 +03:00
2023-02-04 11:22:19 +03:00
const extraLinks = function() {
return [
`link-cdnjs [ethers.min.js](https:/\/cdnjs.cloudflare.com/ajax/libs/ethers/${ version }/ethers.min.js)`,
`link-cdnjs-wordlists [wordlists-extra.min.js](https:/\/cdnjs.cloudflare.com/ajax/libs/ethers/${ version }/wordlists-extra.min.js)`,
];
}
2022-12-03 06:56:29 +03:00
export default {
2022-12-03 23:13:51 +03:00
title, subtitle,
2023-02-04 11:22:19 +03:00
// Where all the basic documentation is
docRoot: ".",
// Where all the code is for the jsdocs API crawler
codeRoot: "../src.ts/index.ts",
// Place all files in the /v6/ folder
2023-02-03 04:51:33 +03:00
prefix: "v6",
2022-12-03 06:56:29 +03:00
2023-02-04 11:22:19 +03:00
// Prepare the context for running the examples
2022-12-10 02:25:39 +03:00
contextify: function(context) {
Object.assign(context, ethers);
context.provider = new ethers.InfuraProvider();
context.Uint8Array = Uint8Array;
ethers.InfuraProvider.prototype[inspect.custom] = function(depth, options, inspect) {
if (depth > 0) { return `InfuraProvider { ... }`; }
// Does this cause infinite recursion??
return this;
};
ethers.Interface.prototype[inspect.custom] = function(depth, options, inspect) {
if (depth > 0) { return `Interface { ... }`; }
// Does this cause infinite recursion??
return this;
};
ethers.Fragment.prototype[inspect.custom] = function(depth, options, inspect) {
if (depth > 0) { return `${ this.constructor.name } { ... }`; }
// Does this cause infinite recursion??
return this;
};
2022-12-10 02:25:39 +03:00
},
2023-02-04 11:22:19 +03:00
// The base URL to use for the <src> links
2023-02-03 04:51:33 +03:00
srcBaseUrl: "https:/\/github.com/ethers-io/ethers.js/blob/main/src.ts/{FILENAME}#L{LINENO}",
2023-02-04 11:22:19 +03:00
// Used at the bottom of each page to indicate the last-modified-time.
// This uses the most recent time in the repo that the file was
// updated.
getTimestamp: function(path) {
return getModifiedTime(path);
},
2022-12-03 06:56:29 +03:00
2023-02-04 11:22:19 +03:00
// All the links to pull in
2022-12-03 06:56:29 +03:00
links: [
2022-12-30 19:55:59 +03:00
"./links/javascript.txt",
"./links/npm.txt",
"./links/projects.txt",
"./links/ricmoo.txt",
"./links/specs.txt",
2023-02-04 11:22:19 +03:00
"./links/wiki.txt",
extraLinks
2022-12-03 06:56:29 +03:00
],
2023-02-04 11:22:19 +03:00
// Extra files to copy over to the /static folder
2022-12-03 23:25:41 +03:00
staticFiles: [
"logo.svg",
"social.jpg"
]
2022-12-03 06:56:29 +03:00
};