Skip to content

Commit

Permalink
typedoc compliance (#58)
Browse files Browse the repository at this point in the history
<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?

Are there any issues or other links reviewers should consult to
understand this pull request better? For instance:

* Fixes #12345
* See: #67890
-->
We want to make sure that for a given project:
* The project contains typedoc as a dev dependency, and the versions
match the same dev dependencies as in the module template.
* The project contains a typedoc.json, and the content of this file
matches the same as in the module template.
* The project contains the same build:docs package script as in the
module template.

Fixes [#47](#47)
  • Loading branch information
kanthesha authored Mar 2, 2024
1 parent e7bc10d commit facf481
Show file tree
Hide file tree
Showing 9 changed files with 511 additions and 10 deletions.
56 changes: 46 additions & 10 deletions src/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,14 @@ describe('main', () => {
'ts-node': '1.0.0',
tsup: '1.0.0',
typescript: '1.0.0',
typedoc: '1.0.0',
},
scripts: {
test: 'test script',
'test:watch': 'test watch script',
build: 'test build',
'build:types': 'test build types',
'build:docs': 'test build docs',
},
}),
);
Expand Down Expand Up @@ -116,6 +118,10 @@ describe('main', () => {
path.join(repository.directoryPath, 'tsup.config.ts'),
'content for tsup.config.ts',
);
await writeFile(
path.join(repository.directoryPath, 'typedoc.json'),
'content for typedoc.json',
);
}
const outputLogger = new FakeOutputLogger();

Expand Down Expand Up @@ -150,6 +156,8 @@ repo-1
- Does the \`types\` field in \`package.json\` conform? ✅
- Does the \`files\` field in \`package.json\` conform? ✅
- Does LavaMoat allow scripts for \`tsup>esbuild\`? ✅
- Do the typedoc-related \`devDependencies\` in \`package.json\` conform? ✅
- Do the typedoc-related \`scripts\` in \`package.json\` conform? ✅
- Is \`README.md\` present? ✅
- Does the README conform by recommending the correct Yarn version to install? ✅
- Does the README conform by recommending node install from nodejs.org? ✅
Expand All @@ -161,8 +169,9 @@ repo-1
- Is \`tsconfig.json\` present, and does it conform? ✅
- Is \`tsconfig.build.json\` present, and does it conform? ✅
- Is \`tsup.config.ts\` present, and does it conform? ✅
- Is \`typedoc.json\` present, and does it conform? ✅
Results: 26 passed, 0 failed, 26 total
Results: 29 passed, 0 failed, 29 total
Elapsed time: 0 ms
Expand All @@ -184,6 +193,8 @@ repo-2
- Does the \`types\` field in \`package.json\` conform? ✅
- Does the \`files\` field in \`package.json\` conform? ✅
- Does LavaMoat allow scripts for \`tsup>esbuild\`? ✅
- Do the typedoc-related \`devDependencies\` in \`package.json\` conform? ✅
- Do the typedoc-related \`scripts\` in \`package.json\` conform? ✅
- Is \`README.md\` present? ✅
- Does the README conform by recommending the correct Yarn version to install? ✅
- Does the README conform by recommending node install from nodejs.org? ✅
Expand All @@ -195,8 +206,9 @@ repo-2
- Is \`tsconfig.json\` present, and does it conform? ✅
- Is \`tsconfig.build.json\` present, and does it conform? ✅
- Is \`tsup.config.ts\` present, and does it conform? ✅
- Is \`typedoc.json\` present, and does it conform? ✅
Results: 26 passed, 0 failed, 26 total
Results: 29 passed, 0 failed, 29 total
Elapsed time: 0 ms
`,
Expand Down Expand Up @@ -263,8 +275,10 @@ repo-1
- \`tsconfig.build.json\` does not exist in this project.
- Is \`tsup.config.ts\` present, and does it conform? ❌
- \`tsup.config.ts\` does not exist in this project.
- Is \`typedoc.json\` present, and does it conform? ❌
- \`typedoc.json\` does not exist in this project.
Results: 0 passed, 10 failed, 10 total
Results: 0 passed, 11 failed, 11 total
Elapsed time: 0 ms
Expand Down Expand Up @@ -293,8 +307,10 @@ repo-2
- \`tsconfig.build.json\` does not exist in this project.
- Is \`tsup.config.ts\` present, and does it conform? ❌
- \`tsup.config.ts\` does not exist in this project.
- Is \`typedoc.json\` present, and does it conform? ❌
- \`typedoc.json\` does not exist in this project.
Results: 0 passed, 10 failed, 10 total
Results: 0 passed, 11 failed, 11 total
Elapsed time: 0 ms
`,
Expand Down Expand Up @@ -367,8 +383,10 @@ repo-2
- \`tsconfig.build.json\` does not exist in this project.
- Is \`tsup.config.ts\` present, and does it conform? ❌
- \`tsup.config.ts\` does not exist in this project.
- Is \`typedoc.json\` present, and does it conform? ❌
- \`typedoc.json\` does not exist in this project.
Results: 1 passed, 9 failed, 10 total
Results: 1 passed, 10 failed, 11 total
Elapsed time: 0 ms
`.trimStart(),
Expand Down Expand Up @@ -430,12 +448,14 @@ Elapsed time: 0 ms
'ts-node': '1.0.0',
tsup: '1.0.0',
typescript: '1.0.0',
typedoc: '1.0.0',
},
scripts: {
test: 'test script',
'test:watch': 'test watch script',
build: 'test build',
'build:types': 'test build types',
'build:docs': 'test build docs',
},
}),
);
Expand Down Expand Up @@ -463,6 +483,10 @@ Elapsed time: 0 ms
path.join(repository.directoryPath, 'tsup.config.ts'),
'content for tsup.config.ts',
);
await writeFile(
path.join(repository.directoryPath, 'typedoc.json'),
'content for typedoc.json',
);
}
const outputLogger = new FakeOutputLogger();

Expand Down Expand Up @@ -497,6 +521,8 @@ repo-1
- Does the \`types\` field in \`package.json\` conform? ✅
- Does the \`files\` field in \`package.json\` conform? ✅
- Does LavaMoat allow scripts for \`tsup>esbuild\`? ✅
- Do the typedoc-related \`devDependencies\` in \`package.json\` conform? ✅
- Do the typedoc-related \`scripts\` in \`package.json\` conform? ✅
- Is \`README.md\` present? ✅
- Does the README conform by recommending the correct Yarn version to install? ✅
- Does the README conform by recommending node install from nodejs.org? ✅
Expand All @@ -508,8 +534,9 @@ repo-1
- Is \`tsconfig.json\` present, and does it conform? ✅
- Is \`tsconfig.build.json\` present, and does it conform? ✅
- Is \`tsup.config.ts\` present, and does it conform? ✅
- Is \`typedoc.json\` present, and does it conform? ✅
Results: 26 passed, 0 failed, 26 total
Results: 29 passed, 0 failed, 29 total
Elapsed time: 0 ms
Expand All @@ -531,6 +558,8 @@ repo-2
- Does the \`types\` field in \`package.json\` conform? ✅
- Does the \`files\` field in \`package.json\` conform? ✅
- Does LavaMoat allow scripts for \`tsup>esbuild\`? ✅
- Do the typedoc-related \`devDependencies\` in \`package.json\` conform? ✅
- Do the typedoc-related \`scripts\` in \`package.json\` conform? ✅
- Is \`README.md\` present? ✅
- Does the README conform by recommending the correct Yarn version to install? ✅
- Does the README conform by recommending node install from nodejs.org? ✅
Expand All @@ -542,8 +571,9 @@ repo-2
- Is \`tsconfig.json\` present, and does it conform? ✅
- Is \`tsconfig.build.json\` present, and does it conform? ✅
- Is \`tsup.config.ts\` present, and does it conform? ✅
- Is \`typedoc.json\` present, and does it conform? ✅
Results: 26 passed, 0 failed, 26 total
Results: 29 passed, 0 failed, 29 total
Elapsed time: 0 ms
`,
Expand Down Expand Up @@ -610,8 +640,10 @@ repo-1
- \`tsconfig.build.json\` does not exist in this project.
- Is \`tsup.config.ts\` present, and does it conform? ❌
- \`tsup.config.ts\` does not exist in this project.
- Is \`typedoc.json\` present, and does it conform? ❌
- \`typedoc.json\` does not exist in this project.
Results: 0 passed, 10 failed, 10 total
Results: 0 passed, 11 failed, 11 total
Elapsed time: 0 ms
Expand Down Expand Up @@ -640,8 +672,10 @@ repo-2
- \`tsconfig.build.json\` does not exist in this project.
- Is \`tsup.config.ts\` present, and does it conform? ❌
- \`tsup.config.ts\` does not exist in this project.
- Is \`typedoc.json\` present, and does it conform? ❌
- \`typedoc.json\` does not exist in this project.
Results: 0 passed, 10 failed, 10 total
Results: 0 passed, 11 failed, 11 total
Elapsed time: 0 ms
`,
Expand Down Expand Up @@ -713,8 +747,10 @@ repo-2
- \`tsconfig.build.json\` does not exist in this project.
- Is \`tsup.config.ts\` present, and does it conform? ❌
- \`tsup.config.ts\` does not exist in this project.
- Is \`typedoc.json\` present, and does it conform? ❌
- \`typedoc.json\` does not exist in this project.
Results: 1 passed, 9 failed, 10 total
Results: 1 passed, 10 failed, 11 total
Elapsed time: 0 ms
`,
Expand Down
6 changes: 6 additions & 0 deletions src/rules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import packageMainFieldConforms from './package-main-field-conforms';
import packageModuleFieldConforms from './package-module-field-conforms';
import packagePackageManagerFieldConforms from './package-package-manager-field-conforms';
import packageTestScriptsConform from './package-test-scripts-conform';
import packageTypedocDevDependenciesConform from './package-typedoc-dev-dependencies-conform';
import packageTypedocScriptsConform from './package-typedoc-scripts-conform';
import packageTypesFieldConforms from './package-types-field-conforms';
import packageTypescriptDevDependenciesConform from './package-typescript-dev-dependencies-conform';
import packageTypescriptScriptsConform from './package-typescript-scripts-conform';
Expand All @@ -22,6 +24,7 @@ import requireSourceDirectory from './require-source-directory';
import requireTsconfig from './require-tsconfig';
import requireTsconfigBuild from './require-tsconfig-build';
import requireTsupConfig from './require-tsup-config';
import requireTypedoc from './require-typedoc';
import requireValidPackageManifest from './require-valid-package-manifest';

export const rules = [
Expand Down Expand Up @@ -50,4 +53,7 @@ export const rules = [
packageTypesFieldConforms,
packageFilesFieldConforms,
packageLavamoatTsupConforms,
packageTypedocDevDependenciesConform,
packageTypedocScriptsConform,
requireTypedoc,
] as const;
Loading

0 comments on commit facf481

Please sign in to comment.