diff --git a/CONTEXT.md b/CONTEXT.md index fe35229..9d6fd04 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -163,6 +163,7 @@ Full API reference with config interfaces, method signatures, and `@example` blo ```bash thatopen create [--template bim|default|cloud] # Scaffold project + auto npm install + # Use "." as name to scaffold in current directory thatopen serve [--port N] # Dev server (esbuild watch + serve bundle) thatopen login [--token T] [--api-url U] [--local] # Authenticate thatopen publish [--name N] [--version-tag T] [--skip-build] [--app-id ID | --component-id ID] diff --git a/README.md b/README.md index 83f5c03..61153fe 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,14 @@ npm run dev # Open your project on platform.thatopen.com and click the debug button ``` +You can also scaffold in the current directory: + +```bash +mkdir my-app && cd my-app +npx thatopen create . +npm run dev +``` + ### Create a cloud component ```bash @@ -30,6 +38,8 @@ npm run run # Build and test locally | `default` | `npx thatopen create my-app --template default` | Minimal app showing platform context | | `cloud` | `npx thatopen create my-component --template cloud` | Server-side Node.js component | +Use `npx thatopen create .` to scaffold in the current directory instead of creating a new one. + ## What's in this package - **Library** — `EngineServicesClient` for interacting with the That Open API (files, folders, apps, cloud components, executions, permissions) @@ -70,7 +80,7 @@ const client = new EngineServicesClient(ctx.accessToken, ctx.apiUrl, { useBearer | Command | Description | |---------|-------------| -| `thatopen create [--template bim\|default\|cloud]` | Scaffold a new project | +| `thatopen create [--template bim\|default\|cloud]` | Scaffold a new project (use `.` for current directory) | | `thatopen serve [--port N]` | Dev server (esbuild watch + serve bundle) | | `thatopen login [--token T] [--local]` | Authenticate with the platform | | `thatopen publish` | Build and publish to the platform | diff --git a/src/built-in/index.ts b/src/built-in/index.ts index 572a6d1..fbbc026 100644 --- a/src/built-in/index.ts +++ b/src/built-in/index.ts @@ -81,6 +81,9 @@ declare class _AppManager { private _container; /** Whether the app has been initialised via {@link init}. */ private _initialized; + private static readonly STORAGE_KEY; + /** Whether the sidebar buttons are collapsed (icon-only). */ + private _sidebarCollapsed; constructor(components: any); /** * The setup configuration that defines elements and layouts. @@ -108,6 +111,11 @@ declare class _AppManager { * Creates the sidebar element with layout-switching buttons. */ private _createSidebar; + /** + * Pauses renderer resize observers, runs a layout-changing callback, + * then resizes and force-renders on the next frame to avoid canvas blink. + */ + private _safeLayoutChange; /** * Highlights the active layout button in the sidebar. */ diff --git a/src/cli/commands/create.ts b/src/cli/commands/create.ts index 56860ca..a2ac6d2 100644 --- a/src/cli/commands/create.ts +++ b/src/cli/commands/create.ts @@ -1,6 +1,6 @@ import { Command } from 'commander'; import { existsSync, mkdirSync, writeFileSync } from 'node:fs'; -import { join, resolve } from 'node:path'; +import { basename, join, resolve } from 'node:path'; import { execSync } from 'node:child_process'; import { getIndexHtml } from '../templates/index-html'; import { getMainTs } from '../templates/main-js'; @@ -38,7 +38,7 @@ function getContextMd(template: Template): string { } export const createCommand = new Command('create') - .argument('', 'Name of the project to create') + .argument('', 'Name of the project to create (use "." for current directory)') .option('-t, --template