From b63e871420b82995bbe7e3c39abbbf3236ebd579 Mon Sep 17 00:00:00 2001 From: David Sheldrick Date: Thu, 4 May 2023 10:25:31 +0100 Subject: [PATCH] [fix] publish (#1222) - fixes an invalid usage of process.env in the editor package - fixes some bublic paths in the publishing infra code --- .husky/pre-commit | 4 ++-- packages/editor/api-report.md | 1 + packages/editor/src/lib/components/Canvas.tsx | 2 +- packages/editor/src/lib/utils/debug-flags.ts | 1 + scripts/lib/publishing.ts | 7 ++++--- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index f70b3ce60..ee7ffe18c 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,6 +1,6 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -yarn lazy run build-api +npx lazy run build-api git add packages/*/api-report.md -yarn lint-staged +npx lint-staged diff --git a/packages/editor/api-report.md b/packages/editor/api-report.md index 9539337e4..e90045e16 100644 --- a/packages/editor/api-report.md +++ b/packages/editor/api-report.md @@ -603,6 +603,7 @@ export const debugFlags: { peopleMenu: Atom; logMessages: Atom; resetConnectionEveryPing: Atom; + newLiveCollaborators: Atom; }; // @internal (undocumented) diff --git a/packages/editor/src/lib/components/Canvas.tsx b/packages/editor/src/lib/components/Canvas.tsx index 95b840888..f4875a1e5 100644 --- a/packages/editor/src/lib/components/Canvas.tsx +++ b/packages/editor/src/lib/components/Canvas.tsx @@ -135,7 +135,7 @@ export const Canvas = track(function Canvas({ - {process.env.NEXT_PUBLIC_TLDRAW_NEW_COLLABORATORS ? ( + {debugFlags.newLiveCollaborators.value ? ( ) : ( diff --git a/packages/editor/src/lib/utils/debug-flags.ts b/packages/editor/src/lib/utils/debug-flags.ts index 7332729e1..5cecf1598 100644 --- a/packages/editor/src/lib/utils/debug-flags.ts +++ b/packages/editor/src/lib/utils/debug-flags.ts @@ -23,6 +23,7 @@ export const debugFlags = { peopleMenu: createDebugValue('tldrawPeopleMenu', false), logMessages: createDebugValue('tldrawUiLog', []), resetConnectionEveryPing: createDebugValue('tldrawResetConnectionEveryPing', false), + newLiveCollaborators: createDebugValue('tldrawNewLiveCollaborators', false), } declare global { diff --git a/scripts/lib/publishing.ts b/scripts/lib/publishing.ts index bdcdcddf6..1286170dd 100644 --- a/scripts/lib/publishing.ts +++ b/scripts/lib/publishing.ts @@ -1,8 +1,9 @@ import { execSync } from 'child_process' import { fetch } from 'cross-fetch' import { existsSync, readdirSync, readFileSync, writeFileSync } from 'fs' -import path from 'path' +import path, { join } from 'path' import { compare, parse } from 'semver' +import { BUBLIC_ROOT } from './file' export type PackageDetails = { name: string @@ -31,9 +32,9 @@ function getPackageDetails(dir: string): PackageDetails | null { } export function getAllPackageDetails(): Record { - const dirs = readdirSync('bublic/packages') + const dirs = readdirSync(join(BUBLIC_ROOT, 'packages')) const results = dirs - .map((dir) => getPackageDetails(path.join('bublic/packages', dir))) + .map((dir) => getPackageDetails(path.join(BUBLIC_ROOT, 'packages', dir))) .filter((x): x is PackageDetails => Boolean(x)) return Object.fromEntries(results.map((result) => [result.name, result]))