Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #704 from SuperViz/lab
Browse files Browse the repository at this point in the history
New version 🎉
  • Loading branch information
carlossantos74 authored Jul 4, 2024
2 parents 41e234c + b3a06f3 commit b61a8c5
Show file tree
Hide file tree
Showing 49 changed files with 2,307 additions and 4,383 deletions.
29 changes: 17 additions & 12 deletions .esbuild/build.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
const baseConfig = require('./config');
const { cjsConfig, esmConfig } = require('./config');
const esbuild = require('esbuild');

const config = Object.assign({}, baseConfig, {
minify: true,
drop: ['debugger', 'console'],
});
(async () => {
try {
await Promise.all([
esbuild.build({
...cjsConfig,
outfile: 'lib/index.cjs.js',
}),

require('esbuild')
.build({
...config,
outfile: 'lib/index.js',
})
.catch((error) => {
esbuild.build({
...esmConfig,
outdir: 'lib',
}),
]);
} catch (error) {
console.error(error);
process.exit(1);
});
}
})();
41 changes: 37 additions & 4 deletions .esbuild/config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
require('dotenv').config();
const { style } = require('./plugins/style-loader');
const glob = require('glob');

const entryPoints = glob
.sync('./src/**/*.ts')
.filter((file) => !file.endsWith('.d.ts') && !file.endsWith('.test.ts'));

const entries = Object.entries(process.env).filter((key) => key[0].startsWith('SDK_'));
const env = Object.fromEntries(entries);

module.exports = {
entryPoints: ['./src/index.ts'],
const config = {
loader: {
'.png': 'file',
'.svg': 'file',
Expand All @@ -16,9 +20,38 @@ module.exports = {
},
plugins: [style()],
bundle: true,
target: 'es6',
format: 'esm',
color: true,
minify: true,
logLevel: 'info',
sourcemap: true,
chunkNames: 'chunks/[name]-[hash]',
define: {
'process.env': JSON.stringify(env),
},
};

const esmConfig = {
...config,
entryPoints: ['src/index.ts'],
bundle: true,
sourcemap: true,
minify: true,
splitting: true,
format: 'esm',
define: { global: 'window', 'process.env': JSON.stringify(env) },
};

const cjsConfig = {
...config,
entryPoints: ['src/index.ts'],
bundle: true,
sourcemap: true,
minify: true,
platform: 'node',
target: ['node16'],
};

module.exports = {
esmConfig,
cjsConfig,
};
31 changes: 20 additions & 11 deletions .esbuild/watch.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
const baseConfig = require('./config');
const { cjsConfig, esmConfig } = require('./config');
const esbuild = require('esbuild');

const config = Object.assign({}, baseConfig, {
watch: true,
});
(async () => {
try {
const [cjsContext, esmContext] = await Promise.all([
esbuild.context({
...cjsConfig,
outfile: 'dist/index.cjs.js',
}),

require('esbuild')
.build({
...config,
outfile: 'dist/index.js',
})
.catch((error) => {
esbuild.context({
...esmConfig,
outdir: 'dist',
}),
]);

cjsContext.watch();
esmContext.watch();
} catch (error) {
console.error(error);
process.exit(1);
});
}
})();
6 changes: 3 additions & 3 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '18.x'
node-version: '20.x'
- name: Install dependencies
run: yarn install
- name: Create a .version.js file
Expand All @@ -42,7 +42,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '18.x'
node-version: '20.x'
- name: Install dependencies
run: yarn install
- name: Create a .version.js file
Expand All @@ -62,7 +62,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '18.x'
node-version: '20.x'
- name: Install dependencies
run: yarn install
- name: Create a .version.js file
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-beta-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '18.x'
node-version: '20.x'
- name: Install dependencies
run: yarn install
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-lab-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '18.x'
node-version: '20.x'
- name: Install dependencies
run: yarn install
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-prod-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '18.x'
node-version: '20.x'
- name: Install dependencies
run: yarn install
env:
Expand Down
8 changes: 8 additions & 0 deletions __mocks__/io.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ import { jest } from '@jest/globals';
import { Room } from '@superviz/socket-client';

export const MOCK_IO = {
ClientState: {
CONNECTED: 'CONNECTED',
CONNECTING: 'CONNECTING',
DISCONNECTED: 'DISCONNECTED',
CONNECTION_ERROR: 'CONNECTION_ERROR',
RECONNECTING: 'RECONNECTING',
RECONNECT_ERROR: 'RECONNECT_ERROR',
},
PresenceEvents: {
JOINED_ROOM: 'presence.joined-room',
LEAVE: 'presence.leave',
Expand Down
12 changes: 0 additions & 12 deletions __mocks__/participants.mock.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Avatar, Group, Participant } from '../src';
import { MeetingColors, MeetingColorsHex } from '../src/common/types/meeting-colors.types';
import { ParticipantByGroupApi } from '../src/common/types/participant.types';
import { AblyParticipant } from '../src/services/realtime/ably/types';

export const MOCK_AVATAR: Avatar = {
imageUrl: 'unit-test-avatar-thumbnail.png',
Expand Down Expand Up @@ -50,17 +49,6 @@ export const MOCK_ABLY_PARTICIPANT_DATA_2 = {
color: MeetingColorsHex[1],
};

export const MOCK_ABLY_PARTICIPANT: AblyParticipant = {
extras: null,
clientId: MOCK_LOCAL_PARTICIPANT.id,
action: 'present',
connectionId: 'connection1',
encoding: 'h264',
id: 'unit-test-participant1-ably-id',
timestamp: new Date().getTime(),
data: MOCK_ABLY_PARTICIPANT_DATA_1,
};

export const MOCK_PARTICIPANT_LIST: ParticipantByGroupApi[] = [
{
id: 'unit-test-participant1-id',
Expand Down
78 changes: 0 additions & 78 deletions __mocks__/realtime.mock.ts

This file was deleted.

51 changes: 27 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"description": "SuperViz SDK",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"exports": {
"import": "./lib/index.js",
"require": "./lib/index.cjs.js"
},
"files": [
"lib"
],
Expand Down Expand Up @@ -39,55 +43,54 @@
},
"homepage": "https://github.com/SuperViz/sdk#readme",
"devDependencies": {
"@commitlint/cli": "^18.0.0",
"@commitlint/config-conventional": "^18.0.0",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@esm-bundle/chai": "^4.3.4-fix.0",
"@jest/globals": "^29.7.0",
"@open-wc/testing-helpers": "^2.3.0",
"@types/debug": "^4.1.10",
"@types/jest": "^29.5.6",
"@types/lodash.isequal": "^4.5.6",
"@types/luxon": "^3.3.3",
"@types/node": "^20.8.8",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"@open-wc/testing-helpers": "^3.0.1",
"@types/debug": "^4.1.12",
"@types/jest": "^29.5.12",
"@types/lodash.isequal": "^4.5.8",
"@types/luxon": "^3.4.2",
"@types/node": "^20.14.8",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"@web/dev-server-esbuild": "^0.4.3",
"@web/dev-server-import-maps": "^0.2.0",
"@web/dev-server-legacy": "^2.0.3",
"@web/test-runner": "^0.17.2",
"@web/test-runner-playwright": "^0.10.2",
"concurrently": "^7.2.2",
"concurrently": "^8.2.2",
"cz-conventional-changelog": "^3.3.0",
"dotenv": "^16.0.1",
"esbuild": "^0.14.48",
"eslint": "^8.52.0",
"dotenv": "^16.4.5",
"esbuild": "^0.21.5",
"eslint": "^9.5.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.0",
"husky": "^8.0.3",
"eslint-plugin-import": "^2.29.1",
"husky": "^9.0.11",
"jest": "^29.7.0",
"jest-browser-globals": "^25.1.0-beta",
"jest-canvas-mock": "^2.5.2",
"jest-environment-jsdom": "^29.7.0",
"jest-fetch-mock": "^3.0.3",
"rimraf": "^5.0.5",
"semantic-release": "^22.0.5",
"ts-jest": "^29.1.2",
"rimraf": "^5.0.7",
"semantic-release": "^24.0.0",
"ts-jest": "^29.1.5",
"tsc": "^2.0.4",
"typescript": "^5.2.2",
"typescript": "^5.5.2",
"yargs": "^17.7.2"
},
"dependencies": {
"@superviz/socket-client": "1.5.1",
"ably": "^1.2.45",
"@superviz/socket-client": "1.8.0",
"bowser": "^2.11.0",
"bowser-jr": "^1.0.6",
"debug": "^4.3.4",
"lit": "^3.0.0",
"lit": "^3.1.4",
"lodash": "^4.17.21",
"lodash.debounce": "^4.0.8",
"lodash.isequal": "^4.5.0",
"luxon": "^3.4.3",
"luxon": "^3.4.4",
"rxjs": "^7.8.1",
"semantic-release-version-file": "^1.0.2"
},
Expand Down
Loading

0 comments on commit b61a8c5

Please sign in to comment.