@trypattern/sdk 0.1.15 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/app.js CHANGED
@@ -310,7 +310,7 @@ and restore sign in the same way when they need to, so this is rarely run on its
310
310
  summary: 'Download a site from onpattern.app and install it, ready for app start',
311
311
  details: `app pull acmeflower
312
312
  Downloads the source of the site's latest live version into this folder when it is empty, or into
313
- ./<name> otherwise, writes pattern.json, installs, and runs app setup. Never needs git; when the
313
+ ./<name> otherwise (./<name>-2 and on when that folder already has files), writes pattern.json, installs, and runs app setup. Never needs git; when the
314
314
  Command Line Tools are installed it also makes a first commit. Signs in first if needed (see app login).
315
315
  --code <setup code> signs in with the one-time setup code from onpattern.app instead of the browser.`,
316
316
  run: (argument, options) => {
@@ -252,7 +252,12 @@ function isInsideHome(path) {
252
252
  function folderFor(name, cwd) {
253
253
  if (isInsideHome(cwd) && cwd !== homedir() && isEmptyFolder(cwd))
254
254
  return cwd;
255
- return join(isInsideHome(cwd) ? cwd : homedir(), name);
255
+ const base = join(isInsideHome(cwd) ? cwd : homedir(), name);
256
+ for (let number = 1;; number += 1) {
257
+ const folder = number === 1 ? base : `${base}-${number}`;
258
+ if (!existsSync(folder) || isEmptyFolder(folder))
259
+ return folder;
260
+ }
256
261
  }
257
262
  async function hasPnpm(io, cwd) {
258
263
  return (await io.run('pnpm', ['--version'], cwd)).code === 0;
@@ -285,13 +290,6 @@ export async function pull(io, name, cwd, setupCode) {
285
290
  }
286
291
  sayHost(io);
287
292
  const target = folderFor(name, cwd);
288
- if (target !== cwd && existsSync(target) && !isEmptyFolder(target)) {
289
- return {
290
- code: 1,
291
- data: { error: 'folder not empty', folder: target },
292
- text: `✗ ${target} already has files in it. Pull into an empty folder.`
293
- };
294
- }
295
293
  try {
296
294
  if (setupCode !== undefined)
297
295
  await useSetupCode(io, setupCode);
@@ -348,7 +346,7 @@ export async function pull(io, name, cwd, setupCode) {
348
346
  await io.run('git', ['add', '-A'], target);
349
347
  await io.run('git', ['commit', '-q', '-m', `Version ${result.number} from onpattern.app`], target);
350
348
  }
351
- const next = result.isStarter
349
+ const next = result.isStarter || result.app.pulledAt === null
352
350
  ? firstChange(result.title, result.app.url, target)
353
351
  : `cd into ${target}, read AGENTS.md, then ./app start`;
354
352
  return {
@@ -11,6 +11,7 @@ type ScrollAreaProps = {
11
11
  paddingInline?: number | string;
12
12
  }>;
13
13
  axis?: 'vertical' | 'horizontal';
14
+ resetOn?: string;
14
15
  };
15
- export declare function ScrollArea({ children, style, axis }: ScrollAreaProps): import("react").JSX.Element;
16
+ export declare function ScrollArea({ children, style, axis, resetOn }: ScrollAreaProps): import("react").JSX.Element;
16
17
  export {};
@@ -1,7 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as stylex from '@stylexjs/stylex';
3
- export function ScrollArea({ children, style, axis = 'vertical' }) {
4
- return (_jsx("div", { ...stylex.props(styles.scroll, axis === 'horizontal' && styles.horizontal, style), children: children }));
3
+ import { useLayoutEffect, useRef } from 'react';
4
+ export function ScrollArea({ children, style, axis = 'vertical', resetOn }) {
5
+ const area = useRef(null);
6
+ useLayoutEffect(() => {
7
+ area.current?.scrollTo({ top: 0, left: 0 });
8
+ }, [resetOn]);
9
+ return (_jsx("div", { ref: area, ...stylex.props(styles.scroll, axis === 'horizontal' && styles.horizontal, style), children: children }));
5
10
  }
6
11
  const styles = stylex.create({
7
12
  scroll: {
@@ -149,7 +149,7 @@ export declare const connection: z.ZodObject<{
149
149
  connectedAt: z.ZodString;
150
150
  }, z.core.$strip>;
151
151
  export type Connection = z.output<typeof connection>;
152
- export declare const DOMAIN_ENDINGS: readonly ["com", "ca", "co", "org", "net", "app", "dev", "shop"];
152
+ export declare const DOMAIN_ENDINGS: readonly ["com", "co", "org", "net", "app", "dev", "shop"];
153
153
  export declare const DOMAIN_PRICE_LIMIT_USD = 30;
154
154
  export declare const domainName: z.ZodString;
155
155
  export declare const domainChoice: z.ZodObject<{
@@ -185,7 +185,6 @@ export const connection = z.object({
185
185
  });
186
186
  export const DOMAIN_ENDINGS = [
187
187
  'com',
188
- 'ca',
189
188
  'co',
190
189
  'org',
191
190
  'net',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trypattern/sdk",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",