create-expo 5.0.0 → 5.1.0

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.
Files changed (58) hide show
  1. package/build/{205.index.js → 589.index.js} +442 -128
  2. package/build/601.index.js +20 -11
  3. package/build/{525.index.js → 870.index.js} +423 -334
  4. package/build/Examples.d.ts +38 -0
  5. package/build/Template.d.ts +98 -0
  6. package/build/__mocks__/fs.d.ts +1 -0
  7. package/build/__mocks__/ora.d.ts +1 -0
  8. package/build/__tests__/Examples.test.d.ts +1 -0
  9. package/build/__tests__/Template.test.d.ts +1 -0
  10. package/build/__tests__/configureWorkspaces.test.d.ts +1 -0
  11. package/build/__tests__/createAsync.test.d.ts +1 -0
  12. package/build/__tests__/createExpoConfig.test.d.ts +1 -0
  13. package/build/__tests__/createFileTransformer.test.d.ts +1 -0
  14. package/build/__tests__/generateAgentFiles.test.d.ts +1 -0
  15. package/build/__tests__/promptSdkVersion.test.d.ts +1 -0
  16. package/build/__tests__/resolvePackageManager.test.d.ts +1 -0
  17. package/build/__tests__/sanitizeTemplate.test.d.ts +1 -0
  18. package/build/__tests__/telemetry.test.d.ts +1 -0
  19. package/build/agent-files/AGENTS.md +41 -0
  20. package/build/agent-files/CLAUDE.md +1 -0
  21. package/build/cli.d.ts +1 -0
  22. package/build/configureWorkspaces.d.ts +9 -0
  23. package/build/createAsync.d.ts +11 -0
  24. package/build/createExpoConfig.d.ts +38 -0
  25. package/build/createFileTransform.d.ts +5 -0
  26. package/build/error.d.ts +9 -0
  27. package/build/generateAgentFiles.d.ts +1 -0
  28. package/build/index.d.ts +1 -0
  29. package/build/index.js +38 -10
  30. package/build/legacyTemplates.d.ts +7 -0
  31. package/build/log.d.ts +12 -0
  32. package/build/paths.d.ts +2 -0
  33. package/build/promptSdkVersion.d.ts +23 -0
  34. package/build/resolvePackageManager.d.ts +12 -0
  35. package/build/resolveProjectRoot.d.ts +3 -0
  36. package/build/sessionStorage.d.ts +8 -0
  37. package/build/telemetry.d.ts +29 -0
  38. package/build/utils/__tests__/args.test.d.ts +1 -0
  39. package/build/utils/__tests__/array.test.d.ts +1 -0
  40. package/build/utils/__tests__/log.test.d.ts +1 -0
  41. package/build/utils/__tests__/npm.test.d.ts +1 -0
  42. package/build/utils/__tests__/obj.test.d.ts +1 -0
  43. package/build/utils/args.d.ts +33 -0
  44. package/build/utils/array.d.ts +1 -0
  45. package/build/utils/dir.d.ts +1 -0
  46. package/build/utils/env.d.ts +14 -0
  47. package/build/utils/fetch.d.ts +2 -0
  48. package/build/utils/git.d.ts +1 -0
  49. package/build/utils/github.d.ts +2 -0
  50. package/build/utils/log.d.ts +6 -0
  51. package/build/utils/npm.d.ts +52 -0
  52. package/build/utils/obj.d.ts +1 -0
  53. package/build/utils/tar.d.ts +10 -0
  54. package/build/utils/update-check.d.ts +2 -0
  55. package/package.json +33 -21
  56. package/template/agent-files/AGENTS.md +41 -0
  57. package/template/agent-files/CLAUDE.md +1 -0
  58. package/build/517.index.js +0 -1380
@@ -0,0 +1,38 @@
1
+ /**
2
+ * The partial GitHub content type, used to filter out examples.
3
+ * @see https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28
4
+ */
5
+ export type GithubContent = {
6
+ name: string;
7
+ path: string;
8
+ type: 'file' | 'dir';
9
+ };
10
+ export type ExamplesMetadata = {
11
+ aliases: {
12
+ [key: string]: string | {
13
+ destination: string;
14
+ message?: string;
15
+ };
16
+ };
17
+ deprecated: {
18
+ [key: string]: {
19
+ outdatedExampleHref: string;
20
+ message?: string;
21
+ };
22
+ };
23
+ };
24
+ /** Fetch the metadata for the examples from https://github.com/expo/examples. This includes aliases and deprecated examples. */
25
+ export declare function fetchMetadataAsync(): Promise<ExamplesMetadata>;
26
+ export declare function ensureExampleExists(name: string): Promise<void>;
27
+ /** Ask the user which example to create */
28
+ export declare function promptExamplesAsync(): Promise<any>;
29
+ /**
30
+ * Download and move the selected example from https://github.com/expo/examples.
31
+ *
32
+ * If the example ships a `.create-expo.json`, its `renamePatterns`
33
+ * field overrides the default rename config used by the HelloWorld
34
+ * find-and-replace pass. The config file is read once and deleted from disk
35
+ * immediately so it can never leak into the user's project.
36
+ */
37
+ export declare function downloadAndExtractExampleAsync(root: string, name: string): Promise<void>;
38
+ export declare function sanitizeScriptsAsync(root: string): Promise<void>;
@@ -0,0 +1,98 @@
1
+ import ora from 'ora';
2
+ import type { PackageManagerName } from './resolvePackageManager';
3
+ export declare function isFolderNameForbidden(folderName: string): boolean;
4
+ export declare function resolvePackageModuleId(moduleId: string): {
5
+ readonly type: "repository";
6
+ readonly uri: import("url").URL;
7
+ } | {
8
+ readonly type: "file";
9
+ readonly uri: string;
10
+ } | {
11
+ readonly type: "npm";
12
+ readonly uri: string;
13
+ };
14
+ /**
15
+ * Extract a template app to a given file path and clean up any properties left over from npm to
16
+ * prepare it for usage.
17
+ *
18
+ * If the template ships a `.create-expo.json`, its `renamePatterns`
19
+ * field overrides the default rename config used by the HelloWorld
20
+ * find-and-replace pass. The config file is read once and deleted from disk
21
+ * immediately so it can never leak into the user's project.
22
+ */
23
+ export declare function extractAndPrepareTemplateAppAsync(projectRoot: string, { npmPackage }: {
24
+ npmPackage?: string | null;
25
+ }): Promise<string>;
26
+ /**
27
+ * # Background
28
+ *
29
+ * `@expo/cli` and `create-expo` extract a template from a tarball (whether from
30
+ * a local npm project or a GitHub repository), but these templates have a
31
+ * static name that needs to be updated to match whatever app name the user
32
+ * specified.
33
+ *
34
+ * By convention, the app name of all templates is "HelloWorld". During
35
+ * extraction, filepaths are transformed via `createEntryRenamer()` in
36
+ * `createFileTransform.ts`, but the contents of files are left untouched.
37
+ * Technically, the contents used to be transformed during extraction as well,
38
+ * but due to poor configurability, we've moved to a post-extraction approach.
39
+ *
40
+ * # The new approach: Renaming the app post-extraction
41
+ *
42
+ * In this new approach, we take a list of file patterns, otherwise known as the
43
+ * "rename config" to determine explicitly which files – relative to the root of
44
+ * the template – to perform find-and-replace on, to update the app name.
45
+ *
46
+ * ## The rename config
47
+ *
48
+ * The rename config can be passed directly as a string array to
49
+ * `getTemplateFilesToRenameAsync()`.
50
+ *
51
+ * The file patterns are formatted as glob expressions to be interpreted by
52
+ * [glob](https://github.com/isaacs/node-glob). Comments are supported with
53
+ * the `#` symbol, both in the plain-text file and string array formats.
54
+ * Whitespace is trimmed and whitespace-only lines are ignored.
55
+ *
56
+ * If no rename config has been passed directly to
57
+ * `getTemplateFilesToRenameAsync()`, then this default
58
+ * rename config will be used instead.
59
+ */
60
+ export declare const defaultRenameConfig: readonly ["!**/node_modules", "app.json", "android/**/*.gradle", "android/app/BUCK", "android/app/src/**/*.java", "android/app/src/**/*.kt", "android/app/src/**/*.xml", "ios/Podfile", "ios/**/*.xcodeproj/project.pbxproj", "ios/**/*.xcodeproj/xcshareddata/xcschemes/*.xcscheme", "ios/**/*.xcworkspace/contents.xcworkspacedata", "macos/Podfile", "macos/**/*.xcodeproj/project.pbxproj", "macos/**/*.xcodeproj/xcshareddata/xcschemes/*.xcscheme", "macos/**/*.xcworkspace/contents.xcworkspacedata"];
61
+ /**
62
+ * Returns a list of files within a template matched by the resolved rename
63
+ * config.
64
+ *
65
+ * The rename config is resolved in the order of preference:
66
+ * Config provided as function param > defaultRenameConfig
67
+ */
68
+ export declare function getTemplateFilesToRenameAsync({ cwd,
69
+ /**
70
+ * An array of patterns following the rename config format. If omitted, then
71
+ * we fall back to defaultRenameConfig.
72
+ * @see defaultRenameConfig
73
+ */
74
+ renameConfig: userConfig, }: {
75
+ cwd: string;
76
+ renameConfig?: string[];
77
+ }): Promise<string[]>;
78
+ export declare function renameTemplateAppNameAsync({ cwd, name, files, }: {
79
+ cwd: string;
80
+ name: string;
81
+ /**
82
+ * An array of files to transform. Usually provided by calling
83
+ * getTemplateFilesToRenameAsync().
84
+ * @see getTemplateFilesToRenameAsync
85
+ */
86
+ files: string[];
87
+ }): Promise<void>;
88
+ /**
89
+ * Sanitize a template (or example) with expected `package.json` properties and files.
90
+ */
91
+ export declare function sanitizeTemplateAsync(projectRoot: string): Promise<void>;
92
+ export declare function validateName(name?: string): string | true;
93
+ export declare function logProjectReady({ cdPath, packageManager, }: {
94
+ cdPath: string;
95
+ packageManager: PackageManagerName;
96
+ }): void;
97
+ export declare function installPodsAsync(projectRoot: string): Promise<boolean>;
98
+ export declare function logNewSection(title: string): ora.Ora;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare const asMock: <T extends (...args: any[]) => any>(fn: T) => jest.MockedFunction<T>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,41 @@
1
+ This is an Expo/React Native mobile application. Prioritize mobile-first patterns, performance, and cross-platform compatibility.
2
+
3
+ ## Expo has changed — do not trust your training data
4
+
5
+ Expo ships breaking changes every SDK release. APIs you remember are likely renamed, moved, or removed. Before writing any code that touches an Expo, EAS, or React Native API:
6
+
7
+ 1. Read the major version of the `expo` package in `package.json`.
8
+ 2. Fetch the matching versioned docs: `https://docs.expo.dev/versions/v<major>.0.0/`
9
+ 3. For anything else, fetch https://docs.expo.dev/llms.txt — an index of all Expo docs with corrections to common LLM misconceptions. Follow its links to the specific page you need; never answer from memory.
10
+
11
+ ## Commands
12
+
13
+ Use `bunx` instead of `npx` if the project uses bun (`bun.lock` present).
14
+
15
+ ```bash
16
+ npx expo install <package> # ALWAYS use instead of npm/yarn/pnpm/bun add — resolves SDK-compatible versions
17
+ npx expo start # start the dev server
18
+ npx expo lint # lint
19
+ npx tsc --noEmit # typecheck
20
+ npx expo-doctor # diagnose dependency and config issues
21
+ npx expo install --fix # fix incompatible package versions
22
+ ```
23
+
24
+ Run lint and typecheck before declaring any task done.
25
+
26
+ ## Navigation & Routing
27
+
28
+ - Use **Expo Router** for all navigation. Routes live in `src/app/` — every file there is a screen, `_layout.tsx` files define navigators. Keep non-route code (components, hooks, utils) outside `src/app/`.
29
+ - Import `Link`, `router`, and `useLocalSearchParams` from `expo-router`.
30
+ - Docs: https://docs.expo.dev/router/introduction.md
31
+
32
+ ## Building with EAS
33
+
34
+ Use EAS to build, sign, and submit the app in the cloud (`eas build`, `eas submit`) and to ship over-the-air updates (`eas update`) — no local Xcode or Android Studio required. Run EAS CLI as `bunx eas-cli <command>` in Bun projects, or `npx eas-cli@latest <command>` otherwise; substitute that for bare `eas` in docs examples.
35
+ Docs: https://docs.expo.dev/eas/index.md
36
+
37
+ ## Rules
38
+
39
+ - If `ios/` and `android/` directories do not exist, they are generated (Continuous Native Generation). Never create or edit them by hand — configure native behavior in `app.json` and config plugins.
40
+ - Expo Go only includes its bundled native modules. After adding a library with native code, the app needs a development build: `npx expo run:ios|android` locally, or `eas build --profile development`.
41
+ - Prefer recommended Expo modules over third-party libraries, and check your available skills before adding dependencies. Docs: https://docs.expo.dev/versions/latest/index.md
@@ -0,0 +1 @@
1
+ @AGENTS.md
package/build/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { PackageManagerName } from './resolvePackageManager';
2
+ export declare const PNPM_WORKSPACE_FILENAME = "pnpm-workspace.yaml";
3
+ /**
4
+ * Normalize a monorepo template's workspace-package dependency specs to the
5
+ * chosen package manager's convention, and — for pnpm — write a
6
+ * `pnpm-workspace.yaml` listing the workspace packages so they're picked up
7
+ * regardless of the root `package.json` `workspaces` field.
8
+ */
9
+ export declare function configureWorkspacesAsync(projectRoot: string, packageManager: PackageManagerName): Promise<void>;
@@ -0,0 +1,11 @@
1
+ import type { PackageManagerName } from './resolvePackageManager';
2
+ export type Options = {
3
+ install: boolean;
4
+ template?: string | true;
5
+ example?: string | true;
6
+ yes: boolean;
7
+ agentsMd: boolean;
8
+ };
9
+ export declare function setupDependenciesAsync(projectRoot: string, props: Pick<Options, 'install'>): Promise<void>;
10
+ export declare function createAsync(inputPath: string, options: Options): Promise<void>;
11
+ export declare function logNodeInstallWarning(cdPath: string, packageManager: PackageManagerName, needsPods: boolean): void;
@@ -0,0 +1,38 @@
1
+ export declare const CREATE_EXPO_CONFIG_NAME = ".create-expo.json";
2
+ /**
3
+ * Per-template configuration for customized behavior in `create-expo`.
4
+ * Templates that need any of these knobs can ship a
5
+ * `.create-expo.json` file at the template root; it is read once at
6
+ * project creation time and then deleted from the user's project so it
7
+ * doesn't leak into their repo.
8
+ */
9
+ export interface CreateExpoConfig {
10
+ /**
11
+ * Glob patterns (relative to the project root) listing extra files that
12
+ * should be passed through the `HelloWorld` find-and-replace pass during
13
+ * project creation. When present, this REPLACES the default rename config
14
+ * (see Template.ts `defaultRenameConfig`) — useful for monorepo templates
15
+ * that need to reach inside per-app paths like `apps/*\/android/**\/build.gradle`.
16
+ */
17
+ renamePatterns?: string[];
18
+ }
19
+ /**
20
+ * Read `.create-expo.json` from the project root and immediately
21
+ * delete the file from disk so it doesn't leak into the user's project.
22
+ * Returns the parsed config (or `undefined` if there's no file / it's
23
+ * malformed). This is the "use it once" entry point that template-extraction
24
+ * code paths should call — every downstream consumer takes the parsed
25
+ * object in memory.
26
+ */
27
+ export declare function consumeMonorepoConfigAsync(projectRoot: string): Promise<CreateExpoConfig | undefined>;
28
+ /**
29
+ * Reads `.create-expo.json` from the project root without touching
30
+ * the file. Returns `undefined` if the file is missing, unreadable, or
31
+ * malformed — a missing file is the common case (single-app templates) and
32
+ * shouldn't warn.
33
+ *
34
+ * Prefer `consumeMonorepoConfigAsync` for the create-expo flow so the
35
+ * template-only config doesn't leak into the user's project. This function
36
+ * stays exported for tests and any other read-only callers.
37
+ */
38
+ export declare function loadMonorepoConfigAsync(projectRoot: string): Promise<CreateExpoConfig | undefined>;
@@ -0,0 +1,5 @@
1
+ import { TarTypeFlag } from 'multitars';
2
+ import picomatch from 'picomatch';
3
+ export declare function sanitizedName(name: string): string;
4
+ export declare function createEntryRenamer(name: string): (input: string, typeflag: TarTypeFlag) => string;
5
+ export declare function createGlobFilter(globPattern: picomatch.Glob, options?: picomatch.PicomatchOptions): (path: string) => boolean;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * A custom error class that is used to surface a `process.exit` event to a higher
3
+ * level where it can be tracked through telemetry asynchronously, before exiting.
4
+ */
5
+ export declare class ExitError extends Error {
6
+ cause: string | Error;
7
+ code: number;
8
+ constructor(cause: string | Error, code: number);
9
+ }
@@ -0,0 +1 @@
1
+ export declare function generateAgentFiles(root: string): Promise<void>;
@@ -0,0 +1 @@
1
+ export {};