Skip to content

Commit

Permalink
Extract API
Browse files Browse the repository at this point in the history
  • Loading branch information
Jym77 committed Sep 6, 2023
1 parent 31851cf commit 325bdc3
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 9 deletions.
38 changes: 35 additions & 3 deletions docs/review/api/alfa-toolchain.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
```ts

import type { ChangelogFunctions } from '@changesets/types';
import { PackageJSON } from '@changesets/types';

// @public (undocumented)
const changelogFunctions: ChangelogFunctions;
Expand All @@ -16,19 +17,50 @@ declare namespace globalChangelog {
}
export { globalChangelog }

// @public
function hasExtractorConfig(name: string, dir: string): Array<string>;

declare namespace individualChangelog {
export {
changelogFunctions as default
}
}
export { individualChangelog }

declare namespace validateChangesets {
export {
// @public (undocumented)
function validate(cwd: string): Promise<void>;

// @public
function validateChangesets(cwd: string): Promise<Array<string>>;

// Warning: (ae-forgotten-export) The symbol "Config" needs to be exported by the entry point index.d.ts
//
// @public
function validatePackageJson({ dir, packageJson, }: {
dir: string;
packageJson: JSON_2;
}, config: Config): Array<string>;

// @public (undocumented)
function validateWorkspaceTsconfig({ dir, packageJson, }: {
dir: string;
packageJson: PackageJSON;
}): Array<string>;

declare namespace Validation {
export {
hasExtractorConfig,
validate,
validateChangesets,
validatePackageJson,
validateWorkspaceTsconfig
}
}
export { validateChangesets }
export { Validation }

// Warnings were encountered during analysis:
//
// src/validation/validate-package-json.ts:41:5 - (ae-forgotten-export) The symbol "JSON" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import * as path from "path";
* Checks that a directory includes an API extractor config file.
*
* @remarks
* `dir` is coming from @manypkg/get-packages, which sets it to the OS
* `dir` is coming from \@manypkg/get-packages, which sets it to the OS
* specific syntax.
*
* @public
*/
export function hasExtractorConfig(name: string, dir: string): Array<string> {
const errors: Array<string> = [];
Expand Down
7 changes: 5 additions & 2 deletions packages/alfa-toolchain/src/validation/validate-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ import { validateWorkspaceTsconfig } from "./validate-workspace-tsconfig";

const targetPath = process.argv[2] ?? ".";

main(targetPath);
validate(targetPath);

async function main(cwd: string) {
/**
* @public
*/
export async function validate(cwd: string) {
const errors: Array<string> = [];

const config = JSON.parse(
Expand Down
2 changes: 2 additions & 0 deletions packages/alfa-toolchain/src/validation/validate-changesets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { Changeset } from "../changeset/get-changeset-details";

/**
* Validate that all changesets have the expected structure.
*
* @public
*/
export async function validateChangesets(cwd: string): Promise<Array<string>> {
return (await getChangeSets(cwd))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { PackageJSON } from "@changesets/types";
/**
* Extended PackageJSON type
*
* @remnarks
* The one from @changesets/types does not include all possible properties…
* @remarks
* The one from \@changesets/types does not include all possible properties…
*/
interface JSON extends PackageJSON {
homepage?: string;
Expand All @@ -27,8 +27,10 @@ type Config = Partial<{
* Checks that a package.json file has the correct fields and structure.
*
* @remarks
* `pkg` comes from @manypkg/get-packages, which sets `dir` to the correct OS
* `pkg` comes from \@manypkg/get-packages, which sets `dir` to the correct OS
* specific string.
*
* @public
*/
export function validatePackageJson(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { PackageJSON } from "@changesets/types";
import * as fs from "fs";
import * as path from "path";

/**
* @public
*/
export function validateWorkspaceTsconfig({
dir,
packageJson,
Expand Down

0 comments on commit 325bdc3

Please sign in to comment.