Skip to content

Commit f194550

Browse files
committed
chore: migrate directlinespeech to tsup
1 parent dfb2e72 commit f194550

File tree

6 files changed

+212
-711
lines changed

6 files changed

+212
-711
lines changed

package-lock.json

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

packages/directlinespeech/package.json

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"description": "Direct Line Speech SDK",
55
"files": [
66
"./dist/**/*",
7-
"./lib/**/*",
8-
"./src/**/*"
7+
"./src/**/*",
8+
"./*.js"
99
],
10-
"main": "./lib/index.js",
10+
"main": "./dist/botframework-directlinespeech-sdk.js",
1111
"exports": {
1212
".": {
1313
"import": {
@@ -21,12 +21,8 @@
2121
}
2222
},
2323
"scripts": {
24-
"build": "npm run build:tsup && npm run build:babel && npm run build:webpack",
25-
"build:babel": "cross-env build_tool=babel module_format=commonjs babel src --ignore **/*.spec.js,**/*.test.js,__tests__/**/*.js --out-dir lib --verbose",
24+
"build": "npm run build:tsup",
2625
"build:tsup": "tsup --config ./tsup.config.ts",
27-
"build:webpack": "npm run build:webpack:development && npm run build:webpack:production",
28-
"build:webpack:development": "cross-env node_env=development webpack-cli",
29-
"build:webpack:production": "cross-env node_env=production webpack-cli",
3026
"bump": "npm run bump:prod && npm run bump:dev && (npm audit fix || exit 0)",
3127
"bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localDependencies // {} | keys) as $L | (.devDependencies // {}) | to_entries | map(select(.key as $K | $L | contains([$K]) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
3228
"bump:prod": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localDependencies // {} | keys) as $L | (.dependencies // {}) | to_entries | map(select(.key as $K | $L | contains([$K]) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install --save-exact $PACKAGES_TO_BUMP || true",
@@ -37,10 +33,8 @@
3733
"prettier": "prettier --check src/**/*.{js,ts}",
3834
"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",
3935
"start": "concurrently --kill-others --prefix-colors \"auto\" \"npm:start:*\"",
40-
"start:babel": "npm run build:babel -- --skip-initial-build --watch",
4136
"start:serve": "serve",
4237
"start:tsup": "npm run build:tsup -- --watch",
43-
"start:webpack": "npm run build:webpack:development -- --watch",
4438
"test": "jest --watch"
4539
},
4640
"author": "Microsoft Corporation",
@@ -104,15 +98,10 @@
10498
"prettier": "^3.5.1",
10599
"serve": "^14.2.4",
106100
"simple-update-in": "^2.2.0",
107-
"source-map-loader": "^5.0.0",
108-
"webpack": "^5.98.0",
109-
"webpack-cli": "^6.0.1",
110-
"webpack-stats-plugin": "^1.1.3"
101+
"source-map-loader": "^5.0.0"
111102
},
112103
"dependencies": {
113-
"@babel/runtime": "7.19.0",
114104
"abort-controller": "3.0.0",
115-
"abort-controller-es5": "2.0.1",
116105
"base64-arraybuffer": "1.0.2",
117106
"core-js": "3.40.0",
118107
"core-js-pure": "3.40.0",

packages/directlinespeech/src/createWebSpeechPonyfillFactory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint class-methods-use-this: ["error", { "exceptMethods": ["cancel", "getVoices", "speak"] }] */
22

3-
import { AbortController } from 'abort-controller-es5';
3+
import { AbortController } from 'abort-controller';
44
import { createSpeechRecognitionPonyfillFromRecognizer } from 'web-speech-cognitive-services';
55

66
import createTaskQueue from './createTaskQueue';

packages/directlinespeech/src/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,11 @@ if (typeof HTMLDocument !== 'undefined' && typeof document !== 'undefined' && do
2727

2828
document.head.appendChild(packageMeta);
2929
}
30+
31+
if (moduleFormat === 'global') {
32+
window.DirectLineSpeech = Object.freeze({
33+
...window.DirectLineSpeech,
34+
buildInfo,
35+
createAdapters
36+
});
37+
}

packages/directlinespeech/tsup.config.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,24 @@ export default defineConfig([
4040
...config,
4141
format: 'cjs',
4242
target: [...config.target, 'es2019']
43+
},
44+
{
45+
...config,
46+
dts: false,
47+
entry: {
48+
[process.env.NODE_ENV === 'production' ? 'directlinespeech.production.min' : 'directlinespeech.development']:
49+
'./src/index.js'
50+
},
51+
env: {
52+
...config.env,
53+
module_format: 'global'
54+
},
55+
esbuildPlugins: [],
56+
format: 'iife',
57+
outExtension() {
58+
return { js: '.js' };
59+
},
60+
platform: 'browser',
61+
target: [...config.target, 'es2019']
4362
}
4463
]);

packages/directlinespeech/webpack.config.js

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)