Rename stubs directory

This commit is contained in:
tgreyuk
2022-07-24 01:06:06 +01:00
parent 1218f2cf15
commit 07afa70da8
29 changed files with 25 additions and 31 deletions

View File

@@ -5,7 +5,7 @@ module.exports = {
'^.+\\.tsx?$': 'ts-jest',
},
verbose: true,
setupFiles: [path.join(__dirname, 'test/jest-helpers.ts')],
setupFiles: [path.join(__dirname, 'jest.helpers.ts')],
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.test.json',

View File

@@ -2,6 +2,7 @@ require('ts-node/register');
import * as fs from 'fs';
import * as Handlebars from 'handlebars';
import * as path from 'path';
import {
Application,
PageEvent,
@@ -13,6 +14,13 @@ import {
} from 'typedoc';
import { formatContents } from 'typedoc-plugin-markdown/src/utils';
const STUBS_SRC_PATH = path.join(__dirname, 'stub-project', 'src');
const STUBS_TSCONFIG_PATH = path.join(
__dirname,
'stub-project',
'tsconfig.json',
);
global.bootstrap = async (entryPoints: string[] = [], options: any = {}) => {
const app = new Application();
app.options.addReader(new TypeDocReader());
@@ -22,33 +30,21 @@ global.bootstrap = async (entryPoints: string[] = [], options: any = {}) => {
entryPoints:
entryPoints.length > 0
? entryPoints.map((inputFile: string) =>
path.join(__dirname, './stubs/src/' + inputFile),
path.join(STUBS_SRC_PATH, inputFile),
)
: ['./test/stubs/src'],
tsconfig: path.join(__dirname, 'stubs', 'tsconfig.json'),
: [STUBS_SRC_PATH],
tsconfig: STUBS_TSCONFIG_PATH,
...options,
plugin: [
...[
path.join(
__dirname,
'..',
'packages',
'typedoc-plugin-markdown',
'dist',
),
'typedoc-plugin-mdn-links',
],
...['typedoc-plugin-markdown', 'typedoc-plugin-mdn-links'],
...(options.plugin ? options.plugin : []),
],
});
const project = app.convert() as ProjectReflection;
const renderer = app.renderer;
//this.tmpobj = tmp.dirSync();
app.renderer.render = render;
await app.generateDocs(project, 'docs');
return project;
// const theme = this.app.renderer.theme as MarkdownTheme;
};
global.stubPartials = (partials: string[]) => {
@@ -66,7 +62,6 @@ global.stubHelpers = (helpers: string[]) => {
global.getTemplate = (name: string) => {
const templateDir = path.resolve(
__dirname,
'..',
'packages',
'typedoc-plugin-markdown',
'dist',
@@ -80,7 +75,6 @@ global.getTemplate = (name: string) => {
global.getPartial = (name: string) => {
const partialDir = path.resolve(
__dirname,
'..',
'packages',
'typedoc-plugin-markdown',
'dist',

View File

@@ -7,9 +7,9 @@ tmp.setGracefulCleanup();
async function bootstrap(tmpobj: tmp.DirResult, customOptions = {}) {
const options = {
id: 'default',
logger: 'none',
entryPoints: ['../../test/stubs/src/theme.ts'],
tsconfig: '../../test/stubs/tsconfig.json',
// logger: 'none',
entryPoints: ['../../stub-project/src/theme.ts'],
tsconfig: '../../stub-project/tsconfig.json',
} as any;
const plugin = typedocPlugin(

View File

@@ -14,8 +14,8 @@
"test": "jest --colors",
"build-and-test": "yarn run build && yarn run test",
"docs": "yarn run build && yarn run docs:md && yarn run docs:html",
"docs:md": "typedoc --plugin typedoc-plugin-markdown --plugin typedoc-plugin-mdn-links --options ../../test/typedoc-options.json --out ./docs/md",
"docs:html": "typedoc --options ../../test/typedoc-options.json --plugin typedoc-plugin-mdn-links --out ./docs/html"
"docs:md": "typedoc --plugin typedoc-plugin-markdown --plugin typedoc-plugin-mdn-links --options ../../stub-project/typedoc-options.json --out ./docs/md",
"docs:html": "typedoc --options ../../stub-project/typedoc-options.json --plugin typedoc-plugin-mdn-links --out ./docs/html"
},
"author": "Thomas Grey",
"license": "MIT",

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -10,5 +10,5 @@
"strictNullChecks": false,
"target": "es2020"
},
"include": ["**/*.ts"]
"include": ["**/*.ts", "index.js"]
}

View File

@@ -0,0 +1,6 @@
{
"entryPoints": ["./src/index.ts"],
"includes": "./inc/",
"media": "./media/",
"tsconfig": "./tsconfig.json"
}

View File

@@ -1,6 +0,0 @@
{
"entryPoints": ["./stubs/src/index.ts"],
"includes": "./stubs/inc/",
"media": "./stubs/media/",
"tsconfig": "./stubs/tsconfig.json"
}