Skip to content

Commit

Permalink
Include generators in update-versions script
Browse files Browse the repository at this point in the history
  • Loading branch information
ceciliaavila committed Nov 14, 2024
1 parent 712f995 commit 8af3364
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion libraries/botbuilder-repo-utils/src/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface Package {
deprecated?: boolean;
internal?: boolean;

workspaces?: { packages: string[] };
workspaces?: { packages: string[]; generators: string[] };

dependencies?: Record<string, string>;
devDependencies?: Record<string, string>;
Expand Down
7 changes: 6 additions & 1 deletion libraries/botbuilder-repo-utils/src/updateVersions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,13 @@ export const command = (argv: string[], quiet = false) => async (): Promise<Resu
// Read git commit sha if instructed (JSON.parse properly coerces strings to boolean)
const commitSha = JSON.parse(flags.git) ? await gitSha('HEAD') : undefined;

const projects: string[] = [
...(packageFile.workspaces?.packages || []),
...(packageFile.workspaces?.generators || []),
];

// Collect all workspaces from the repo root. Returns workspaces with absolute paths.
const workspaces = await collectWorkspacePackages(repoRoot, packageFile.workspaces?.packages);
const workspaces = await collectWorkspacePackages(repoRoot, projects);

// Build an object mapping a package name to its new, updated version
const workspaceVersions = workspaces.reduce<Record<string, string>>(
Expand Down
6 changes: 5 additions & 1 deletion libraries/botbuilder-repo-utils/src/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ export async function collectWorkspacePackages(
filters: Partial<Filters> = {}
): Promise<Array<Workspace>> {
// Note: posix is required, this emits absolute paths that are platform specific
const paths = await glob(workspaces.map((workspace) => path.posix.join(repoRoot, workspace, 'package.json')));
const paths = await glob(
workspaces.map((workspace) =>
path.posix.join(repoRoot, workspace, '{package.json,package-with-tests.json}{,.js,.ts}'),
),
);

const maybeWorkspaces = await Promise.all(
paths.map(
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"workspaces": {
"packages": [
"libraries/*",
"libraries/functional-tests/dialogToDialog/*",
"libraries/testskills/*",
"testing/*",
"testing/browser-functional/browser-echo-bot",
"tools",
"transcripts"
"tools"
],
"generators": [
"generators/generator-botbuilder/generators/app/templates/*"
],
"nohoist": [
"**/@types/selenium-webdriver"
Expand Down

0 comments on commit 8af3364

Please sign in to comment.