Skip to content

Commit

Permalink
Fix build (#473)
Browse files Browse the repository at this point in the history
* Fix lint errors

* Fix cli build

* Use tsx instead of esbuild-register

* Fix the absolute import in `definedGlobals`

* Pin node to 20.9

* Fix lint errors

* Fix the test error

* Fix dts rollup

* Temporarily disable compat/regression tests
  • Loading branch information
AriaMinaei authored Jan 2, 2024
1 parent 2e95e16 commit 42483a2
Show file tree
Hide file tree
Showing 112 changed files with 1,176 additions and 755 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
node-version: [18.x]
node-version: [20.9]

steps:
- uses: actions/checkout@v3
Expand All @@ -28,7 +28,7 @@ jobs:

strategy:
matrix:
node-version: [18.x]
node-version: [20.9]

steps:
- uses: actions/checkout@v3
Expand All @@ -47,7 +47,7 @@ jobs:

strategy:
matrix:
node-version: [18.x]
node-version: [20.9]

steps:
- uses: actions/checkout@v3
Expand All @@ -60,12 +60,14 @@ jobs:
- run: yarn test

VisualRegression:
# skip this until the new API is ready
if: false
name: Visual regression tests
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]
node-version: [20.9]

steps:
- uses: actions/checkout@v3
Expand All @@ -79,11 +81,13 @@ jobs:
run: yarn test:e2e:ci

Compatibility-Tests:
# skip this until the new API is ready
if: false
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]
node-version: [20.9]

steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions compat-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"name": "@theatre/compat-tests",
"private": true,
"scripts": {
"install-fixtures": "node -r esbuild-register ./scripts/install-fixtures.ts",
"clean": "node -r esbuild-register ./scripts/clean.ts"
"install-fixtures": "tsx ./scripts/install-fixtures.ts",
"clean": "tsx ./scripts/clean.ts"
},
"dependencies": {
"@cspotcode/zx": "^6.1.2",
"@verdaccio/types": "^10.8.0",
"esbuild": "^0.18.18",
"esbuild-register": "^3.4.2",
"node-cleanup": "^2.1.2",
"playwright": "^1.29.1",
"prettier": "^2.6.2",
"tsx": "4.7.0",
"verdaccio": "^5.26.1",
"verdaccio-auth-memory": "^10.2.2",
"verdaccio-memory": "^10.3.2"
Expand Down
73 changes: 18 additions & 55 deletions devEnv/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,44 +27,36 @@ $.quote = function quote(arg) {
)
}

const packagesToBuild = [
'@theatre/dataverse',
'@theatre/saaz',
'@theatre/core',
'@theatre/studio',
'@theatre/react',
'@theatre/r3f',
'theatric',
'@theatre/browser-bundles',
]

prog
.command(
'build clean',
'Cleans the build artifacts and output directories of all the main packages',
)
.action(async () => {
const packages = [
'@theatre/saaz',
'theatre',
'@theatre/dataverse',
'@theatre/react',
'@theatre/browser-bundles',
'@theatre/r3f',
'theatric',
]
const packages = [...packagesToBuild]

await Promise.all([
...packages.map((workspace) => $`yarn workspace ${workspace} run clean`),
])
})

prog.command('build', 'Builds all the main packages').action(async () => {
const packagesToBuild = [
'@theatre/saaz',
'theatre',
'@theatre/dataverse',
'@theatre/react',
'@theatre/browser-bundles',
'@theatre/r3f',
'theatric',
]
async function build() {
await Promise.all([
$`yarn run build:ts`,
...packagesToBuild.map(
(workspace) => $`yarn workspace ${workspace} run build`,
),
])
await $`yarn run build:ts`
for (const workspace of packagesToBuild) {
await $`yarn workspace ${workspace} run build`
}
}

void build()
Expand All @@ -80,42 +72,13 @@ prog
*
* It assigns the same version number to all packages (like lerna's fixed mode).
**/
const packagesToBuild = [
'@theatre/saaz',
'theatre',
'@theatre/dataverse',
'@theatre/react',
'@theatre/browser-bundles',
'@theatre/r3f',
'theatric',
]

const packagesToPublish = [
'@theatre/core',
'@theatre/studio',
'@theatre/dataverse',
'@theatre/saaz',
'@theatre/react',
'@theatre/browser-bundles',
'@theatre/r3f',
'theatric',
]
const packagesToPublish = [...packagesToBuild]

/**
* All these packages will have the same version from monorepo/package.json
*/
const packagesWhoseVersionsShouldBump = [
'.',
'theatre',
'theatre/core',
'theatre/studio',
'packages/dataverse',
'packages/react',
'packages/saaz',
'packages/browser-bundles',
'packages/r3f',
'packages/theatric',
]
const packagesWhoseVersionsShouldBump = ['.', ...packagesToPublish]

// our packages will check for this env variable to make sure their
// prepublish script is only called from the `$ cd /path/to/monorepo; yarn run release`
Expand Down
5 changes: 1 addition & 4 deletions devEnv/ensurePublishing.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
if (
process.env.THEATRE_IS_PUBLISHING !== 'true' &&
process.env.USING_YALC !== 'true'
) {
if (process.env.THEATRE_IS_PUBLISHING !== 'true') {
throw Error(
`This script may run only when the "release" command in monorepo's root is running.`,
)
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: '3.8'
name: theatre-monorepo
services:
node:
image: mcr.microsoft.com/playwright:v1.36.0-jammy
image: mcr.microsoft.com/playwright:v1.40.0-jammy
volumes:
- .:/app
# This ignores all node_modules folders/sub-folders so that we can have a separate installation
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-dom/Scene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {UseDragOpts} from './useDrag'
import useDrag from './useDrag'
import theatre from '@theatre/core'

theatre.init({studio: true})
void theatre.init({studio: true})

const boxObjectConfig = {
x: 0,
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-dom/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ReactDOM from 'react-dom/client'
import theatre, {getProject} from '@theatre/core'
import {Scene} from './Scene'

theatre.init({studio: true})
void theatre.init({studio: true})

ReactDOM.createRoot(document.getElementById('root')!).render(
<Scene project={getProject('Sample project')} />,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"compat-tests"
],
"scripts": {
"cli": "node -r esbuild-register devEnv/cli.ts",
"cli": "tsx devEnv/cli.ts",
"playground": "yarn workspace playground run serve",
"benchmarks": "yarn workspace benchmarks run serve",
"test:e2e": "yarn workspace playground run test",
Expand Down Expand Up @@ -38,7 +38,6 @@
"@typescript-eslint/eslint-plugin": "^6.16.0",
"@typescript-eslint/parser": "^6.16.0",
"esbuild": "^0.18.18",
"esbuild-register": "^3.4.2",
"eslint": "^8.56.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jsx-a11y": "^6.7.1",
Expand All @@ -58,6 +57,7 @@
"node-gyp": "^9.1.0",
"prettier": "^3.1.1",
"sade": "^1.8.1",
"tsx": "4.7.0",
"typescript": "5.1.6",
"yaml": "^2.3.1"
},
Expand Down
3 changes: 1 addition & 2 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"cli": "node -r esbuild-register devEnv/cli.ts",
"cli": "tsx devEnv/cli.ts",
"start": "yarn cli prod start",
"lint": "next lint",
"prebuild": "yarn cli prebuild",
Expand Down Expand Up @@ -44,7 +44,6 @@
"cross-env": "^7.0.3",
"dotenv": "^16.3.1",
"esbuild": "^0.18.20",
"esbuild-register": "^3.4.2",
"eslint-config-next": "13.4.13",
"jose": "^4.14.4",
"lucide-react": "^0.289.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ export default function EditWorkspaceDialog({
name: values.name,
description: values.description,
})
queryUtils.teams.invalidate()
queryUtils.workspaces.invalidate()
void queryUtils.teams.invalidate()
void queryUtils.workspaces.invalidate()
} catch (error) {
toast({
variant: 'destructive',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function InviteGuestsDialog({
id: workspaceId,
invites: [{email: values.email, accessLevel: values.accessLevel}],
})
queryUtils.workspaces.invalidate()
void queryUtils.workspaces.invalidate()
} catch (error) {
toast({
variant: 'destructive',
Expand Down Expand Up @@ -157,15 +157,15 @@ function Guests({workspaceId}: {workspaceId: string}) {

async function handleRemoveGuest(email: string) {
await removeGuest({id: workspaceId, email})
queryUtils.workspaces.getGuests.invalidate()
void queryUtils.workspaces.getGuests.invalidate()
}

async function handleChangeAccessLevel(
email: string,
accessLevel: 'READ' | 'READ_WRITE',
) {
await changeAccessLevel({id: workspaceId, email, accessLevel})
queryUtils.workspaces.getGuests.invalidate()
void queryUtils.workspaces.getGuests.invalidate()
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const InviteTeamMembersPrompt: FC<{id: string}> = ({id}) => {
id,
invites: [{email: values.email, role: values.role}],
})
queryUtils.teams.invalidate()
void queryUtils.teams.invalidate()
} catch (error) {
toast({
variant: 'destructive',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export default function NewWorkspaceDialog({teamId}: {teamId: string}) {
description: values.description,
teamId,
})
queryUtils.teams.invalidate()
queryUtils.workspaces.invalidate()
void queryUtils.teams.invalidate()
void queryUtils.workspaces.invalidate()
} catch (error) {
toast({
variant: 'destructive',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ const Invitations = () => {
<Button
onClick={async () => {
await acceptGuestInvitation({id: invitation.workspaceId})
queryUtils.me.getGuestInvitations.invalidate()
queryUtils.workspaces.invalidate()
void queryUtils.me.getGuestInvitations.invalidate()
void queryUtils.workspaces.invalidate()
}}
size="sm"
>
Expand All @@ -70,8 +70,8 @@ const Invitations = () => {
id: invitation.workspaceId,
email: me.email!,
})
queryUtils.me.getGuestInvitations.invalidate()
queryUtils.workspaces.invalidate()
void queryUtils.me.getGuestInvitations.invalidate()
void queryUtils.workspaces.invalidate()
}}
variant="ghost"
size="sm"
Expand All @@ -91,8 +91,8 @@ const Invitations = () => {
<Button
onClick={async () => {
await acceptTeamInvitation({id: invitation.teamId})
queryUtils.me.getTeamInvitations.invalidate()
queryUtils.teams.invalidate()
void queryUtils.me.getTeamInvitations.invalidate()
void queryUtils.teams.invalidate()
}}
size="sm"
>
Expand All @@ -104,8 +104,8 @@ const Invitations = () => {
id: invitation.teamId,
email: me.email!,
})
queryUtils.me.getTeamInvitations.invalidate()
queryUtils.teams.invalidate()
void queryUtils.me.getTeamInvitations.invalidate()
void queryUtils.teams.invalidate()
}}
variant="ghost"
size="sm"
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/app/(protected)/_components/TeamMembers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ export default function Members({teamId}: {teamId: string}) {

async function handleRemoveMember(email: string) {
await removeMember({id: teamId, email})
queryUtils.teams.getMembers.invalidate()
void queryUtils.teams.getMembers.invalidate()
}

async function handleChangeRole(email: string, role: 'MEMBER' | 'OWNER') {
try {
await changeMemberRole({id: teamId, email, role})
queryUtils.teams.getMembers.invalidate()
void queryUtils.teams.getMembers.invalidate()
} catch (error) {
toast({
variant: 'destructive',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function Team({id}: {id: string}) {
size="icon"
className="invisible group-hover:visible"
onClick={() => {
promptTeamSettings(id)
void promptTeamSettings(id)
}}
>
<Settings className="h-4 w-4" />
Expand Down
Loading

1 comment on commit 42483a2

@vercel
Copy link

@vercel vercel bot commented on 42483a2 Jan 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.