Skip to content

Commit

Permalink
include build related changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sonalideshpandemsft committed Oct 24, 2024
1 parent 23c386e commit 22f2e29
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 462 deletions.
23 changes: 0 additions & 23 deletions build-tools/packages/build-cli/docs/generate.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Generate commands are used to create/update code, docs, readmes, etc.
* [`flub generate entrypoints`](#flub-generate-entrypoints)
* [`flub generate packlist`](#flub-generate-packlist)
* [`flub generate releaseNotes`](#flub-generate-releasenotes)
* [`flub generate source-entrypoints`](#flub-generate-source-entrypoints)
* [`flub generate typetests`](#flub-generate-typetests)
* [`flub generate upcoming`](#flub-generate-upcoming)

Expand Down Expand Up @@ -356,28 +355,6 @@ EXAMPLES

_See code: [src/commands/generate/releaseNotes.ts](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/build-cli/src/commands/generate/releaseNotes.ts)_

## `flub generate source-entrypoints`

Generates type declaration entrypoints for Fluid Framework API levels (/alpha, /beta. etc.) as found in package.json "exports"

```
USAGE
$ flub generate source-entrypoints [-v | --quiet] [--mainEntrypoint <value>]
FLAGS
--mainEntrypoint=<value> [default: ./src/index.ts] Main entrypoint file containing all untrimmed exports.
LOGGING FLAGS
-v, --verbose Enable verbose logging.
--quiet Disable all logging.
DESCRIPTION
Generates type declaration entrypoints for Fluid Framework API levels (/alpha, /beta. etc.) as found in package.json
"exports"
```

_See code: [src/commands/generate/source-entrypoints.ts](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/build-cli/src/commands/generate/source-entrypoints.ts)_

## `flub generate typetests`

Generates type tests for a package or group of packages.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,18 @@ export class GenerateEntrypointsCommand extends BaseCommand<
);
}

// generate only node10 compat entrypoints
if (!node10TypeCompat) {
promises.push(generateEntrypoints(mainEntrypoint, mapApiTagLevelToOutput, this.logger));
}
// In the past @alpha APIs could be mapped to /legacy via --outFileAlpha.
// When @alpha is mapped to /legacy, @beta should not be included in
// @alpha aka /legacy entrypoint.
const separateBetaFromAlpha = this.flags.outFileAlpha !== ApiLevel.alpha;
promises.push(
generateEntrypoints(
mainEntrypoint,
mapApiTagLevelToOutput,
this.logger,
separateBetaFromAlpha,
),
);

if (node10TypeCompat) {
promises.push(
Expand Down Expand Up @@ -221,9 +229,17 @@ function getOutputConfiguration(
[`${pathPrefix}${outFileAlpha}${outFileSuffix}`, ApiTag.alpha],
[`${pathPrefix}${outFileBeta}${outFileSuffix}`, ApiTag.beta],
[`${pathPrefix}${outFilePublic}${outFileSuffix}`, ApiTag.public],
[`${pathPrefix}${outFileLegacy}${outFileSuffix}`, ApiTag.legacy],
]);

// In the past @alpha APIs could be mapped to /legacy via --outFileAlpha.
// If @alpha is not mapped to same as @legacy, then @legacy can be mapped.
if (outFileAlpha !== outFileLegacy) {
mapQueryPathToApiTagLevel.set(
`${pathPrefix}${outFileLegacy}${outFileSuffix}`,
ApiTag.legacy,
);
}

if (node10TypeCompat) {
// /internal export may be supported without API level generation; so
// add query for such path for Node10 type compat generation.
Expand Down Expand Up @@ -313,11 +329,13 @@ const generatedHeader: string = `/*!
* @param mainEntrypoint - path to main entrypoint file
* @param mapApiTagLevelToOutput - level oriented ApiTag to output file mapping
* @param log - logger
* @param separateBetaFromAlpha - if true, beta APIs will not be included in alpha outputs
*/
async function generateEntrypoints(
mainEntrypoint: string,
mapApiTagLevelToOutput: Map<ApiTag, ExportData>,
log: CommandLogger,
separateBetaFromAlpha: boolean,
): Promise<void> {
/**
* List of out file save promises. Used to collect generated file save
Expand Down Expand Up @@ -401,7 +419,7 @@ async function generateEntrypoints(
// Additionally, if beta should not accumulate to alpha (alpha may be
// treated specially such as mapped to /legacy) then skip beta too.
// eslint-disable-next-line unicorn/no-lonely-if
if (apiTagLevel !== "beta") {
if (!separateBetaFromAlpha || apiTagLevel !== "beta") {
// update common set
commonNamedExports = namedExports;
}
Expand Down
Loading

0 comments on commit 22f2e29

Please sign in to comment.