create-expo 5.0.0 → 5.0.1

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.
@@ -36,8 +36,8 @@ var index_min = __webpack_require__(9337);
36
36
  // EXTERNAL MODULE: ../../node_modules/.pnpm/ora@3.4.0/node_modules/ora/index.js
37
37
  var ora = __webpack_require__(5344);
38
38
  var ora_default = /*#__PURE__*/__webpack_require__.n(ora);
39
- // EXTERNAL MODULE: ../../node_modules/.pnpm/multitars@1.0.0/node_modules/multitars/dist/multitars.mjs
40
- var multitars = __webpack_require__(912);
39
+ // EXTERNAL MODULE: ../../node_modules/.pnpm/multitars@1.0.2/node_modules/multitars/dist/multitars.mjs
40
+ var multitars = __webpack_require__(6378);
41
41
  // EXTERNAL MODULE: ../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/index.js
42
42
  var picomatch = __webpack_require__(3268);
43
43
  var picomatch_default = /*#__PURE__*/__webpack_require__.n(picomatch);
@@ -424,8 +424,9 @@ async function npmPackAsync(packageName, cwd = undefined, ...props) {
424
424
  }
425
425
  try {
426
426
  const json = JSON.parse(results);
427
- if (Array.isArray(json) && json.every(isNpmPackageInfo)) {
428
- return json.map(sanitizeNpmPackageFilename);
427
+ const packages = normalizeNpmPackResult(json);
428
+ if (packages?.every(isNpmPackageInfo)) {
429
+ return packages.map(sanitizeNpmPackageFilename);
429
430
  }
430
431
  else {
431
432
  throw new Error(`Invalid response from npm: ${results}`);
@@ -435,6 +436,18 @@ async function npmPackAsync(packageName, cwd = undefined, ...props) {
435
436
  throw new Error(`Could not parse JSON returned from "${cmdString}".\n\n${results}\n\nError: ${error.message}`);
436
437
  }
437
438
  }
439
+ /** Normalize the npm pack JSON formats used before and after npm 12 */
440
+ function normalizeNpmPackResult(result) {
441
+ if (Array.isArray(result)) {
442
+ return result;
443
+ }
444
+ else if (result && typeof result === 'object') {
445
+ return Object.values(result);
446
+ }
447
+ else {
448
+ return null;
449
+ }
450
+ }
438
451
  function getNpmBin() {
439
452
  return process.platform === 'win32' ? 'npm.cmd' : 'npm';
440
453
  }
@@ -1120,51 +1133,51 @@ async function sanitizeScriptsAsync(root) {
1120
1133
  ;// CONCATENATED MODULE: ./src/generateAgentFiles.ts
1121
1134
 
1122
1135
 
1123
- function getExpoSdkVersion(root) {
1124
- try {
1125
- const pkg = JSON.parse(external_fs_default().readFileSync(external_path_default().join(root, 'package.json'), 'utf-8'));
1126
- const expoVersion = (pkg.dependencies?.expo ?? pkg.devDependencies?.expo);
1127
- if (!expoVersion)
1128
- return null;
1129
- const match = expoVersion.match(/(\d+)\./);
1130
- return match?.[1] ?? null;
1131
- }
1132
- catch {
1133
- return null;
1134
- }
1135
- }
1136
- function getAgentsMdContent(sdkVersion) {
1137
- const docsUrl = sdkVersion
1138
- ? `https://docs.expo.dev/versions/v${sdkVersion}.0.0/`
1139
- : 'https://docs.expo.dev';
1140
- return `# Expo HAS CHANGED
1141
1136
 
1142
- Read the exact versioned docs at ${docsUrl} before writing any code.
1143
- `;
1137
+ const AGENT_TEMPLATE_FILE_NAMES = (/* unused pure expression or super */ null && (['AGENTS.md', 'CLAUDE.md']));
1138
+ // Agent templates are synced from `expo/llm-configs` at publish time (see
1139
+ // `scripts/sync-agent-templates.js`) and bundled under `template/agent-files`, so project
1140
+ // creation works offline. `__dirname` is the build output directory, one level below the
1141
+ // package root in both the source tree and the published package.
1142
+ const AGENT_TEMPLATES_DIR = __webpack_require__.ab + "agent-files";
1143
+ function resolveAgentTemplatePath(fileName) {
1144
+ return __webpack_require__.ab + "agent-files/" + fileName;
1144
1145
  }
1145
- const CLAUDE_MD_CONTENT = `@AGENTS.md
1146
- `;
1147
1146
  const CLAUDE_SETTINGS_CONTENT = `{
1148
1147
  "enabledPlugins": {
1149
1148
  "expo@claude-plugins-official": true
1150
1149
  }
1151
1150
  }
1152
1151
  `;
1153
- function generateAgentFiles(root) {
1154
- const sdkVersion = getExpoSdkVersion(root);
1155
- const files = [
1156
- { filePath: external_path_default().join(root, 'AGENTS.md'), content: getAgentsMdContent(sdkVersion) },
1157
- { filePath: external_path_default().join(root, 'CLAUDE.md'), content: CLAUDE_MD_CONTENT },
1158
- { filePath: external_path_default().join(root, '.claude', 'settings.json'), content: CLAUDE_SETTINGS_CONTENT },
1152
+ function isClaudeCodeInstalled() {
1153
+ const home = external_os_default().homedir();
1154
+ return (!!home &&
1155
+ (external_fs_default().existsSync(external_path_default().join(home, '.claude.json')) || external_fs_default().existsSync(external_path_default().join(home, '.claude'))));
1156
+ }
1157
+ async function copyFileIfMissing(sourcePath, destinationPath) {
1158
+ if (external_fs_default().existsSync(destinationPath)) {
1159
+ return;
1160
+ }
1161
+ const dir = external_path_default().dirname(destinationPath);
1162
+ await external_fs_default().promises.mkdir(dir, { recursive: true });
1163
+ await external_fs_default().promises.copyFile(sourcePath, destinationPath);
1164
+ }
1165
+ async function writeFileIfMissing(filePath, content) {
1166
+ if (external_fs_default().existsSync(filePath)) {
1167
+ return;
1168
+ }
1169
+ const dir = external_path_default().dirname(filePath);
1170
+ await external_fs_default().promises.mkdir(dir, { recursive: true });
1171
+ await external_fs_default().promises.writeFile(filePath, content);
1172
+ }
1173
+ async function generateAgentFiles(root) {
1174
+ const tasks = [
1175
+ copyFileIfMissing(resolveAgentTemplatePath('AGENTS.md'), external_path_default().join(root, 'AGENTS.md')),
1159
1176
  ];
1160
- for (const { filePath, content } of files) {
1161
- if (external_fs_default().existsSync(filePath)) {
1162
- continue;
1163
- }
1164
- const dir = external_path_default().dirname(filePath);
1165
- external_fs_default().mkdirSync(dir, { recursive: true });
1166
- external_fs_default().writeFileSync(filePath, content);
1177
+ if (isClaudeCodeInstalled()) {
1178
+ tasks.push(copyFileIfMissing(resolveAgentTemplatePath('CLAUDE.md'), external_path_default().join(root, 'CLAUDE.md')), writeFileIfMissing(external_path_default().join(root, '.claude', 'settings.json'), CLAUDE_SETTINGS_CONTENT));
1167
1179
  }
1180
+ await Promise.all(tasks);
1168
1181
  }
1169
1182
 
1170
1183
  ;// CONCATENATED MODULE: ./src/promptSdkVersion.ts
@@ -1619,7 +1632,7 @@ async function createTemplateAsync(inputPath, props) {
1619
1632
  });
1620
1633
  await setupDependenciesAsync(projectRoot, props);
1621
1634
  if (props.agentsMd) {
1622
- generateAgentFiles(projectRoot);
1635
+ await generateAgentFiles(projectRoot);
1623
1636
  }
1624
1637
  // for now, we will just init a git repo if they have git installed and the
1625
1638
  // project is not inside an existing git tree, and do it silently. we should
@@ -1693,7 +1706,7 @@ async function createExampleAsync(inputPath, props) {
1693
1706
  });
1694
1707
  await setupDependenciesAsync(projectRoot, props);
1695
1708
  if (props.agentsMd) {
1696
- generateAgentFiles(projectRoot);
1709
+ await generateAgentFiles(projectRoot);
1697
1710
  }
1698
1711
  // for now, we will just init a git repo if they have git installed and the
1699
1712
  // project is not inside an existing git tree, and do it silently. we should