Skip to content

Commit c343f1d

Browse files
authored
Merge pull request #259 from TobyAndToby/ts/fix-website-signatures
Fix v3 signatures in documentation
2 parents 90a4516 + 846e181 commit c343f1d

File tree

7 files changed

+255
-34
lines changed

7 files changed

+255
-34
lines changed

src/packages/generate-license-file/src/lib/generateLicenseFile.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export type GenerateLicenseFileOptions = IntersectionExpander<
1414
* Scans the project found at the given path and creates a license file at the given output location
1515
* @param pathToPackageJson A path to the package.json for the project
1616
* @param outputPath A file path for the resulting license file
17-
* @optional @param lineEnding "crlf" or "lf". Will use the system default if omitted
17+
* @param options Additional options for the license file generation
1818
*/
1919
export async function generateLicenseFile(
2020
pathToPackageJson: string,
@@ -26,7 +26,7 @@ export async function generateLicenseFile(
2626
* Scans the projects found at the given paths and creates a license file at the given output location
2727
* @param pathsToPackageJsons Paths to the package.jsons for the projects
2828
* @param outputPath A file path for the resulting license file
29-
* @optional @param lineEnding "crlf" or "lf". Will use the system default if omitted
29+
* @param options Additional options for the license file generation
3030
*/
3131
export async function generateLicenseFile(
3232
pathsToPackageJsons: string[],

src/packages/generate-license-file/src/lib/getLicenseFileText.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export type GetLicenseFileTextOptions = IntersectionExpander<
2020
/**
2121
* Scans the project found at the given path and returns a string containing the licenses for all of the dependencies
2222
* @param pathToPackageJson A path to the package.json for the project
23-
* @optional @param lineEnding "crlf" or "lf". Will use the system default if omitted
23+
* @param options Additional options for the license text generation
2424
* @returns A promise that resolves to the license file text
2525
*/
2626
export async function getLicenseFileText(
@@ -31,7 +31,7 @@ export async function getLicenseFileText(
3131
/**
3232
* Scans the projects found at the given paths and returns a string containing the licenses for all the dependencies across all the projects
3333
* @param pathsToPackageJsons Paths to the package.jsons for the projects
34-
* @optional @param lineEnding "crlf" or "lf". Will use the system default if omitted
34+
* @param options Additional options for the license text generation
3535
* @returns A promise that resolves to the license file text
3636
*/
3737
export async function getLicenseFileText(

src/packages/generate-license-file/src/lib/getProjectLicenses.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export type GetProjectLicensesOptions = IntersectionExpander<ReplaceOption & Exc
1010
* Scans the project found at the given path and returns an array of objects each
1111
* containing the details of an identified license and the dependencies it pertains to.
1212
* @param pathToPackageJson A path to the package.json for the project
13+
* @param options Additional options for the license discovery
1314
* @returns Array of `ILicense`s each containing the license content and respective dependencies
1415
*/
1516
export async function getProjectLicenses(

src/packages/generate-license-file/src/lib/options/lineEnding.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { LineEnding } from "../lineEndings";
22

33
export type LineEndingOption = {
44
/**
5-
* Specify the line ending to use in the generated license file
5+
* Specify the line ending to use in the generated license file: either "lf" or "crlf"
66
*
77
* If you don't specify a line ending then line ending of the operating
88
* system will be used

website/docs/library/api.mdx

Lines changed: 123 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ description: API reference documentation for the generate license file library A
66
import TypeScriptToggle from "@site/src/components/TypeScriptToggle";
77
import LibraryMethod from "@site/src/components/docs/library/api/LibraryMethod";
88
import LibraryModel from "@site/src/components/docs/library/api/LibraryModel";
9-
import MethodSignature from "@site/src/components/docs/library/api/MethodSignature";
109
import MethodTags from "@site/src/components/docs/library/api/MethodTags";
1110

1211
<TypeScriptToggle />
@@ -32,9 +31,9 @@ import MethodTags from "@site/src/components/docs/library/api/MethodTags";
3231
description: "A file path for the resulting license file",
3332
},
3433
{
35-
name: "lineEnding",
36-
type: `"crlf" | "lf"`,
37-
description: `Will use the system default if omitted`,
34+
name: "options",
35+
type: "GenerateLicenseFileOptions",
36+
description: "Additional options for the license file generation",
3837
isOptional: true,
3938
},
4039
],
@@ -58,9 +57,9 @@ import MethodTags from "@site/src/components/docs/library/api/MethodTags";
5857
description: "A file path for the resulting license file",
5958
},
6059
{
61-
name: "lineEnding",
62-
type: `"crlf" | "lf"`,
63-
description: `Will use the system default if omitted`,
60+
name: "options",
61+
type: "GenerateLicenseFileOptions",
62+
description: "Additional options for the license file generation",
6463
isOptional: true,
6564
},
6665
],
@@ -91,9 +90,9 @@ import MethodTags from "@site/src/components/docs/library/api/MethodTags";
9190
description: "A path to the package.json for the project",
9291
},
9392
{
94-
name: "lineEnding",
95-
type: `"crlf" | "lf"`,
96-
description: `Will use the system default if omitted`,
93+
name: "options",
94+
type: "GetLicenseFileTextOptions",
95+
description: "Additional options for the license text generation",
9796
isOptional: true,
9897
},
9998
],
@@ -112,9 +111,9 @@ import MethodTags from "@site/src/components/docs/library/api/MethodTags";
112111
description: "Paths to the package.jsons for the projects",
113112
},
114113
{
115-
name: "lineEnding",
116-
type: `"crlf" | "lf"`,
117-
description: `Will use the system default if omitted`,
114+
name: "options",
115+
type: "GetLicenseFileTextOptions",
116+
description: "Additional options for the license text generation",
118117
isOptional: true,
119118
},
120119
],
@@ -144,6 +143,12 @@ import MethodTags from "@site/src/components/docs/library/api/MethodTags";
144143
type: "string",
145144
description: "A path to the package.json for the project",
146145
},
146+
{
147+
name: "options",
148+
type: "GetProjectLicensesOptions",
149+
description: "Additional options for the license discovery",
150+
isOptional: true,
151+
},
147152
],
148153
returnType: {
149154
type: "Promise<ILicense[]>",
@@ -174,9 +179,113 @@ import MethodTags from "@site/src/components/docs/library/api/MethodTags";
174179
<>
175180
Contains the content of a given license and the list of dependencies it pertains to. It is
176181
returned from{" "}
177-
<a href="#getProjectLicenses">
182+
<a href="#getprojectlicenses-">
183+
<code>getProjectLicenses</code>
184+
</a>
185+
{""}.
186+
</>
187+
}
188+
/>
189+
190+
### GenerateLicenseFileOptions
191+
192+
<LibraryModel
193+
properties={[
194+
{
195+
name: "lineEnding",
196+
type: '"lf" | "crlf"',
197+
description:
198+
'Specify the line ending to use in the generated license file: either "lf" or "crlf". Leave undefined to use the system default',
199+
},
200+
{
201+
name: "replace",
202+
type: "Record<string, string>",
203+
description:
204+
"A map of packages-to-file-paths containing content that should be used instead of the package's license content",
205+
},
206+
{
207+
name: "exclude",
208+
type: "string[]",
209+
description: "Packages to exclude from the generated license file",
210+
},
211+
{
212+
name: "append",
213+
type: "string[]",
214+
description: "File paths to read in and append to the bottom of the generated license file",
215+
},
216+
]}
217+
description={
218+
<>
219+
Additional options for the license file generation. Can be optionally passed into{" "}
220+
<a href="#generatelicensefile-">
221+
<code>generateLicenseFile</code>
222+
</a>
223+
{""}.
224+
</>
225+
}
226+
/>
227+
228+
### GetLicenseFileTextOptions
229+
230+
<LibraryModel
231+
properties={[
232+
{
233+
name: "lineEnding",
234+
type: '"lf" | "crlf"',
235+
description:
236+
'Specify the line ending to use in the generated license file: either "lf" or "crlf". Leave undefined to use the system default',
237+
},
238+
{
239+
name: "replace",
240+
type: "Record<string, string>",
241+
description:
242+
"A map of packages-to-file-paths containing content that should be used instead of the package's license content",
243+
},
244+
{
245+
name: "exclude",
246+
type: "string[]",
247+
description: "Packages to exclude from the generated license file",
248+
},
249+
{
250+
name: "append",
251+
type: "string[]",
252+
description: "File paths to read in and append to the bottom of the generated license file",
253+
},
254+
]}
255+
description={
256+
<>
257+
Additional options for the license text generation. Can be optionally passed into{" "}
258+
<a href="#getlicensefiletext-">
259+
<code>getLicenseFileText</code>
260+
</a>
261+
{""}.
262+
</>
263+
}
264+
/>
265+
266+
### GetProjectLicensesOptions
267+
268+
<LibraryModel
269+
properties={[
270+
{
271+
name: "replace",
272+
type: "Record<string, string>",
273+
description:
274+
"A map of packages-to-file-paths containing content that should be used instead of the package's license content",
275+
},
276+
{
277+
name: "exclude",
278+
type: "string[]",
279+
description: "Packages to exclude from the generated license file",
280+
},
281+
]}
282+
description={
283+
<>
284+
Additional options for the license discovery. Can be optionally passed into{" "}
285+
<a href="#getprojectlicenses-">
178286
<code>getProjectLicenses</code>
179287
</a>
288+
{""}.
180289
</>
181290
}
182291
/>

website/src/components/docs/library/api/MethodSignature.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ const MethodSignature = ({ methodName, signature }: Props) => {
5252
<p>
5353
<code>
5454
{parameter.name}
55-
{useTypeScript && ": " + parameter.type}
55+
{useTypeScript && parameter.isOptional && "?"}
56+
{useTypeScript && ": "}
57+
{useTypeScript && parameter.type}
5658
</code>
5759
{parameter.description && ` - ${parameter.description}`}
5860
</p>

0 commit comments

Comments
 (0)