Skip to content

Commit 8d31e53

Browse files
committed
Centralize build info
1 parent c87202f commit 8d31e53

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+443
-256
lines changed

lint-staged.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,26 @@ module.exports = {
1212
'**/*.md': prettierMarkdown,
1313
'packages/**/*.css': ['npm run precommit:biome'],
1414
'packages/api/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:api'],
15+
'packages/api-middleware/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:api-middleware'],
16+
'packages/base/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:base'],
1517
'packages/bundle/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:bundle'],
1618
'packages/component/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:component'],
1719
'packages/core/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:core'],
20+
'packages/debug-theme/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:debug-theme'],
1821
'packages/directlinespeech/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:directlinespeech'],
22+
'packages/fluent-theme/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:fluent-theme'],
1923
'packages/isomorphic-react/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:isomorphic-react'],
2024
'packages/isomorphic-react-dom/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:isomorphic-react-dom'],
25+
'packages/react-hooks/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:react-hooks'],
26+
'packages/react-valibot/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:react-valibot'],
27+
'packages/redux-store/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:redux-store'],
28+
'packages/styles/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:styles'],
2129
'packages/support/cldr-data/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:support-cldr-data'],
2230
'packages/support/cldr-data-downloader/src/**/*.{mjs,js,ts,tsx}': [
2331
'npm run precommit:eslint:support-cldr-data-downloader'
2432
],
2533
'packages/test/harness/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:test-harness'],
2634
'packages/test/page-object/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:test-page-object'],
35+
'packages/test/web-server/src/**/*.{mjs,js,ts,tsx}': ['npm run precommit:eslint:test-web-server'],
2736
'packages/*/src/**/*.{ts,tsx}': [() => 'npm run precommit:typecheck']
2837
};

package-lock.json

Lines changed: 15 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"precommit": "npm run precommit --if-present --workspaces",
6060
"precommit:biome": "npm run biome -- --no-errors-on-unmatched",
6161
"precommit:eslint:api": "cd packages && cd api && npm run precommit:eslint",
62+
"precommit:eslint:api-middleware": "cd packages && cd api-middleware && npm run precommit:eslint",
6263
"precommit:eslint:base": "cd packages && cd base && npm run precommit:eslint",
6364
"precommit:eslint:bundle": "cd packages && cd bundle && npm run precommit:eslint",
6465
"precommit:eslint:component": "cd packages && cd component && npm run precommit:eslint",
@@ -79,6 +80,8 @@
7980
"precommit:eslint:web-server": "cd packages && cd test && cd web-server && npm run precommit:eslint",
8081
"precommit:typecheck": "concurrently \"npm:precommit:typecheck:*\"",
8182
"precommit:typecheck:api": "cd packages && cd api && npm run precommit:typecheck",
83+
"precommit:typecheck:api-middleware": "cd packages && cd api-middleware && npm run precommit:typecheck",
84+
"precommit:typecheck:base": "cd packages && cd base && npm run precommit:typecheck",
8285
"precommit:typecheck:bundle": "cd packages && cd bundle && npm run precommit:typecheck",
8386
"precommit:typecheck:component": "cd packages && cd component && npm run precommit:typecheck",
8487
"precommit:typecheck:core": "cd packages && cd core && npm run precommit:typecheck",
@@ -87,10 +90,12 @@
8790
"precommit:typecheck:react-hooks": "cd packages && cd react-hooks && npm run precommit:typecheck",
8891
"precommit:typecheck:react-valibot": "cd packages && cd react-valibot && npm run precommit:typecheck",
8992
"precommit:typecheck:redux-store": "cd packages && cd redux-store && npm run precommit:typecheck",
93+
"precommit:typecheck:styles": "cd packages && cd styles && npm run precommit:typecheck",
9094
"prepare": "husky",
9195
"start": "cross-env NODE_OPTIONS=--no-deprecation concurrently --kill-others --prefix-colors \"auto\" \"npm:start:*\"",
9296
"start:api": "cd packages && cd api && npm start",
9397
"start:api-middleware": "cd packages && cd api-middleware && npm start",
98+
"start:base": "cd packages && cd base && npm start",
9499
"start:bundle": "cd packages && cd bundle && npm start",
95100
"start:component": "cd packages && cd component && npm start",
96101
"start:core": "cd packages && cd core && npm start",

packages/api-middleware/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/*.tgz
22
/dist/
3-
/lib/
3+
/dist.tmp/
44
/node_modules/
5+
/tsup.config.bundled_*.mjs

packages/api-middleware/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"precommit:eslint": "../../node_modules/.bin/eslint --report-unused-disable-directives --max-warnings 0",
7373
"precommit:typecheck": "tsc --project ./src --emitDeclarationOnly false --esModuleInterop true --noEmit --pretty false",
7474
"preversion": "cat package.json | jq '(.localDependencies // {} | to_entries | map([if .value == \"production\" then \"dependencies\" else \"devDependencies\" end, .key])) as $P | delpaths($P)' > package-temp.json && mv package-temp.json package.json",
75-
"start": "npm run build -- --onSuccess=\"touch ../api/src/index.ts\" --watch"
75+
"start": "npm run build -- --watch"
7676
},
7777
"devDependencies": {
7878
"@jridgewell/sourcemap-codec": "^1.5.0",

packages/api-middleware/tsup.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import { defineConfig } from 'tsup';
22
import baseConfig from '../../tsup.base.config';
33

4+
// TODO: [P1] Compute this automatically.
5+
const DEPENDENT_PATHS = ['api'];
6+
47
const config: typeof baseConfig = {
58
...baseConfig,
69
entry: {
710
'botframework-webchat-api-middleware': './src/index.ts',
811
'botframework-webchat-api-middleware.internal': './src/internal.ts',
912
'botframework-webchat-api-middleware.legacy': './src/legacy.ts'
10-
}
13+
},
14+
onSuccess: `${baseConfig.onSuccess} && touch ${DEPENDENT_PATHS.map(path => `../${path}/src/index.ts`).join(' ')}`
1115
};
1216

1317
export default defineConfig([

packages/api/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
/*.tgz
22
/dist/
3+
/dist.tmp/
34
/node_modules/
5+
/tsup.config.bundled_*.mjs
6+
47
/src/external/

packages/api/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,11 @@
7777
"precommit:eslint": "../../node_modules/.bin/eslint --report-unused-disable-directives --max-warnings 0",
7878
"precommit:typecheck": "tsc --project ./src --emitDeclarationOnly false --esModuleInterop true --noEmit --pretty false",
7979
"preversion": "cat package.json | jq '(.localDependencies // {} | to_entries | map([if .value == \"production\" then \"dependencies\" else \"devDependencies\" end, .key])) as $P | delpaths($P)' > package-temp.json && mv package-temp.json package.json",
80-
"start": "npm run build:tsup -- --onSuccess=\"touch ../component/src/index.ts\" --watch"
80+
"start": "npm run build:tsup -- --watch"
8181
},
8282
"localDependencies": {
8383
"@msinternal/botframework-webchat-api-middleware": "development",
84+
"@msinternal/botframework-webchat-base": "development",
8485
"@msinternal/botframework-webchat-cldr-data": "development",
8586
"@msinternal/botframework-webchat-react-hooks": "development",
8687
"@msinternal/botframework-webchat-react-valibot": "development",
@@ -108,6 +109,7 @@
108109
"@babel/preset-react": "^7.27.1",
109110
"@babel/preset-typescript": "^7.27.1",
110111
"@msinternal/botframework-webchat-api-middleware": "^0.0.0-0",
112+
"@msinternal/botframework-webchat-base": "^0.0.0-0",
111113
"@msinternal/botframework-webchat-cldr-data": "36.0.0-0",
112114
"@msinternal/botframework-webchat-react-hooks": "^0.0.0-0",
113115
"@msinternal/botframework-webchat-react-valibot": "^0.0.0-0",

packages/api/src/buildInfo.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { createBuildInfo } from '@msinternal/botframework-webchat-base/utils';
2+
3+
const buildInfo = createBuildInfo('botframework-webchat:api');
4+
5+
buildInfo.set('buildTool', WEB_CHAT_BUILD_INFO_BUILD_TOOL);
6+
buildInfo.set('moduleFormat', WEB_CHAT_BUILD_INFO_MODULE_FORMAT);
7+
buildInfo.set('version', WEB_CHAT_BUILD_INFO_VERSION);
8+
9+
export default buildInfo;

packages/api/src/env.d.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
declare global {
2-
const process: {
3-
env?: {
4-
build_tool?: string | undefined;
5-
module_format?: string | undefined;
6-
npm_package_version?: string | undefined;
7-
};
8-
};
2+
const WEB_CHAT_BUILD_INFO_BUILD_TOOL: string | undefined;
3+
const WEB_CHAT_BUILD_INFO_MODULE_FORMAT: string | undefined;
4+
const WEB_CHAT_BUILD_INFO_VERSION: string | undefined;
95
}
106

117
export {};

0 commit comments

Comments
 (0)