Skip to content

Commit aed3c8d

Browse files
gkatsevcjpillsbury
andauthored
chore: copy custom-types into dist during types build (muxinc#600)
Co-authored-by: Christian Pillsbury <[email protected]>
1 parent 40c8e3e commit aed3c8d

Some content is hidden

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

53 files changed

+222
-189
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,7 @@ dist
127127
**/*/iife.json
128128
**/*/module.json
129129

130+
# ignore polyfills copy
131+
packages/*/src/polyfills
132+
130133
.turbo

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"lint": "turbo run lint --filter '!./examples/*'",
3131
"test": "turbo run test --filter '!./examples/*'",
3232
"dev": "turbo run dev --filter '!./examples/*'",
33+
"copypolyfills": "turbo run copypolyfills --filter '!./examples/*'",
3334
"build:packages": "turbo run build --filter '!./examples/*'",
3435
"build": "turbo run build",
3536
"i18n": "turbo run i18n",

packages/mux-audio-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"dev": "npm-run-all --parallel dev:types dev:cjs dev:esm",
3434
"build:cjs": "esbuild src/index.tsx --target=es2019 --bundle --sourcemap --metafile=./dist/cjs.json --format=cjs --outdir=dist --out-extension:.js=.cjs.js --external:react --external:prop-types --external:@mux/* --define:PLAYER_VERSION=\"'$npm_package_version'\"",
3535
"build:esm": "esbuild src/index.tsx --target=es2019 --bundle --sourcemap --metafile=./dist/esm.json --format=esm --outdir=dist --out-extension:.js=.mjs --external:react --external:prop-types --external:@mux/* --define:PLAYER_VERSION=\"'$npm_package_version'\"",
36-
"build:types": "tsc --declaration --emitDeclarationOnly --outDir './dist/types'",
36+
"build:types": "tsc",
3737
"postbuild:types": "downlevel-dts ./dist/types ./dist/types-ts3.4",
3838
"build": "npm-run-all --parallel 'build:cjs --minify' 'build:esm --minify'",
3939
"create-release-notes": "create-release-notes ./CHANGELOG.md",

packages/mux-audio-react/tsconfig.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
"compilerOptions": {
33
"preserveWatchOutput": true,
44
"rootDir": "src",
5-
"outDir": "dist",
5+
"outDir": "./dist/types",
6+
"declaration": true,
7+
"emitDeclarationOnly": true,
68
"incremental": true,
79
"target": "ES2019",
810
"module": "es6",
911
"jsx": "react",
10-
"declaration": true,
1112
"sourceMap": true,
1213
"composite": true,
1314
"strict": true,
@@ -17,7 +18,7 @@
1718
"esModuleInterop": true,
1819
"skipLibCheck": false,
1920
"forceConsistentCasingInFileNames": true,
20-
"typeRoots": ["node_modules/@types", "../../types"]
21+
"typeRoots": ["node_modules/@types"]
2122
},
22-
"include": ["src/**/*", "../../types"]
23+
"include": ["src/**/*"]
2324
}

packages/mux-audio/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"author": "Mux, Inc.",
2929
"license": "MIT",
3030
"scripts": {
31-
"clean": "shx rm -rf dist/",
31+
"clean": "shx rm -rf dist/ && shx rm -rf src/polyfills",
3232
"lint": "eslint src/ --ext .js,.jsx,.ts,.tsx",
3333
"test": "web-test-runner **/*test.js --port 8003 --coverage --config test/web-test-runner.config.mjs --root-dir ../..",
3434
"posttest": "replace 'SF:src/' 'SF:packages/mux-audio/src/' coverage/lcov.info --silent",
@@ -42,7 +42,8 @@
4242
"build:esm-module": "esbuild src/index.ts --target=es2019 --bundle --sourcemap --metafile=./dist/module.json --format=esm --outfile=./dist/mux-audio.mjs --define:PLAYER_VERSION=\"'$npm_package_version'\"",
4343
"build:cjs": "esbuild src/index.ts --target=es2019 --bundle --sourcemap --metafile=./dist/cjs.json --format=cjs --outdir=dist --out-extension:.js=.cjs.js --external:@mux/* --define:PLAYER_VERSION=\"'$npm_package_version'\"",
4444
"build:iife": "esbuild src/index.ts --target=es2019 --bundle --sourcemap --metafile=./dist/iife.json --format=iife --outfile=./dist/mux-audio.js --define:PLAYER_VERSION=\"'$npm_package_version'\"",
45-
"build:types": "tsc --declaration --emitDeclarationOnly --outDir './dist/types'",
45+
"copypolyfills": "shx mkdir -p src/polyfills && shx cp ../../shared/polyfills/index.ts ./src/polyfills/index.ts",
46+
"build:types": "tsc",
4647
"postbuild:types": "shx cp -r \"src/**/*.d.ts\" dist/types && downlevel-dts ./dist/types ./dist/types-ts3.4",
4748
"build": "npm-run-all --parallel 'build:esm --minify' 'build:iife --minify' 'build:cjs --minify' 'build:esm-module --minify'",
4849
"create-release-notes": "create-release-notes ./CHANGELOG.md",
@@ -64,7 +65,6 @@
6465
"eslint": "^8.24.0",
6566
"npm-run-all": "^4.1.5",
6667
"replace": "^1.2.1",
67-
"shared-polyfills": "0.1.0",
6868
"shx": "^0.3.4",
6969
"typescript": "^4.9.4"
7070
}

packages/mux-audio/src/CustomAudioElement.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { globalThis, document } from 'shared-polyfills';
1+
import { globalThis, document } from './polyfills';
22
/**
33
* Custom Audio Element
44
* The goal is to create an element that works just like the audio element

packages/mux-audio/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { globalThis } from 'shared-polyfills';
1+
import { globalThis } from './polyfills';
22
import {
33
initialize,
44
teardown,

packages/mux-audio/test/player.test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ describe('<mux-audio>', () => {
2222

2323
it('dispatches events properly', async function () {
2424
const player = await fixture(`<mux-audio
25-
playback-id="vDpm5ygrRJgfIEPNIc02IJR4Trf3z00AiP"
2625
muted
2726
></mux-audio>`);
2827

@@ -35,6 +34,9 @@ describe('<mux-audio>', () => {
3534
});
3635
});
3736

37+
player.playbackId = 'vDpm5ygrRJgfIEPNIc02IJR4Trf3z00AiP';
38+
await aTimeout(100);
39+
3840
player.volume = 0.5;
3941

4042
// Seems only <audio> is throwing in my tests:
@@ -52,7 +54,6 @@ describe('<mux-audio>', () => {
5254
await aTimeout(100);
5355

5456
assert.deepInclude(eventMap, {
55-
emptied: true,
5657
loadstart: true,
5758
volumechange: true,
5859
});

packages/mux-audio/tsconfig.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
"compilerOptions": {
33
"preserveWatchOutput": true,
44
"rootDir": "src",
5-
"outDir": "dist",
5+
"outDir": "./dist/types",
6+
"declaration": true,
7+
"emitDeclarationOnly": true,
68
"incremental": true,
79
"target": "ES2019",
810
"module": "es6",
9-
"declaration": true,
11+
"jsx": "react",
1012
"sourceMap": true,
1113
"composite": true,
1214
"strict": true,
@@ -16,7 +18,7 @@
1618
"esModuleInterop": true,
1719
"skipLibCheck": false,
1820
"forceConsistentCasingInFileNames": true,
19-
"typeRoots": ["node_modules/@types", "../../types"]
21+
"typeRoots": ["node_modules/@types"]
2022
},
21-
"include": ["src/**/*", "../../types"]
23+
"include": ["src/**/*"]
2224
}

packages/mux-elements-codemod/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"dev:types": "yarn build:types -w --preserveWatchOutput",
1919
"dev": "npm-run-all --parallel dev:types dev:esm",
2020
"build:esm": "esbuild src/index.ts --target=es2019 --format=esm --outdir=dist --out-extension:.js=.mjs",
21-
"build:types": "tsc --declaration --emitDeclarationOnly --outDir './dist/types'",
21+
"build:types": "tsc",
2222
"build": "npm-run-all --parallel build:esm",
2323
"create-release-notes": "create-release-notes ./CHANGELOG.md",
2424
"publish-release": "../../scripts/publish.sh"

0 commit comments

Comments
 (0)