Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
sw-joelmut committed Dec 10, 2024
1 parent c92f998 commit 9992495
Show file tree
Hide file tree
Showing 42 changed files with 20,312 additions and 90 deletions.
2 changes: 1 addition & 1 deletion .depcheckrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ignores: ["filenamify", "mocha", "rimraf", "sinon", "uuid"]
ignores: ["filenamify", "mocha", "rimraf", "sinon", "uuid", "@microsoft/recognizers-text*"]
ignorePatterns: [".eslintrc.json", "lib"]
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -315,4 +315,4 @@ coverage

# typescript assets
*.tsbuildinfo
*.js.map
*.js.map
3 changes: 2 additions & 1 deletion libraries/botbuilder-dialogs-adaptive-testing/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
/**/.vscode
/**/lib/*
coverage
.nyc_output
.nyc_output
**/vendors/**
5 changes: 4 additions & 1 deletion libraries/botbuilder-dialogs-adaptive-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@
"zod": "^3.23.8"
},
"devDependencies": {
"botbuilder": "4.1.6",
"botbuilder": "4.1.6"
},
"localDependencies": {
"__location": "vendors",
"@microsoft/recognizers-text-suite": "1.1.4"
},
"author": "Microsoft",
Expand Down
3 changes: 2 additions & 1 deletion libraries/botbuilder-dialogs-adaptive/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
coverage
.nyc_output
tests/choiceSet.test.js
tests/expressionProperty.test.js
tests/expressionProperty.test.js
**/vendors/**
23 changes: 11 additions & 12 deletions libraries/botbuilder-dialogs-adaptive/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@
}
},
"dependencies": {
"@microsoft/recognizers-text": "~1.1.4",
"@microsoft/recognizers-text-choice": "~1.1.4",
"@microsoft/recognizers-text-date-time": "~1.1.4",
"@microsoft/recognizers-text-number": "~1.3.1",
"@microsoft/recognizers-text-number-with-unit": "~1.1.4",
"@microsoft/recognizers-text-sequence": "~1.1.4",
"@microsoft/recognizers-text-suite": "1.1.4",
"adaptive-expressions": "4.1.6",
"botbuilder": "4.1.6",
"botbuilder-core": "4.1.6",
Expand All @@ -50,6 +43,16 @@
"devDependencies": {
"@types/node-fetch": "^2.6.11"
},
"localDependencies": {
"__location": "vendors",
"@microsoft/recognizers-text": "~1.1.4",
"@microsoft/recognizers-text-choice": "~1.1.4",
"@microsoft/recognizers-text-date-time": "~1.1.4",
"@microsoft/recognizers-text-number": "~1.3.1",
"@microsoft/recognizers-text-number-with-unit": "~1.1.4",
"@microsoft/recognizers-text-sequence": "~1.1.4",
"@microsoft/recognizers-text-suite": "1.1.4"
},
"scripts": {
"build": "npm-run-all build:src build:tests",
"build-docs": "typedoc --theme markdown --entryPoint botbuilder-dialogs-adaptive --excludePrivate --includeDeclarations --ignoreCompilerErrors --module amd --out ..\\..\\doc\\botbuilder-dialogs .\\lib\\index.d.ts --hideGenerator --name \"Bot Builder SDK - Dialogs\" --readme none",
Expand All @@ -60,11 +63,7 @@
"lint": "eslint .",
"postbuild": "downlevel-dts lib _ts3.4/lib --checksum",
"test": "yarn build && nyc mocha tests/",
"test:compat": "api-extractor run --verbose",
"postinstall": "npm run text-suite && npm run date-time && npm run number-with-unit",
"text-suite": "npx rimraf ../@microsoft/recognizers-text-suite/node_modules/@microsoft/recognizers-text-number",
"date-time": "npx rimraf ../@microsoft/recognizers-text-date-time/node_modules/@microsoft/recognizers-text-number",
"number-with-unit": "npx rimraf ../@microsoft/recognizers-text-number-with-unit/node_modules/@microsoft/recognizers-text-number"
"test:compat": "api-extractor run --verbose"
},
"files": [
"_ts3.4",
Expand Down
23 changes: 11 additions & 12 deletions libraries/botbuilder-dialogs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,10 @@
}
},
"dependencies": {
"@microsoft/recognizers-text-choice": "1.1.4",
"@microsoft/recognizers-text-date-time": "1.1.4",
"@microsoft/recognizers-text-number": "1.3.1",
"@microsoft/recognizers-text-suite": "1.1.4",
"botbuilder-core": "4.1.6",
"botbuilder-dialogs-adaptive-runtime-core": "4.1.6",
"botframework-connector": "4.1.6",
"eslint-plugin-only-warn": "^1.1.0",
"eslint-plugin-only-warn": "^1.1.0",
"globalize": "^1.7.0",
"lodash": "^4.17.21",
"uuid": "^10.0.0",
Expand All @@ -44,26 +40,29 @@
"@types/globalize": "^1.5.5",
"line-reader": "^0.4.0"
},
"localDependencies": {
"__location": "vendors",
"@microsoft/recognizers-text-choice": "",
"@microsoft/recognizers-text-date-time": "",
"@microsoft/recognizers-text-number": "",
"@microsoft/recognizers-text-suite": ""
},
"scripts": {
"build": "tsc -b",
"build-docs": "typedoc --theme markdown --entryPoint botbuilder-dialogs --excludePrivate --includeDeclarations --ignoreCompilerErrors --module amd --out ..\\..\\doc\\botbuilder-dialogs .\\lib\\index.d.ts --hideGenerator --name \"Bot Builder SDK - Dialogs\" --readme none",
"build:rollup": "yarn clean && yarn build && api-extractor run --verbose --local",
"clean": "rimraf _ts3.4 lib tsconfig.tsbuildinfo",
"depcheck": "depcheck --config ../../.depcheckrc",
"lint": "eslint .",
"postbuild": "downlevel-dts lib _ts3.4/lib --checksum",
"postbuild": "downlevel-dts lib _ts3.4/lib --checksum && yarn workspace botbuilder-vendors build",
"test": "npm-run-all build test:mocha",
"test:mocha": "nyc mocha --recursive --require source-map-support/register tests",
"test:compat": "api-extractor run --verbose",
"postinstall": "npm run text-suite && npm run date-time && npm run number-with-unit",
"text-suite": "npx rimraf ../@microsoft/recognizers-text-suite/node_modules/@microsoft/recognizers-text-number",
"date-time": "npx rimraf ../@microsoft/recognizers-text-date-time/node_modules/@microsoft/recognizers-text-number",
"number-with-unit": "npx rimraf ../@microsoft/recognizers-text-number-with-unit/node_modules/@microsoft/recognizers-text-number"
"test:compat": "api-extractor run --verbose"
},
"files": [
"_ts3.4",
"lib",
"src",
"vendor"
"vendors"
]
}
2 changes: 1 addition & 1 deletion libraries/botbuilder-dialogs/scripts/gen-cldr-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const tempDirectoryName = '.temp-gen-cldr-data';
const tempProjectName = 'temp';
const tempDirectory = path.join(os.tmpdir(), tempDirectoryName, tempProjectName);
const cldrDataDirectory = path.join(tempDirectory, './node_modules/cldr-data');
const vendorDirectory = path.join(__dirname, '../vendor/cldr-data');
const vendorDirectory = path.join(__dirname, '../vendors/cldr-data');
const cldrDataPackageName = 'cldr-data';
const cldrDataPackageVersion = '35.1.0';

Expand Down
20 changes: 10 additions & 10 deletions libraries/botbuilder-dialogs/src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
*/

/* eslint-disable @typescript-eslint/no-var-requires */
const Chinese = require('../vendor/cldr-data/main/zh/numbers.json');
const English = require('../vendor/cldr-data/main/en/numbers.json');
const French = require('../vendor/cldr-data/main/fr/numbers.json');
const German = require('../vendor/cldr-data/main/de/numbers.json');
const Dutch = require('../vendor/cldr-data/main/nl/numbers.json');
const Japanese = require('../vendor/cldr-data/main/ja/numbers.json');
const LikelySubtags = require('../vendor/cldr-data/supplemental/likelySubtags.json');
const NumberingSystem = require('../vendor/cldr-data/supplemental/numberingSystems.json');
const Portuguese = require('../vendor/cldr-data/main/pt/numbers.json');
const Spanish = require('../vendor/cldr-data/main/es/numbers.json');
const Chinese = require('../vendors/cldr-data/main/zh/numbers.json');
const English = require('../vendors/cldr-data/main/en/numbers.json');
const French = require('../vendors/cldr-data/main/fr/numbers.json');
const German = require('../vendors/cldr-data/main/de/numbers.json');
const Dutch = require('../vendors/cldr-data/main/nl/numbers.json');
const Japanese = require('../vendors/cldr-data/main/ja/numbers.json');
const LikelySubtags = require('../vendors/cldr-data/supplemental/likelySubtags.json');
const NumberingSystem = require('../vendors/cldr-data/supplemental/numberingSystems.json');
const Portuguese = require('../vendors/cldr-data/main/pt/numbers.json');
const Spanish = require('../vendors/cldr-data/main/es/numbers.json');

export { Chinese, English, French, German, Dutch, Japanese, LikelySubtags, NumberingSystem, Portuguese, Spanish };
2 changes: 2 additions & 0 deletions libraries/botbuilder-repo-utils/src/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
export interface Package {
name: string;
version: string;
main: string;

preview?: boolean;
private?: boolean;
Expand All @@ -16,6 +17,7 @@ export interface Package {
dependencies?: Record<string, string>;
devDependencies?: Record<string, string>;
peerDependencies?: Record<string, string>;
localDependencies?: Record<string, string>;

scripts?: Record<string, string>;
}
99 changes: 51 additions & 48 deletions libraries/botbuilder-repo-utils/src/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface Filters {
noPrivate: boolean;
script: string;
path: string[];
hasLocalDependencies: boolean;
}

/**
Expand All @@ -38,7 +39,7 @@ export interface Filters {
export async function collectWorkspacePackages(
repoRoot: string,
workspaces: string[] = [],
filters: Partial<Filters> = {}
filters: Partial<Filters> = {},
): Promise<Array<Workspace>> {
// Note: posix is required, this emits absolute paths that are platform specific
const paths = await glob(
Expand All @@ -48,54 +49,56 @@ export async function collectWorkspacePackages(
);

const maybeWorkspaces = await Promise.all(
paths.map(
async (absPath): Promise<Workspace | undefined> => {
let relPath = absPath.replace(repoRoot, '');
if (relPath[0] === path.sep) {
relPath = relPath.slice(1);
}

// Strip `package.json` filename for path filters
const relWorkspacePath = path.dirname(relPath);

if (filters.path?.length && !filters.path.some((path) => minimatch(relWorkspacePath, path))) {
return;
}

if (
filters.ignorePath?.length &&
filters.ignorePath.some((ignorePath) => minimatch(relWorkspacePath, ignorePath))
) {
return;
}

const pkg = await readJsonFile<Package>(absPath);
if (!pkg) {
return undefined;
}

if (filters.noPrivate && pkg.private) {
return;
}

if (filters.script && !(pkg.scripts ?? {})[filters.script]) {
return;
}

if (filters.name?.length && !filters.name.some((name) => minimatch(pkg.name, name))) {
return;
}

if (
filters.ignoreName?.length &&
filters.ignoreName.some((ignoreName) => minimatch(pkg.name, ignoreName))
) {
return;
}

return { absPath, pkg, relPath };
paths.map(async (absPath): Promise<Workspace | undefined> => {
let relPath = absPath.replace(repoRoot, '');
if (relPath[0] === path.sep) {
relPath = relPath.slice(1);
}
)

// Strip `package.json` filename for path filters
const relWorkspacePath = path.dirname(relPath);

if (filters.path?.length && !filters.path.some((path) => minimatch(relWorkspacePath, path))) {
return;
}

if (
filters.ignorePath?.length &&
filters.ignorePath.some((ignorePath) => minimatch(relWorkspacePath, ignorePath))
) {
return;
}

const pkg = await readJsonFile<Package>(absPath);
if (!pkg) {
return undefined;
}

if (filters.noPrivate && pkg.private) {
return;
}

if (filters.script && !(pkg.scripts ?? {})[filters.script]) {
return;
}

if (filters.name?.length && !filters.name.some((name) => minimatch(pkg.name, name))) {
return;
}

if (
filters.ignoreName?.length &&
filters.ignoreName.some((ignoreName) => minimatch(pkg.name, ignoreName))
) {
return;
}

if (filters.hasLocalDependencies && Object.keys(pkg.localDependencies ?? {}).length === 0) {
return;
}

return { absPath, pkg, relPath };
}),
);

return compact(maybeWorkspaces);
Expand Down
33 changes: 33 additions & 0 deletions libraries/botbuilder-repo-utils/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { defineConfig } from "tsup";
import { resolve } from "path";
import { readFileSync } from "fs";

const dir = "recognizers/recognizers-text-suite";

const packageJson = JSON.parse(
readFileSync(
resolve(process.cwd(), dir, "package.json"),
"utf-8"
)
);
const external = Object.keys(packageJson.dependencies || {});

export default defineConfig({
platform: "node",
bundle: true,
outDir: `vendor/${dir}`,
format: ["cjs"],
target: "es6",
treeshake: true,
entry: [`${dir}/src/recognizers-text*.ts`],
splitting: false,
sourcemap: false,
clean: true,
// dts: true,
external: [...external, "xregexp"],

esbuildOptions(options) {

console.log(options);
}
});
21 changes: 21 additions & 0 deletions libraries/botbuilder-vendors/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Microsoft Corporation. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
27 changes: 27 additions & 0 deletions libraries/botbuilder-vendors/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "botbuilder-vendors",
"private": true,
"version": "1.0.0",
"license": "MIT",
"bugs": {
"url": "https://github.com/Microsoft/botbuilder-js/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/botbuilder-js.git"
},
"scripts": {
"install": "ts-node src/index.ts install",
"build": "ts-node src/index.ts build"
},
"dependencies": {
"fast-glob": "^3.3.2",
"minimist": "^1.2.6",
"botbuilder-repo-utils": "1.0.0"
},
"devDependencies": {
"@types/minimist": "^1.2.5",
"ts-node": "^10.9.2",
"typescript": "~4.7"
}
}
Loading

0 comments on commit 9992495

Please sign in to comment.