Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update versions for generators #4796

Merged
merged 5 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
rido-min marked this conversation as resolved.
Show resolved Hide resolved
"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": "^4.9.3"
rido-min marked this conversation as resolved.
Show resolved Hide resolved
}
}
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": "^4.9.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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the motivation to diverge from commonjs? afaik we have not finalized support to latest node

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had to include the moduleResolution property to solve a TS issue. It was recommended to match the value for the module property with the one for moduleResolution, however, it works if we keep the commonjs setting.
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend to keep using commonjs

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I was confused, the value for moduleResolution must match the one for module. it does not work with commonjs, but NodeNext supports both CommonJS and ECMAScript modules (documentation).

"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": "^4.9.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": "^4.9.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
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
Loading