Skip to content

Commit

Permalink
chore: restructured dev directory
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreyuk committed Jan 28, 2024
1 parent da9eb30 commit 92b45b4
Show file tree
Hide file tree
Showing 303 changed files with 4,622 additions and 5,847 deletions.
7 changes: 1 addition & 6 deletions .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,5 @@
"linked": [],
"access": "public",
"baseBranch": "next",
"updateInternalDependencies": "minor",
"ignore": [
"@dev-packages/helpers",
"@dev-packages/prebuild-options",
"@dev-packages/generate-readmes"
]
"updateInternalDependencies": "minor"
}
5 changes: 1 addition & 4 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
"docusaurus-plugin-typedoc": "0.18.0",
"typedoc-vitepress-theme": "0.0.0",
"typedoc-github-wiki-theme": "1.0.1",
"typedoc-gitlab-wiki-theme": "1.0.0",
"@dev-packages/generate-readmes": "0.0.0",
"@dev-packages/helpers": "0.0.0",
"@dev-packages/prebuild-options": "0.0.0"
"typedoc-gitlab-wiki-theme": "1.0.0"
},
"changesets": [
"afraid-fans-study",
Expand Down
6 changes: 6 additions & 0 deletions devtools/examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
These folder is intended for internal dev purposes.

For plugin examples please visit:

- https://github.com/tgreyuk/typedoc-plugin-markdown-examples
- https://github.com/tgreyuk/typedoc-vitepress-theme-example
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const docusaurusPlugin = path.join(
__dirname,
'..',
'..',
'..',
'packages',
'docusaurus-plugin-typedoc',
'dist',
Expand Down Expand Up @@ -45,8 +46,8 @@ const config = {
[
docusaurusPlugin,
{
...require(path.join(__dirname, '../../stubs/typedoc.cjs')),
entryPoints: '../../stubs/src/reflections/index.ts',
...require(path.join(__dirname, '../../../stubs/typedoc.cjs')),
entryPoints: '../../../stubs/src/reflections/index.ts',
typeDeclarationFormat: 'table',
expandObjects: true,
readme: 'none',
Expand All @@ -60,8 +61,8 @@ const config = {
{
id: 'api-2',
out: './docs/api-2',
...require(path.join(__dirname, '../../stubs/typedoc.cjs')),
entryPoints: '../../stubs/src/groups/**/*.ts',
...require(path.join(__dirname, '../../../stubs/typedoc.cjs')),
entryPoints: '../../../stubs/src/groups/**/*.ts',
cleanOutputDir: true,
},
],
Expand All @@ -70,8 +71,8 @@ const config = {
{
id: 'api-3',
out: './docs/api-3',
...require(path.join(__dirname, '../../stubs/typedoc.cjs')),
entryPoints: '../../stubs/src/groups/**/*.ts',
...require(path.join(__dirname, '../../../stubs/typedoc.cjs')),
entryPoints: '../../../stubs/src/groups/**/*.ts',
readme: 'none',
outputFileStrategy: 'modules',
entryModule: 'index',
Expand All @@ -83,8 +84,8 @@ const config = {
{
id: 'api-4',
out: './docs/api-4',
...require(path.join(__dirname, '../../stubs/typedoc.cjs')),
entryPoints: '../../stubs/src/packages/*',
...require(path.join(__dirname, '../../../stubs/typedoc.cjs')),
entryPoints: '../../../stubs/src/packages/*',
entryPointStrategy: 'packages',
sidebar: { pretty: true },
},
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"prestart": "cd ../../packages/docusaurus-plugin-typedoc && npm run build",
"prestart": "cd ../../../packages/docusaurus-plugin-typedoc && npm run build",
"start": "docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"scripts": {
"publish-typedoc": "typedoc",
"build-plugin": "cd ../../packages/typedoc-vitepress-theme && npm run build",
"build-plugin": "cd ../../../packages/typedoc-vitepress-theme && npm run build",
"predocs:dev": "npm run build-plugin && npm run publish-typedoc",
"docs:dev": "vitepress dev",
"docs:build": "vitepress build",
Expand Down
14 changes: 14 additions & 0 deletions devtools/examples/vitepress/typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": ["../../../stubs/typedoc.cjs"],
"entryPoints": ["../../../stubs/src/packages/*"],
"entryPointStrategy": "packages",
"outputFileStrategy": "modules",
"plugin": [
"../../../packages/typedoc-plugin-markdown/dist",
"../../../packages/typedoc-vitepress-theme/dist"
],
"sidebar": {
"collapse": false,
"pretty": true
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions devtools/packages/fixtures/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @devtools/fixtures

A private package to run fixtures from the command line.
151 changes: 151 additions & 0 deletions devtools/packages/fixtures/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
#!/usr/bin/env ts-node

import { getPackageName } from '@devtools/helpers';
import { spawn } from 'child_process';
import { consola } from 'consola';
import * as fs from 'fs-extra';
import * as path from 'path';
import { Fixture } from './models';

const timeStart = new Date().getTime();

main();

async function main() {
fs.removeSync(path.join(process.cwd(), 'test', 'fixtures', 'out'));

const config: Record<string, Fixture> = await import(
path.join(process.cwd(), process.argv[3])
);

const fixtureCount = Object.entries(config.default).reduce(
(prev, curr) =>
prev + curr[1].options.length * (curr[1].outputFileStragies?.length || 2),
0,
);

consola.start(
`[${getPackageName()}] Building ${fixtureCount} test fixtures...`,
);

Object.entries(config.default).forEach(([key, config]) => {
const outputFileStrategies: ('members' | 'modules')[] =
config.outputFileStrategies || ['members', 'modules'];
outputFileStrategies.forEach((outputFileStrategy) => {
config.options.forEach((optionGroup, index: number) => {
const options = {
outputFileStrategy,
...config.commonOptions,
...optionGroup,
};
writeMarkdown(
key,
config.entryPoints,
outputFileStrategy,
options,
'opts-' + Number(index + 1),
);
});
});
});
}

function writeMarkdown(
key: string,
entryPoints: string[],
outputFileStrategy: 'members' | 'modules',
options: any,
optionDir: string,
) {
const fullPath = path.join(
process.cwd(),
'test',
'fixtures',
'out',
key,
outputFileStrategy,
optionDir,
);
spawn(
'typedoc',
[
...[
'-options',
path.join(__dirname, 'typedoc.cjs'),
'-logLevel',
'Warn',
'-entryPoints',
[`${process.cwd()}/test/fixtures/src/${entryPoints}`],
'-out',
fullPath,
],
...objectToOptions(options),
],
{
stdio: 'inherit',
},
);
}

/*export function writeHtml(
entryPoints: FixtureEntryPoints,
outDir: FixtureOutputDir,
) {
const fullpath = `./test/out/html/${outDir}`;
spawn(
'typedoc',
[
...[
'-options',
`./stubs/typedoc.cjs`,
'-logLevel',
'Warn',
'--media',
'./stubs/media',
'--includes',
'./stubs/inc',
'-entryPoints',
`./stubs/${entryPoints}`,
'-out',
fullpath,
],
],
{
stdio: 'inherit',
},
);
}*/

function objectToOptions(obj: any) {
return Object.entries(obj).reduce(
(prev: any, curr: any) => {
if (Array.isArray(curr[1])) {
return [
...prev,
...curr[1].reduce((prev1, curr1) => {
return [...prev1, ...[`-${curr[0]}`, curr1]];
}, []),
];
}
if (typeof curr[1] === 'object') {
return [
...prev,
...Object.entries(curr[1]).reduce((prev1: any, curr1: any) => {
return [...prev1, ...[`-${curr[0]}.${curr1[0]}`, true]];
}, []),
];
}
return [...prev, ...[`-${curr[0]}`, curr[1]]];
},
['-plugin', 'typedoc-plugin-markdown'],
);
}

process.on('exit', () => {
consola.success(
`[${getPackageName()}] Finished building fixtures in ${(
(new Date().getTime() - timeStart) /
1000
).toFixed(2)} seconds`,
);
});
6 changes: 6 additions & 0 deletions devtools/packages/fixtures/models.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export interface Fixture {
entryPoints: string;
outputFileStragies?: ('members' | 'modules')[];
commonOptions: Record<string, any>;
options: Record<string, any>[];
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@dev-packages/prebuild-options",
"name": "@devtools/fixtures",
"version": "0.0.0",
"private": true,
"files": [
"/"
],
"bin": {
"prebuild-options": "cli.ts"
"fixtures": "cli.ts"
}
}
15 changes: 15 additions & 0 deletions devtools/packages/fixtures/typedoc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
cleanOutputDir: true,
sourceLinkTemplate: 'http://source-url',
tsconfig: process.cwd() + '/test/fixtures/tsconfig.json',
externalSymbolLinkMappings: {
typedoc: {
Application: 'https://typedoc.org/api/classes/Application.html',
},
typescript: {
Promise:
'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise',
URL: 'https://developer.mozilla.org/en-US/docs/Web/API/URL',
},
},
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env ts-node

import { DOCS_CONFIG } from '@dev-packages/helpers';
import { DOCS_CONFIG } from '@devtools/helpers';
import { consola } from 'consola';
import * as fs from 'fs';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@dev-packages/generate-readmes",
"name": "@devtools/generate-readmes",
"version": "0.0.0",
"private": true,
"files": [
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@dev-packages/helpers",
"name": "@devtools/helpers",
"version": "0.0.0",
"private": true,
"main": "src/index.ts",
"main": "index.ts",
"files": [
"/"
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env ts-node

import { DOCS_CONFIG, DocsConfig, getPackageName } from '@dev-packages/helpers';
import { DOCS_CONFIG, DocsConfig, getPackageName } from '@devtools/helpers';
import { consola } from 'consola';
import { generateDocs } from './tasks/generate-docs';
import { generateModels } from './tasks/generate-models';
Expand Down
8 changes: 8 additions & 0 deletions devtools/packages/prebuild-options/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@devtools/prebuild-options",
"version": "0.0.0",
"private": true,
"files": [
"/"
]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DocsConfig } from '@dev-packages/helpers/src/models';
import { DocsConfig } from '@devtools/helpers';
import * as fs from 'fs';
import * as path from 'path';
import { Project, VariableStatement } from 'ts-morph';
Expand Down Expand Up @@ -212,7 +212,15 @@ function getExampleValue(option) {
}

function getDocsPath(docsPath: string) {
const pagesPath = path.join(__dirname, '..', '..', '..', 'docs', 'pages');
const pagesPath = path.join(
__dirname,
'..',
'..',
'..',
'..',
'docs',
'pages',
);
return path.join(pagesPath, docsPath);
}

Expand Down

0 comments on commit 92b45b4

Please sign in to comment.