Skip to content

Commit

Permalink
feat: Update versions for generators (#4796)
Browse files Browse the repository at this point in the history
* Update templates' package.json files

* Include generators in update-versions script

* Fix pattern in unit tests

* Fix indentation

* Upgrade TS version to latest
  • Loading branch information
ceciliaavila authored Nov 22, 2024
1 parent 345fccb commit ff562bc
Show file tree
Hide file tree
Showing 16 changed files with 64 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "<%= botname %>",
"version": "1.0.0",
"version": "4.1.6",
"description": "<%= botDescription %>",
"author": "Generated using Microsoft Bot Builder Yeoman generator v<%= version %>",
"license": "MIT",
Expand All @@ -17,10 +17,10 @@
},
"dependencies": {
"@microsoft/recognizers-text-data-types-timex-expression": "1.1.4",
"botbuilder": "^4.23.1",
"botbuilder-ai": "^4.23.1",
"botbuilder-dialogs": "^4.23.1",
"botbuilder-testing": "^4.23.1",
"botbuilder": "4.1.6",
"botbuilder-ai": "4.1.6",
"botbuilder-dialogs": "4.1.6",
"botbuilder-testing": "4.1.6",
"dotenv": "^8.2.0",
"restify": "^11.1.0"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "<%= botname %>",
"version": "1.0.0",
"version": "4.1.6",
"description": "<%= botDescription %>",
"author": "Generated using Microsoft Bot Builder Yeoman generator v<%= version %>",
"license": "MIT",
Expand Down Expand Up @@ -38,22 +38,23 @@
},
"dependencies": {
"@microsoft/recognizers-text-data-types-timex-expression": "1.1.4",
"botbuilder": "^4.23.1",
"botbuilder-ai": "^4.23.1",
"botbuilder-dialogs": "^4.23.1",
"botbuilder-testing": "^4.23.1",
"botbuilder": "4.1.6",
"botbuilder-ai": "4.1.6",
"botbuilder-dialogs": "4.1.6",
"botbuilder-testing": "4.1.6",
"dotenv": "^8.2.0",
"replace": "~1.2.0",
"restify": "~11.1.0"
},
"devDependencies": {
"@types/mocha": "^7.0.2",
"@types/node": "^18.19.47",
"@types/restify": "8.4.2",
"mocha": "^7.1.2",
"nodemon": "^2.0.4",
"nyc": "^15.0.1",
"ts-node": "^8.10.1",
"tslint": "^6.1.2",
"typescript": "^4.0.7"
"typescript": "^5.6.3"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "<%= botname %>",
"version": "1.0.0",
"version": "4.1.6",
"description": "<%= botDescription %>",
"author": "Generated using Microsoft Bot Builder Yeoman generator v<%= version %>",
"license": "MIT",
Expand All @@ -17,9 +17,9 @@
},
"dependencies": {
"@microsoft/recognizers-text-data-types-timex-expression": "1.1.4",
"botbuilder": "^4.23.1,
"botbuilder-ai": "^4.23.1",
"botbuilder-dialogs": "^4.23.1",
"botbuilder": "4.1.6",
"botbuilder-ai": "4.1.6",
"botbuilder-dialogs": "4.1.6",
"dotenv": "~8.2.0",
"restify": "~11.1.0"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "<%= botname %>",
"version": "1.0.0",
"version": "4.1.6",
"description": "<%= botDescription %>",
"author": "Generated using Microsoft Bot Builder Yeoman generator v<%= version %>",
"license": "MIT",
Expand All @@ -19,21 +19,22 @@
},
"dependencies": {
"@microsoft/recognizers-text-data-types-timex-expression": "1.1.4",
"botbuilder": "^4.23.1",
"botbuilder-ai": "^4.23.1",
"botbuilder-dialogs": "^4.23.1",
"botbuilder": "4.1.6",
"botbuilder-ai": "4.1.6",
"botbuilder-dialogs": "4.1.6",
"dotenv": "~8.2.0",
"replace": "~1.2.0",
"restify": "~11.1.0"
},
"devDependencies": {
"@types/mocha": "^7.0.2",
"@types/node": "^18.19.47",
"@types/restify": "8.4.2",
"mocha": "^7.1.2",
"nodemon": "^2.0.4",
"nyc": "^15.0.1",
"ts-node": "^8.10.1",
"tslint": "^6.1.2",
"typescript": "^4.0.7"
"typescript": "^5.6.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
"composite": true,
"declaration": true,
"target": "es2017",
"module": "commonjs",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "./lib",
"rootDir": "./src",
"resolveJsonModule": true,
"rootDirs": ["./src", "./resources"],
"sourceMap": true,
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo"
"tsBuildInfoFile": "./lib/.tsbuildinfo",
"esModuleInterop": true
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "<%= botname %>",
"version": "1.0.0",
"version": "4.1.6",
"description": "<%= botDescription %>",
"author": "Generated using Microsoft Bot Builder Yeoman generator v<%= version %>",
"license": "MIT",
Expand All @@ -16,7 +16,7 @@
"url": "https://github.com"
},
"dependencies": {
"botbuilder": "^4.23.1",
"botbuilder": "4.1.6",
"dotenv": "~8.2.0",
"restify": "~11.1.0"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "<%= botname %>",
"version": "1.0.0",
"version": "4.1.6",
"description": "<%= botDescription %>",
"author": "Generated using Microsoft Bot Builder Yeoman generator v<%= version %>",
"license": "MIT",
Expand All @@ -18,15 +18,16 @@
"url": "https://github.com"
},
"dependencies": {
"botbuilder": "~4.23.1",
"botbuilder": "4.1.6",
"dotenv": "~8.2.0",
"replace": "~1.2.0",
"restify": "~11.1.0"
},
"devDependencies": {
"@types/node": "^18.19.47",
"@types/restify": "8.4.2",
"nodemon": "^2.0.4",
"tslint": "^6.1.2",
"typescript": "^4.0.7"
"typescript": "^5.6.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
"compilerOptions": {
"declaration": true,
"target": "es2017",
"module": "commonjs",
"moduleResolution": "NodeNext",
"module": "NodeNext",
"outDir": "./lib",
"rootDir": "./src",
"sourceMap": true,
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo"
"tsBuildInfoFile": "./lib/.tsbuildinfo",
"esModuleInterop": true
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "<%= botname %>",
"version": "1.0.0",
"version": "4.1.6",
"description": "<%= botDescription %>",
"author": "Generated using Microsoft Bot Builder Yeoman generator v<%= version %>",
"license": "MIT",
Expand All @@ -16,7 +16,7 @@
"url": "https://github.com"
},
"dependencies": {
"botbuilder": "^4.23.1",
"botbuilder": "4.1.6",
"restify": "~11.1.0"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "<%= botname %>",
"version": "1.0.0",
"version": "4.1.6",
"description": "<%= botDescription %>",
"author": "Generated using Microsoft Bot Builder Yeoman generator v<%= version %>",
"license": "MIT",
Expand All @@ -18,14 +18,15 @@
"url": "https://github.com"
},
"dependencies": {
"botbuilder": "^4.23.1",
"botbuilder": "4.1.6",
"replace": "~1.2.0",
"restify": "~11.1.0"
},
"devDependencies": {
"@types/node": "^18.19.47",
"@types/restify": "8.4.2",
"nodemon": "^2.0.4",
"tslint": "^6.1.2",
"typescript": "^4.0.7"
"typescript": "^5.6.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
"compilerOptions": {
"declaration": true,
"target": "es2017",
"module": "commonjs",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "./lib",
"rootDir": "./src",
"sourceMap": true,
"incremental": true,
"tsBuildInfoFile": "./lib/.tsbuildinfo"
"tsBuildInfoFile": "./lib/.tsbuildinfo",
"esModuleInterop": true
}
}
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
4 changes: 2 additions & 2 deletions libraries/botbuilder-repo-utils/tests/updateVersions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ describe('updateVersions', function () {
return {
...workspace,
relPath,
absPath: path.join(root, ...relPath, 'package.json'),
posixPath: path.posix.join(root, ...relPath, 'package.json'),
absPath: path.join(root, ...relPath, '{package.json,package-with-tests.json}{,.js,.ts}'),
posixPath: path.posix.join(root, ...relPath, '{package.json,package-with-tests.json}{,.js,.ts}'),
};
});

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 ff562bc

Please sign in to comment.