From b3f8c7f4ed808b8a35fda23cc73d699df7a752af Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Fri, 5 Apr 2024 14:25:48 +0200 Subject: [PATCH 01/15] Update package lock --- package-lock.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index e181a6c4..78ed3370 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,7 +41,7 @@ }, "cmcd": { "name": "@theoplayer/cmcd-connector-web", - "version": "1.0.0", + "version": "1.0.1", "license": "MIT", "peerDependencies": { "theoplayer": "^5.0.0 || ^6.0.0 || ^7.0.0" @@ -49,13 +49,13 @@ }, "conviva": { "name": "@theoplayer/conviva-connector-web", - "version": "2.0.1", + "version": "2.0.2", "license": "MIT", "dependencies": { "@convivainc/conviva-js-coresdk": "^4.7.4" }, "peerDependencies": { - "@theoplayer/yospace-connector-web": "^2.1.0", + "@theoplayer/yospace-connector-web": "^2.1.1", "theoplayer": "^5.0.0 || ^6.0.0 || ^7.0.0" }, "peerDependenciesMeta": { @@ -8647,7 +8647,7 @@ }, "yospace": { "name": "@theoplayer/yospace-connector-web", - "version": "2.1.0", + "version": "2.1.1", "license": "MIT", "peerDependencies": { "theoplayer": "^5.0.0 || ^6.0.0 || ^7.0.0" From 73700d5b642bd9e49df99bbd1ae5912d1f8de70f Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Fri, 5 Apr 2024 14:26:09 +0200 Subject: [PATCH 02/15] Set up TypeDoc --- .gitignore | 3 ++ .prettierignore | 5 ++- cmcd/typedoc.json | 11 +++++ conviva/typedoc.json | 11 +++++ nielsen/typedoc.json | 11 +++++ package-lock.json | 97 ++++++++++++++++++++++++++++++++++++++++++++ package.json | 6 ++- typedoc.base.json | 21 ++++++++++ typedoc.config.js | 12 ++++++ yospace/typedoc.json | 11 +++++ 10 files changed, 186 insertions(+), 2 deletions(-) create mode 100644 cmcd/typedoc.json create mode 100644 conviva/typedoc.json create mode 100644 nielsen/typedoc.json create mode 100644 typedoc.base.json create mode 100644 typedoc.config.js create mode 100644 yospace/typedoc.json diff --git a/.gitignore b/.gitignore index c28de259..00b4b349 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ node_modules/ # Generated by MacOS .DS_Store + +# TypeDoc +api/ diff --git a/.prettierignore b/.prettierignore index fb190ee6..ac2ee5ae 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,5 @@ */dist/ -*/test/pages/ \ No newline at end of file +*/test/pages/ + +# TypeDoc +api/ diff --git a/cmcd/typedoc.json b/cmcd/typedoc.json new file mode 100644 index 00000000..d02c08a0 --- /dev/null +++ b/cmcd/typedoc.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://typedoc.org/schema.json", + "extends": [ + "../typedoc.base.json" + ], + "entryPoints": [ + "src/index.ts" + ], + "tsconfig": "tsconfig.json", + "name": "CMCD Connector" +} diff --git a/conviva/typedoc.json b/conviva/typedoc.json new file mode 100644 index 00000000..2c607be9 --- /dev/null +++ b/conviva/typedoc.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://typedoc.org/schema.json", + "extends": [ + "../typedoc.base.json" + ], + "entryPoints": [ + "src/index.ts" + ], + "tsconfig": "tsconfig.json", + "name": "Conviva Connector" +} diff --git a/nielsen/typedoc.json b/nielsen/typedoc.json new file mode 100644 index 00000000..d547c0ca --- /dev/null +++ b/nielsen/typedoc.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://typedoc.org/schema.json", + "extends": [ + "../typedoc.base.json" + ], + "entryPoints": [ + "src/index.ts" + ], + "tsconfig": "tsconfig.json", + "name": "Nielsen Connector" +} diff --git a/package-lock.json b/package-lock.json index 78ed3370..fddba4ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,6 +35,9 @@ "ts-jest": "^29.1.2", "ts-node": "^10.9.2", "tslib": "^2.6.2", + "typedoc": "^0.25.12", + "typedoc-plugin-external-resolver": "^1.0.3", + "typedoc-plugin-mdn-links": "^3.1.19", "typescript": "^5.4.3", "typescript-eslint": "^7.5.0" } @@ -2644,6 +2647,12 @@ "node": ">=8" } }, + "node_modules/ansi-sequence-parser": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.1.tgz", + "integrity": "sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==", + "dev": true + }, "node_modules/ansi-styles": { "version": "4.3.0", "dev": true, @@ -5840,6 +5849,12 @@ "node": ">=6" } }, + "node_modules/jsonc-parser": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz", + "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==", + "dev": true + }, "node_modules/jsonfile": { "version": "4.0.0", "dev": true, @@ -5981,6 +5996,12 @@ "yallist": "^3.0.2" } }, + "node_modules/lunr": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", + "dev": true + }, "node_modules/magic-string": { "version": "0.30.7", "dev": true, @@ -6030,6 +6051,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/marked": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "dev": true, + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 12" + } + }, "node_modules/meow": { "version": "6.1.1", "dev": true, @@ -7280,6 +7313,18 @@ "node": ">=8" } }, + "node_modules/shiki": { + "version": "0.14.7", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.7.tgz", + "integrity": "sha512-dNPAPrxSc87ua2sKJ3H5dQ/6ZaY8RNnaAqK+t0eG7p0Soi2ydiqbGOTaZCqaYvA/uZYfS1LJnemt3Q+mSfcPCg==", + "dev": true, + "dependencies": { + "ansi-sequence-parser": "^1.1.0", + "jsonc-parser": "^3.2.0", + "vscode-oniguruma": "^1.7.0", + "vscode-textmate": "^8.0.0" + } + }, "node_modules/side-channel": { "version": "1.0.5", "dev": true, @@ -8112,6 +8157,46 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/typedoc": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.25.12.tgz", + "integrity": "sha512-F+qhkK2VoTweDXd1c42GS/By2DvI2uDF4/EpG424dTexSHdtCH52C6IcAvMA6jR3DzAWZjHpUOW+E02kyPNUNw==", + "dev": true, + "dependencies": { + "lunr": "^2.3.9", + "marked": "^4.3.0", + "minimatch": "^9.0.3", + "shiki": "^0.14.7" + }, + "bin": { + "typedoc": "bin/typedoc" + }, + "engines": { + "node": ">= 16" + }, + "peerDependencies": { + "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x" + } + }, + "node_modules/typedoc-plugin-external-resolver": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typedoc-plugin-external-resolver/-/typedoc-plugin-external-resolver-1.0.3.tgz", + "integrity": "sha512-P73ZjN8fX3xQ2KpggrxhPIBg3ZyljhylHl69+lC0QRnyt4j9ijXFrorKjPPOU0Z63cm0Annd89Aejf4SMNo3kA==", + "dev": true, + "peerDependencies": { + "typedoc": "0.25.x", + "typescript": "4.x || 5.x" + } + }, + "node_modules/typedoc-plugin-mdn-links": { + "version": "3.1.19", + "resolved": "https://registry.npmjs.org/typedoc-plugin-mdn-links/-/typedoc-plugin-mdn-links-3.1.19.tgz", + "integrity": "sha512-v08h/JorBemjl6xQyw+tB1P5BX2OUI9zr9vR5ZTuLsmETUrS3NC2z6ou8Ci0FDjSL0nA1tGsdXhUn42sEgkkUA==", + "dev": true, + "peerDependencies": { + "typedoc": ">= 0.23.14 || 0.24.x || 0.25.x" + } + }, "node_modules/typescript": { "version": "5.4.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.4.tgz", @@ -8447,6 +8532,18 @@ "spdx-expression-parse": "^3.0.0" } }, + "node_modules/vscode-oniguruma": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", + "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", + "dev": true + }, + "node_modules/vscode-textmate": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz", + "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==", + "dev": true + }, "node_modules/walker": { "version": "1.0.8", "dev": true, diff --git a/package.json b/package.json index d550f826..267566d0 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,8 @@ "prettier": "prettier --check \"*/(src|test)/**/*\"", "prettier:fix": "prettier --write \"*/(src|test)/**/*\"", "lint": "eslint \"*/src/**/*.ts\" \"*/test*/**/*.ts\"", - "lint:fix": "npm run lint -- --fix" + "lint:fix": "npm run lint -- --fix", + "docs": "typedoc" }, "devDependencies": { "@changesets/cli": "^2.27.1", @@ -43,6 +44,9 @@ "ts-jest": "^29.1.2", "ts-node": "^10.9.2", "tslib": "^2.6.2", + "typedoc": "^0.25.12", + "typedoc-plugin-external-resolver": "^1.0.3", + "typedoc-plugin-mdn-links": "^3.1.19", "typescript": "^5.4.3", "typescript-eslint": "^7.5.0" } diff --git a/typedoc.base.json b/typedoc.base.json new file mode 100644 index 00000000..692a1e1f --- /dev/null +++ b/typedoc.base.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://typedoc.org/schema.json", + "readme": "none", + "plugin": [ + "typedoc-plugin-external-resolver", + "typedoc-plugin-mdn-links" + ], + "navigationLinks": { + "Docs": "https://www.theoplayer.com/docs/", + "THEOplayer.com": "https://www.theoplayer.com/" + }, + "githubPages": true, + "excludePrivate": true, + "excludeExternals": true, + "externalDocumentation": { + "theoplayer": { + "dtsPath": "~/THEOplayer.d.ts", + "externalBaseURL": "https://www.theoplayer.com/docs/theoplayer/v7/api-reference/web" + } + } +} diff --git a/typedoc.config.js b/typedoc.config.js new file mode 100644 index 00000000..0ab104f4 --- /dev/null +++ b/typedoc.config.js @@ -0,0 +1,12 @@ +const { workspaces } = require('./package.json'); + +/** @type {import('typedoc').TypeDocOptions} */ +module.exports = { + extends: ['./typedoc.base.json'], + name: 'THEOplayer Connectors for Web', + entryPoints: workspaces, + entryPointStrategy: 'packages', + includeVersion: false, + out: 'api', + sitemapBaseUrl: 'https://theoplayer.github.io/web-connectors/api/' +}; diff --git a/yospace/typedoc.json b/yospace/typedoc.json new file mode 100644 index 00000000..cf3ee1fa --- /dev/null +++ b/yospace/typedoc.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://typedoc.org/schema.json", + "extends": [ + "../typedoc.base.json" + ], + "entryPoints": [ + "src/index.ts" + ], + "tsconfig": "tsconfig.json", + "name": "Yospace Connector" +} From 29772be195f38c8bafcc15d49a352d8c1e124377 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Fri, 5 Apr 2024 14:32:38 +0200 Subject: [PATCH 03/15] Fix type --- yospace/src/integration/YospaceConnector.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yospace/src/integration/YospaceConnector.ts b/yospace/src/integration/YospaceConnector.ts index 05bcc70d..3368c66c 100644 --- a/yospace/src/integration/YospaceConnector.ts +++ b/yospace/src/integration/YospaceConnector.ts @@ -3,13 +3,13 @@ import { YospaceManager } from './YospaceManager'; import { SessionProperties } from '../yospace/SessionProperties'; import { AnalyticEventObserver } from '../yospace/AnalyticEventObserver'; import { EventDispatcher, EventListener, StringKeyOf } from '../utils/event/EventDispatcher'; -import { BaseEvent } from '../utils/event/Event'; +import { Event } from '../utils/event/Event'; export interface YospaceEventMap { /** * Fired when a new Yospace session starts. */ - sessionavailable: BaseEvent<'sessionavailable'>; + sessionavailable: Event<'sessionavailable'>; } export class YospaceConnector implements EventDispatcher { From 60688c0b3320b427ea2bd6afac1384d96770568e Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Fri, 5 Apr 2024 14:33:03 +0200 Subject: [PATCH 04/15] Fix missing exports --- cmcd/src/index.ts | 18 +++--------------- yospace/src/index.ts | 6 ++++++ yospace/src/yospace/AdBreak.ts | 2 +- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/cmcd/src/index.ts b/cmcd/src/index.ts index 3faa1eef..47f6c64e 100644 --- a/cmcd/src/index.ts +++ b/cmcd/src/index.ts @@ -1,15 +1,3 @@ -import { CMCDObjectType, CMCDPayload, CMCDReservedKey, CMCDStreamingFormat, CMCDStreamType } from './CMCDPayload'; -import { TransmissionMode } from './Configuration'; -import { CMCDConnector, CMCDPayloadProcessor, createCMCDConnector } from './CMCDConnector'; - -export { - CMCDConnector, - createCMCDConnector, - CMCDPayloadProcessor, - TransmissionMode, - CMCDPayload, - CMCDReservedKey, - CMCDStreamingFormat, - CMCDObjectType, - CMCDStreamType -}; +export { CMCDObjectType, CMCDPayload, CMCDReservedKey, CMCDStreamingFormat, CMCDStreamType } from './CMCDPayload'; +export * from './Configuration'; +export { CMCDConnector, CMCDPayloadProcessor, createCMCDConnector } from './CMCDConnector'; diff --git a/yospace/src/index.ts b/yospace/src/index.ts index 899d3ddd..f6de165a 100644 --- a/yospace/src/index.ts +++ b/yospace/src/index.ts @@ -2,3 +2,9 @@ export * from './integration/YospaceConnector'; export { AnalyticEventObserver, SessionErrorCode } from './yospace/AnalyticEventObserver'; export * from './yospace/AdBreak'; export { SessionProperties } from './yospace/SessionProperties'; +export * from './yospace/PlayerEvent'; +export * from './yospace/TimedMetadata'; +export * from './yospace/TrackingError'; +export * from './yospace/YospaceSessionManager'; +export { Event } from './utils/event/Event'; +export * from './utils/event/EventDispatcher'; diff --git a/yospace/src/yospace/AdBreak.ts b/yospace/src/yospace/AdBreak.ts index 656a253e..6cd92725 100644 --- a/yospace/src/yospace/AdBreak.ts +++ b/yospace/src/yospace/AdBreak.ts @@ -5,7 +5,7 @@ export enum ResourceType { UNKNOWN } -interface Resource { +export interface Resource { getByteData(): number[]; getCreativeType(): string; getResourceType(): ResourceType; From ddbc480eb47a10735eecf1738f66f125fc79a917 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Fri, 5 Apr 2024 15:00:56 +0200 Subject: [PATCH 05/15] Rework tsconfig --- cmcd/tsconfig.json | 16 ++++++---------- conviva/tsconfig.json | 16 ++++++---------- nielsen/tsconfig.json | 16 ++++++---------- tools/build.mjs | 4 +--- tsconfig.base.json | 14 ++++++++++++++ yospace/tsconfig.json | 16 ++++++---------- 6 files changed, 39 insertions(+), 43 deletions(-) create mode 100644 tsconfig.base.json diff --git a/cmcd/tsconfig.json b/cmcd/tsconfig.json index 5fd53772..13d36cb9 100644 --- a/cmcd/tsconfig.json +++ b/cmcd/tsconfig.json @@ -1,13 +1,9 @@ { + "extends": "../tsconfig.base.json", "compilerOptions": { - "target": "es5", - "module": "commonjs", - "strict": true, - "baseUrl": "./", - "rootDir": ".", - "paths": { "THEOplayer": ["./src/THEOplayer"] }, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true - } + "rootDir": "src" + }, + "include": [ + "src/**/*" + ] } diff --git a/conviva/tsconfig.json b/conviva/tsconfig.json index 5fd53772..13d36cb9 100644 --- a/conviva/tsconfig.json +++ b/conviva/tsconfig.json @@ -1,13 +1,9 @@ { + "extends": "../tsconfig.base.json", "compilerOptions": { - "target": "es5", - "module": "commonjs", - "strict": true, - "baseUrl": "./", - "rootDir": ".", - "paths": { "THEOplayer": ["./src/THEOplayer"] }, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true - } + "rootDir": "src" + }, + "include": [ + "src/**/*" + ] } diff --git a/nielsen/tsconfig.json b/nielsen/tsconfig.json index 5fd53772..13d36cb9 100644 --- a/nielsen/tsconfig.json +++ b/nielsen/tsconfig.json @@ -1,13 +1,9 @@ { + "extends": "../tsconfig.base.json", "compilerOptions": { - "target": "es5", - "module": "commonjs", - "strict": true, - "baseUrl": "./", - "rootDir": ".", - "paths": { "THEOplayer": ["./src/THEOplayer"] }, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true - } + "rootDir": "src" + }, + "include": [ + "src/**/*" + ] } diff --git a/tools/build.mjs b/tools/build.mjs index 7d4bbf90..6317d4c0 100644 --- a/tools/build.mjs +++ b/tools/build.mjs @@ -37,9 +37,7 @@ export function getSharedBuildConfiguration({ fileName, globalName, banner, exte include: ['node_modules/**', '../node_modules/**'] }), typescript({ - tsconfig: 'tsconfig.json', - module: 'es2015', - include: ['src/**/*'] + tsconfig: 'tsconfig.json' }) ] }, diff --git a/tsconfig.base.json b/tsconfig.base.json new file mode 100644 index 00000000..9db7497f --- /dev/null +++ b/tsconfig.base.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "es2015", + "moduleResolution": "bundler", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + }, + "include": [ + "src/**/*" + ] +} diff --git a/yospace/tsconfig.json b/yospace/tsconfig.json index 5fd53772..13d36cb9 100644 --- a/yospace/tsconfig.json +++ b/yospace/tsconfig.json @@ -1,13 +1,9 @@ { + "extends": "../tsconfig.base.json", "compilerOptions": { - "target": "es5", - "module": "commonjs", - "strict": true, - "baseUrl": "./", - "rootDir": ".", - "paths": { "THEOplayer": ["./src/THEOplayer"] }, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true - } + "rootDir": "src" + }, + "include": [ + "src/**/*" + ] } From 887a393618a91e08a196ca1cd1424d4d72676926 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Fri, 5 Apr 2024 15:07:06 +0200 Subject: [PATCH 06/15] Unbundle TypeScript type definitions --- cmcd/package.json | 4 ++-- cmcd/tsconfig.json | 4 +++- conviva/package.json | 4 ++-- conviva/tsconfig.json | 4 +++- nielsen/package.json | 4 ++-- nielsen/tsconfig.json | 4 +++- package-lock.json | 22 ---------------------- package.json | 1 - tools/build.mjs | 20 -------------------- tsconfig.base.json | 1 + yospace/package.json | 4 ++-- yospace/tsconfig.json | 4 +++- 12 files changed, 21 insertions(+), 55 deletions(-) diff --git a/cmcd/package.json b/cmcd/package.json index 38bf9d83..83c30512 100644 --- a/cmcd/package.json +++ b/cmcd/package.json @@ -10,10 +10,10 @@ }, "homepage": "https://theoplayer.com/", "module": "dist/cmcd-connector.esm.js", - "types": "dist/cmcd-connector.d.ts", + "types": "dist/types/index.d.ts", "exports": { ".": { - "types": "./dist/cmcd-connector.d.ts", + "types": "./dist/types/index.d.ts", "import": "./dist/cmcd-connector.esm.js", "require": "./dist/cmcd-connector.umd.js" }, diff --git a/cmcd/tsconfig.json b/cmcd/tsconfig.json index 13d36cb9..d416c1ae 100644 --- a/cmcd/tsconfig.json +++ b/cmcd/tsconfig.json @@ -1,7 +1,9 @@ { "extends": "../tsconfig.base.json", "compilerOptions": { - "rootDir": "src" + "rootDir": "src", + "outDir": "dist", + "declarationDir": "dist/types" }, "include": [ "src/**/*" diff --git a/conviva/package.json b/conviva/package.json index b56a9bc1..e2276817 100644 --- a/conviva/package.json +++ b/conviva/package.json @@ -6,10 +6,10 @@ "repository": "https://github.com/THEOplayer/conviva-connector-web", "homepage": "https://theoplayer.com/", "module": "dist/conviva-connector.esm.js", - "types": "dist/conviva-connector.d.ts", + "types": "dist/types/index.d.ts", "exports": { ".": { - "types": "./dist/conviva-connector.d.ts", + "types": "./dist/types/index.d.ts", "import": "./dist/conviva-connector.esm.js", "require": "./dist/conviva-connector.umd.js" }, diff --git a/conviva/tsconfig.json b/conviva/tsconfig.json index 13d36cb9..d416c1ae 100644 --- a/conviva/tsconfig.json +++ b/conviva/tsconfig.json @@ -1,7 +1,9 @@ { "extends": "../tsconfig.base.json", "compilerOptions": { - "rootDir": "src" + "rootDir": "src", + "outDir": "dist", + "declarationDir": "dist/types" }, "include": [ "src/**/*" diff --git a/nielsen/package.json b/nielsen/package.json index 45aee86e..cd3eb54f 100644 --- a/nielsen/package.json +++ b/nielsen/package.json @@ -4,10 +4,10 @@ "description": "A connector implementing Nielsen with THEOplayer.", "main": "dist/nielsen-connector.umd.js", "module": "dist/nielsen-connector.esm.js", - "types": "dist/nielsen-connector.d.ts", + "types": "dist/types/index.d.ts", "exports": { ".": { - "types": "./dist/nielsen-connector.d.ts", + "types": "./dist/types/index.d.ts", "import": "./dist/nielsen-connector.esm.js", "require": "./dist/nielsen-connector.umd.js" }, diff --git a/nielsen/tsconfig.json b/nielsen/tsconfig.json index 13d36cb9..d416c1ae 100644 --- a/nielsen/tsconfig.json +++ b/nielsen/tsconfig.json @@ -1,7 +1,9 @@ { "extends": "../tsconfig.base.json", "compilerOptions": { - "rootDir": "src" + "rootDir": "src", + "outDir": "dist", + "declarationDir": "dist/types" }, "include": [ "src/**/*" diff --git a/package-lock.json b/package-lock.json index fddba4ff..2015104e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,7 +30,6 @@ "prettier": "^3.2.4", "rimraf": "^5.0.5", "rollup": "^4.14.0", - "rollup-plugin-dts": "^6.1.0", "theoplayer": "^7.0.0", "ts-jest": "^29.1.2", "ts-node": "^10.9.2", @@ -7139,27 +7138,6 @@ "fsevents": "~2.3.2" } }, - "node_modules/rollup-plugin-dts": { - "version": "6.1.0", - "dev": true, - "license": "LGPL-3.0", - "dependencies": { - "magic-string": "^0.30.4" - }, - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/Swatinem" - }, - "optionalDependencies": { - "@babel/code-frame": "^7.22.13" - }, - "peerDependencies": { - "rollup": "^3.29.4 || ^4", - "typescript": "^4.5 || ^5.0" - } - }, "node_modules/run-parallel": { "version": "1.2.0", "dev": true, diff --git a/package.json b/package.json index 267566d0..fa2a3788 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "prettier": "^3.2.4", "rimraf": "^5.0.5", "rollup": "^4.14.0", - "rollup-plugin-dts": "^6.1.0", "theoplayer": "^7.0.0", "ts-jest": "^29.1.2", "ts-node": "^10.9.2", diff --git a/tools/build.mjs b/tools/build.mjs index 6317d4c0..6b6fa7b3 100644 --- a/tools/build.mjs +++ b/tools/build.mjs @@ -2,7 +2,6 @@ import { defineConfig } from 'rollup'; import nodeResolve from '@rollup/plugin-node-resolve'; import commonjs from '@rollup/plugin-commonjs'; import typescript from '@rollup/plugin-typescript'; -import dts from 'rollup-plugin-dts'; export function getSharedBuildConfiguration({ fileName, globalName, banner, external, globals }) { return defineConfig([ @@ -40,25 +39,6 @@ export function getSharedBuildConfiguration({ fileName, globalName, banner, exte tsconfig: 'tsconfig.json' }) ] - }, - { - input: { - [fileName]: 'src/index.ts' - }, - output: [ - { - dir: 'dist', - format: 'esm', - banner, - footer: `export as namespace ${globalName};` - } - ], - external: ['theoplayer', ...(external ?? [])], - plugins: [ - dts({ - tsconfig: 'tsconfig.json' - }) - ] } ]); } diff --git a/tsconfig.base.json b/tsconfig.base.json index 9db7497f..2f799823 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -3,6 +3,7 @@ "target": "es5", "module": "es2015", "moduleResolution": "bundler", + "declaration": true, "strict": true, "esModuleInterop": true, "skipLibCheck": true, diff --git a/yospace/package.json b/yospace/package.json index b3be3b46..83b5f290 100644 --- a/yospace/package.json +++ b/yospace/package.json @@ -10,10 +10,10 @@ }, "homepage": "https://theoplayer.com/", "module": "dist/yospace-connector.esm.js", - "types": "dist/yospace-connector.d.ts", + "types": "dist/types/index.d.ts", "exports": { ".": { - "types": "./dist/yospace-connector.d.ts", + "types": "./dist/types/index.d.ts", "import": "./dist/yospace-connector.esm.js", "require": "./dist/yospace-connector.umd.js" }, diff --git a/yospace/tsconfig.json b/yospace/tsconfig.json index 13d36cb9..d416c1ae 100644 --- a/yospace/tsconfig.json +++ b/yospace/tsconfig.json @@ -1,7 +1,9 @@ { "extends": "../tsconfig.base.json", "compilerOptions": { - "rootDir": "src" + "rootDir": "src", + "outDir": "dist", + "declarationDir": "dist/types" }, "include": [ "src/**/*" From 2dc00e72a5d1a0122b6530d03a77d0dceac88541 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Fri, 5 Apr 2024 15:14:59 +0200 Subject: [PATCH 07/15] Publish API docs to GitHub Pages --- .github/workflows/pages.yml | 51 +++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/pages.yml diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 00000000..e4e159ab --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,51 @@ +# Based on https://github.com/actions/starter-workflows/blob/b53d05e4b0dde7cdaeda60476acfcaaa1713f8cc/pages/jekyll-gh-pages.yml +name: GitHub Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: + - main + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: 'pages' + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Pages + uses: actions/configure-pages@v4 + - name: Setup Node.js environment + uses: actions/setup-node@v4 + with: + node-version: 20 + - name: Install dependencies + run: npm ci --workspaces --include-workspace-root + - name: Build API docs + run: npm run docs -- --out ./_site/api + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + deploy: + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} From 725ed78eea55959309d97a5bd9a0a11bc30350bb Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Fri, 5 Apr 2024 15:27:41 +0200 Subject: [PATCH 08/15] Add READMEs to API docs --- cmcd/typedoc.json | 1 + conviva/typedoc.json | 1 + nielsen/typedoc.json | 1 + typedoc.base.json | 2 +- typedoc.config.js | 2 +- yospace/typedoc.json | 1 + 6 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmcd/typedoc.json b/cmcd/typedoc.json index d02c08a0..4ac91d8e 100644 --- a/cmcd/typedoc.json +++ b/cmcd/typedoc.json @@ -7,5 +7,6 @@ "src/index.ts" ], "tsconfig": "tsconfig.json", + "readme": "README.md", "name": "CMCD Connector" } diff --git a/conviva/typedoc.json b/conviva/typedoc.json index 2c607be9..547c6c6f 100644 --- a/conviva/typedoc.json +++ b/conviva/typedoc.json @@ -7,5 +7,6 @@ "src/index.ts" ], "tsconfig": "tsconfig.json", + "readme": "README.md", "name": "Conviva Connector" } diff --git a/nielsen/typedoc.json b/nielsen/typedoc.json index d547c0ca..b1076f68 100644 --- a/nielsen/typedoc.json +++ b/nielsen/typedoc.json @@ -7,5 +7,6 @@ "src/index.ts" ], "tsconfig": "tsconfig.json", + "readme": "README.md", "name": "Nielsen Connector" } diff --git a/typedoc.base.json b/typedoc.base.json index 692a1e1f..0f592346 100644 --- a/typedoc.base.json +++ b/typedoc.base.json @@ -1,6 +1,6 @@ { "$schema": "https://typedoc.org/schema.json", - "readme": "none", + "includeVersion": true, "plugin": [ "typedoc-plugin-external-resolver", "typedoc-plugin-mdn-links" diff --git a/typedoc.config.js b/typedoc.config.js index 0ab104f4..e4a2c151 100644 --- a/typedoc.config.js +++ b/typedoc.config.js @@ -3,7 +3,7 @@ const { workspaces } = require('./package.json'); /** @type {import('typedoc').TypeDocOptions} */ module.exports = { extends: ['./typedoc.base.json'], - name: 'THEOplayer Connectors for Web', + name: 'THEOplayer Web SDK Connectors', entryPoints: workspaces, entryPointStrategy: 'packages', includeVersion: false, diff --git a/yospace/typedoc.json b/yospace/typedoc.json index cf3ee1fa..8dde8e89 100644 --- a/yospace/typedoc.json +++ b/yospace/typedoc.json @@ -7,5 +7,6 @@ "src/index.ts" ], "tsconfig": "tsconfig.json", + "readme": "README.md", "name": "Yospace Connector" } From 32af2b4f0ab5e679be5e1a06c1028a468957cacb Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Fri, 5 Apr 2024 15:27:59 +0200 Subject: [PATCH 09/15] Add README for monorepo --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..ea5ef2c2 --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# THEOplayer Web SDK Connectors + +This repository is maintained by [THEO Technologies](https://www.theoplayer.com/) and contains the different connectors +available for the THEOplayer Web SDK. + +The THEOplayer Web SDK enables you to quickly deliver content playback on your website or web app. + +Using the available connectors allows you to augment the features delivered through the Web SDK. + +## Available Connectors + +| Connector | npm package | Source code | +|:----------|:-----------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------| +| CMCD | [@theoplayer/cmcd-connector-web](https://www.npmjs.com/package/@theoplayer/cmcd-connector-web) | [cmcd](https://github.com/THEOplayer/web-connectors/tree/main/cmcd) | +| Conviva | [@theoplayer/conviva-connector-web](https://www.npmjs.com/package/@theoplayer/conviva-connector-web) | [conviva](https://github.com/THEOplayer/web-connectors/tree/main/conviva) | +| Nielsen | [@theoplayer/nielsen-connector-web](https://www.npmjs.com/package/@theoplayer/nielsen-connector-web) | [nielsen](https://github.com/THEOplayer/web-connectors/tree/main/nielsen) | +| Yospace | [@theoplayer/yospace-connector-web](https://www.npmjs.com/package/@theoplayer/yospace-connector-web) | [yospace](https://github.com/THEOplayer/web-connectors/tree/main/yospace) | + +## License + +The contents of this package are subject to the [THEOplayer license](https://www.theoplayer.com/terms). From cf242033adc9372f6b8792f35fd8ca7757ae361a Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Fri, 5 Apr 2024 15:36:11 +0200 Subject: [PATCH 10/15] Show npm version of packages --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ea5ef2c2..ae1f9af8 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,12 @@ Using the available connectors allows you to augment the features delivered thro ## Available Connectors -| Connector | npm package | Source code | -|:----------|:-----------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------| -| CMCD | [@theoplayer/cmcd-connector-web](https://www.npmjs.com/package/@theoplayer/cmcd-connector-web) | [cmcd](https://github.com/THEOplayer/web-connectors/tree/main/cmcd) | -| Conviva | [@theoplayer/conviva-connector-web](https://www.npmjs.com/package/@theoplayer/conviva-connector-web) | [conviva](https://github.com/THEOplayer/web-connectors/tree/main/conviva) | -| Nielsen | [@theoplayer/nielsen-connector-web](https://www.npmjs.com/package/@theoplayer/nielsen-connector-web) | [nielsen](https://github.com/THEOplayer/web-connectors/tree/main/nielsen) | -| Yospace | [@theoplayer/yospace-connector-web](https://www.npmjs.com/package/@theoplayer/yospace-connector-web) | [yospace](https://github.com/THEOplayer/web-connectors/tree/main/yospace) | +| Connector | npm package | Source code | +|:----------|:-----------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------| +| CMCD | ![@theoplayer/cmcd-connector-web](https://img.shields.io/npm/v/%40theoplayer%2Fcmcd-connector-web?label=%40theoplayer%2Fcmcd-connector-web) | [cmcd](https://github.com/THEOplayer/web-connectors/tree/main/cmcd) | +| Conviva | ![@theoplayer/conviva-connector-web](https://img.shields.io/npm/v/%40theoplayer%2Fconviva-connector-web?label=%40theoplayer%2Fconviva-connector-web) | [conviva](https://github.com/THEOplayer/web-connectors/tree/main/conviva) | +| Nielsen | ![@theoplayer/nielsen-connector-web](https://img.shields.io/npm/v/%40theoplayer%2Fnielsen-connector-web?label=%40theoplayer%2Fnielsen-connector-web) | [nielsen](https://github.com/THEOplayer/web-connectors/tree/main/nielsen) | +| Yospace | ![@theoplayer/yospace-connector-web](https://img.shields.io/npm/v/%40theoplayer%2Fyospace-connector-web?label=%40theoplayer%2Fyospace-connector-web) | [yospace](https://github.com/THEOplayer/web-connectors/tree/main/yospace) | ## License From d61fe9d48bf29247dc208cf8b6e712bc45dfa01b Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Fri, 5 Apr 2024 15:42:20 +0200 Subject: [PATCH 11/15] Ignore api/ in WebStorm --- .idea/web-connectors.iml | 1 + 1 file changed, 1 insertion(+) diff --git a/.idea/web-connectors.iml b/.idea/web-connectors.iml index a92d84c5..447c428e 100644 --- a/.idea/web-connectors.iml +++ b/.idea/web-connectors.iml @@ -9,6 +9,7 @@ + From 00d34fcbe73c95689e7cc72a0d5814b718e24a54 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Fri, 5 Apr 2024 15:47:24 +0200 Subject: [PATCH 12/15] Sort connectors alphabetically in API docs --- typedoc.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typedoc.config.js b/typedoc.config.js index e4a2c151..873c35b1 100644 --- a/typedoc.config.js +++ b/typedoc.config.js @@ -4,7 +4,7 @@ const { workspaces } = require('./package.json'); module.exports = { extends: ['./typedoc.base.json'], name: 'THEOplayer Web SDK Connectors', - entryPoints: workspaces, + entryPoints: workspaces.slice().sort(), entryPointStrategy: 'packages', includeVersion: false, out: 'api', From f6a03a80757b64f684f46e4f3f26e0971010df72 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Fri, 5 Apr 2024 15:49:14 +0200 Subject: [PATCH 13/15] Add changeset for missing exports --- .changeset/hungry-crabs-report.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/hungry-crabs-report.md diff --git a/.changeset/hungry-crabs-report.md b/.changeset/hungry-crabs-report.md new file mode 100644 index 00000000..2dd63fbd --- /dev/null +++ b/.changeset/hungry-crabs-report.md @@ -0,0 +1,6 @@ +--- +"@theoplayer/yospace-connector-web": patch +"@theoplayer/cmcd-connector-web": patch +--- + +Fix missing API types in TypeScript type definitions. From 4bb796a74a769c9f3a5f31c41fd7d8565ee8a60f Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Fri, 5 Apr 2024 15:56:47 +0200 Subject: [PATCH 14/15] Add test script for TypeDoc --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index fa2a3788..15f71885 100644 --- a/package.json +++ b/package.json @@ -16,12 +16,13 @@ "changeset:version": "changeset version && node .changeset/post-process.js", "build": "npm run build --workspaces", "clean": "npm run clean --workspaces", - "test": "npm run test --workspaces", + "test": "npm run test --workspaces && npm run test:docs", "prettier": "prettier --check \"*/(src|test)/**/*\"", "prettier:fix": "prettier --write \"*/(src|test)/**/*\"", "lint": "eslint \"*/src/**/*.ts\" \"*/test*/**/*.ts\"", "lint:fix": "npm run lint -- --fix", - "docs": "typedoc" + "docs": "typedoc --treatWarningsAsErrors", + "test:docs": "npm run docs -- --emit none" }, "devDependencies": { "@changesets/cli": "^2.27.1", From a9bf219d2911d58e3237057f032d2977c4596607 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Fri, 5 Apr 2024 16:00:03 +0200 Subject: [PATCH 15/15] Test on CI --- .github/workflows/test.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..f007c629 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,29 @@ +name: Test +on: + push: + branches: + - main + paths-ignore: + - '**.md' + pull_request: + types: [opened, reopened, synchronize] + paths-ignore: + - '**.md' +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + - name: Install dependencies + run: npm ci --workspaces --include-workspace-root + - name: Build + run: npm run build + - name: Test + run: npm test