Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ts-sdk][demos] Set up pnpm workspaces, update eslint config, update ts config #830

Merged
merged 34 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
36b4e0c
migrate to pnpm wip
BrtqKr Oct 11, 2024
5001183
add no-hoist to live-compositor, bump versions
BrtqKr Oct 11, 2024
df6a00b
prettier and eslint working
BrtqKr Oct 14, 2024
df07209
fix modules
BrtqKr Oct 14, 2024
331e997
enable config, minor cleanup
BrtqKr Oct 15, 2024
4bff056
prettier working on the monorepo level
BrtqKr Oct 15, 2024
344807c
fix imports for demo, fix eslint for demo, fix imports for ts
BrtqKr Oct 16, 2024
fa88d76
update ts rules, file fixes
BrtqKr Oct 16, 2024
0240931
update demos
BrtqKr Oct 16, 2024
40c0548
leftover
BrtqKr Oct 16, 2024
6d2de05
migrate docs to pnpm
BrtqKr Oct 16, 2024
ba2c76f
clear deps
BrtqKr Oct 16, 2024
f9e6d31
update ignore pattern
BrtqKr Oct 16, 2024
e0a076a
Merge remote-tracking branch 'origin/master' into @BrtqKr/replace-ler…
BrtqKr Oct 16, 2024
2dc93af
modify github actions to use pnpm
BrtqKr Oct 16, 2024
b84412c
modify github actions to use pnpm wip
BrtqKr Oct 16, 2024
575903c
cleanup
BrtqKr Oct 28, 2024
c782794
cleanup
BrtqKr Oct 29, 2024
9640d0e
remove module from create-live-compositor
BrtqKr Oct 29, 2024
9776ffe
fix linting
BrtqKr Oct 30, 2024
bc46bb2
fix build wip, meege master
BrtqKr Oct 30, 2024
420f353
source all packages from workspaces
BrtqKr Oct 30, 2024
577f016
build working
BrtqKr Oct 30, 2024
deffe4f
fix build
BrtqKr Oct 30, 2024
525f18c
fix actions
BrtqKr Oct 30, 2024
643e45e
fix actions
BrtqKr Oct 30, 2024
02b50f8
fix actions attempt
BrtqKr Oct 30, 2024
30d41e9
fix actions attempt
BrtqKr Oct 30, 2024
9885aba
fix lint
BrtqKr Oct 30, 2024
b99359c
comment out docs linting, revert deploy docs
BrtqKr Oct 31, 2024
f2f4c4b
uncomment docs lint
BrtqKr Oct 31, 2024
d215b11
quickfix
BrtqKr Oct 31, 2024
297950f
fix react version in peerDeps
BrtqKr Oct 31, 2024
5cdbc17
fix pnpm i
BrtqKr Oct 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions .github/workflows/demos_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,24 @@ jobs:
with:
submodules: "true"

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "20"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
${{ runner.os }}-

- name: Install project dependencies
working-directory: ./demos
run: npm ci
run: pnpm install --frozen-lockfile

- name: Lint code
working-directory: ./demos
run: npm run lint
run: pnpm run lint

- name: Typecheck code
working-directory: ./demos
run: npm run typecheck
run: pnpm run typecheck
9 changes: 7 additions & 2 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ jobs:
# required when job is running in docker container
apt-get install -y build-essential curl pkg-config git libssl-dev libclang-dev libnss3 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: 🛠 Setup Node.JS
uses: actions/setup-node@v4
with:
Expand All @@ -53,10 +58,10 @@ jobs:
run: cargo run --bin generate_from_types

- name: 🛠 Install dependencies
run: npm ci
run: pnpm install --frozen-lockfile

- name: 📦 Build website
run: npm run build
run: pnpm run build

- name: 🔍 Add site verification token
run: |
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,16 @@ jobs:
with:
components: rustfmt, clippy

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: 🛠 Setup Node.JS
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: 📥 Checkout repo
uses: actions/checkout@v4
Expand Down Expand Up @@ -66,5 +72,5 @@ jobs:
- name: 🖋️ Run website lint + typecheck + build
working-directory: ./docs
run: |
npm ci
npm run typecheck && npm run lint --max-warnings=0 && npm run build
pnpm install --frozen-lockfile
pnpm run typecheck && pnpm run lint --max-warnings=0 && pnpm run build
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,13 @@
"url": "./schemas/scene.schema.json"
}
],
"eslint.workingDirectories": [{ "mode": "auto" }]
"eslint.workingDirectories": [
{ "directory": "./demos", "changeProcessCWD": true },
{ "directory": "./ts", "changeProcessCWD": true },
{ "directory": "./docs", "changeProcessCWD": true }
],
"prettier.requireConfig": true,
"prettier.configPath": "",
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
28 changes: 0 additions & 28 deletions demos/.eslintrc.json

This file was deleted.

9 changes: 0 additions & 9 deletions demos/.prettierrc

This file was deleted.

9 changes: 9 additions & 0 deletions demos/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default {
printWidth: 100,
tabWidth: 2,
singleQuote: true,
bracketSameLine: true,
trailingComma: 'es5',
arrowParens: 'avoid',
endOfLine: 'auto',
};
1 change: 1 addition & 0 deletions demos/1-videoconferencing/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function App() {
}, 2000);
return () => clearTimeout(timeout);
}, [counter]);

return <CallWithMockedInputs inputCount={inputCountPhases[counter % inputCountPhases.length]} />;
}

Expand Down
12 changes: 2 additions & 10 deletions demos/2-tv_broadcast/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,8 @@
import { downloadAsync } from '../utils/utils';
import fs from 'fs-extra';
import path from 'path';
import {
View,
Image,
Text,
Rescaler,
Shader,
InputStream,
Transition,
useInputStreams,
} from 'live-compositor';
import type { Transition } from 'live-compositor';
import { View, Image, Text, Rescaler, Shader, InputStream, useInputStreams } from 'live-compositor';
import LiveCompositor from '@live-compositor/node';
import { useEffect, useState } from 'react';
import { gstStartPlayer } from '../utils/gst';
Expand Down Expand Up @@ -222,7 +214,7 @@
});

await compositor.registerShader('remove_green_screen', {
source: await fs.readFile(path.join(__dirname, 'remove_green_screen.wgsl'), 'utf-8'),

Check warning on line 217 in demos/2-tv_broadcast/index.tsx

View workflow job for this annotation

GitHub Actions / check

Caution: `fs` also has a named export `readFile`. Check if you meant to write `import {readFile} from 'fs-extra'` instead
});

await compositor.registerImage('background', {
Expand Down
86 changes: 86 additions & 0 deletions demos/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import globals from 'globals';

import eslintRecommended from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';

import pluginImport from 'eslint-plugin-import';
import pluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import { plugin as tsEslintPlugin } from 'typescript-eslint';
import reactHooks from 'eslint-plugin-react-hooks';
import tsParser from '@typescript-eslint/parser';

export default [
eslintRecommended.configs.recommended,
pluginImport.flatConfigs.recommended,
pluginPrettierRecommended,
eslintConfigPrettier,
{
files: ['**/*.{js,jsx,ts,tsx}'],
ignores: ['.prettierrc.js'],
plugins: {
'@typescript-eslint': tsEslintPlugin,
},
languageOptions: {
parser: tsParser,
parserOptions: {
project: 'tsconfig.json',
},
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.browser,
...globals.node,
},
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: 'tsconfig.json',
},
},
},
rules: {
'prettier/prettier': ['error'],
'import/no-unresolved': 'error',
'@typescript-eslint/no-explicit-any': [0, {}],
'@typescript-eslint/no-floating-promises': ['error'],
'no-constant-condition': [0],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
vars: 'local',
},
],
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
},
],
},
},
{
files: ['**/*.{ts,tsx}'],
plugins: {
'react-hooks': reactHooks,
},
rules: {
...reactHooks.configs.recommended.rules,
},
},
{
ignores: ['eslint.config.js', '**/generated/**/*', '**/*.d.ts'],
},
];
Loading
Loading