create-expo-module 0.8.5 → 0.8.6

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.
@@ -72,7 +72,7 @@ async function main(target, options) {
72
72
  const data = await askForSubstitutionDataAsync(slug, options.local);
73
73
  // Make one line break between prompts and progress logs
74
74
  console.log();
75
- const packageManager = await (0, resolvePackageManager_1.resolvePackageManager)();
75
+ const packageManager = (0, resolvePackageManager_1.resolvePackageManager)();
76
76
  const packagePath = options.source
77
77
  ? path_1.default.join(CWD, options.source)
78
78
  : await downloadPackageAsync(targetDir, options.local);
@@ -1 +1 @@
1
- {"version":3,"file":"create-expo-module.js","sourceRoot":"","sources":["../src/create-expo-module.ts"],"names":[],"mappings":";;;;;AAAA,oEAA2C;AAC3C,kDAA0B;AAC1B,yCAAoC;AACpC,wEAA+C;AAC/C,8CAAsB;AACtB,sDAA6B;AAC7B,wDAA0B;AAC1B,mCAAiC;AACjC,gDAAwB;AACxB,sDAA8B;AAE9B,yDAAsD;AACtD,qDAAuD;AACvD,uCAKmB;AACnB,mEAIiC;AACjC,2CAAuF;AAEvF,qCAAsC;AAEtC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,yBAAyB,CAAuB,CAAC;AAChF,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE/C,gCAAgC;AAChC,MAAM,SAAS,GAAG,IAAA,gBAAO,EAAC,WAAW,EAAE,KAAK,CAAC,CAAC;AAE9C,oFAAoF;AACpF,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;AAElD,iEAAiE;AACjE,yDAAyD;AACzD,MAAM,aAAa,GAAG;IACpB,WAAW;IACX,OAAO;IACP,cAAc;IACd,cAAc;IACd,YAAY;IACZ,YAAY;CACb,CAAC;AAEF,2CAA2C;AAC3C,MAAM,QAAQ,GAAG,+BAA+B,CAAC;AAEjD,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,CAAC;AAEhB,OAAO;KACJ,IAAI,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;IAC7B,MAAM,IAAA,8BAAkB,GAAE,CAAC,KAAK,EAAE,EAAE,CAAC;AACvC,CAAC,CAAC;KACD,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport { Command } from 'commander';\nimport downloadTarball from 'download-tarball';\nimport ejs from 'ejs';\nimport findUp from 'find-up';\nimport fs from 'fs-extra';\nimport { boolish } from 'getenv';\nimport path from 'path';\nimport prompts from 'prompts';\n\nimport { createExampleApp } from './createExampleApp';\nimport { installDependencies } from './packageManager';\nimport {\n getLocalFolderNamePrompt,\n getLocalSubstitutionDataPrompts,\n getSlugPrompt,\n getSubstitutionDataPrompts,\n} from './prompts';\nimport {\n formatRunCommand,\n PackageManagerName,\n resolvePackageManager,\n} from './resolvePackageManager';\nimport { eventCreateExpoModule, getTelemetryClient, logEventAsync } from './telemetry';\nimport { CommandOptions, LocalSubstitutionData, SubstitutionData } from './types';\nimport { newStep } from './utils/ora';\n\nconst debug = require('debug')('create-expo-module:main') as typeof console.log;\nconst packageJson = require('../package.json');\n\n// Opt in to using beta versions\nconst EXPO_BETA = boolish('EXPO_BETA', false);\n\n// `yarn run` may change the current working dir, then we should use `INIT_CWD` env.\nconst CWD = process.env.INIT_CWD || process.cwd();\n\n// Ignore some paths. Especially `package.json` as it is rendered\n// from `$package.json` file instead of the original one.\nconst IGNORES_PATHS = [\n '.DS_Store',\n 'build',\n 'node_modules',\n 'package.json',\n '.npmignore',\n '.gitignore',\n];\n\n// Url to the documentation on Expo Modules\nconst DOCS_URL = 'https://docs.expo.dev/modules';\n\nconst FYI_LOCAL_DIR = 'https://expo.fyi/expo-module-local-autolinking.md';\n\nasync function getCorrectLocalDirectory(targetOrSlug: string) {\n const packageJsonPath = await findUp('package.json', { cwd: CWD });\n if (!packageJsonPath) {\n console.log(\n chalk.red.bold(\n '⚠️ This command should be run inside your Expo project when run with the --local flag.'\n )\n );\n console.log(\n chalk.red(\n 'For native modules to autolink correctly, you need to place them in the `modules` directory in the root of the project.'\n )\n );\n return null;\n }\n return path.join(packageJsonPath, '..', 'modules', targetOrSlug);\n}\n\n/**\n * The main function of the command.\n *\n * @param target Path to the directory where to create the module. Defaults to current working dir.\n * @param command An object from `commander`.\n */\nasync function main(target: string | undefined, options: CommandOptions) {\n if (options.local) {\n console.log();\n console.log(\n `${chalk.gray('The local module will be created in the ')}${chalk.gray.bold.italic(\n 'modules'\n )} ${chalk.gray('directory in the root of your project. Learn more: ')}${chalk.gray.bold(\n FYI_LOCAL_DIR\n )}`\n );\n console.log();\n }\n const slug = await askForPackageSlugAsync(target, options.local);\n const targetDir = options.local\n ? await getCorrectLocalDirectory(target || slug)\n : path.join(CWD, target || slug);\n\n if (!targetDir) {\n return;\n }\n await fs.ensureDir(targetDir);\n await confirmTargetDirAsync(targetDir);\n\n options.target = targetDir;\n\n const data = await askForSubstitutionDataAsync(slug, options.local);\n\n // Make one line break between prompts and progress logs\n console.log();\n\n const packageManager = await resolvePackageManager();\n const packagePath = options.source\n ? path.join(CWD, options.source)\n : await downloadPackageAsync(targetDir, options.local);\n\n logEventAsync(eventCreateExpoModule(packageManager, options));\n\n await newStep('Creating the module from template files', async (step) => {\n await createModuleFromTemplate(packagePath, targetDir, data);\n step.succeed('Created the module from template files');\n });\n if (!options.local) {\n await newStep('Installing module dependencies', async (step) => {\n await installDependencies(packageManager, targetDir);\n step.succeed('Installed module dependencies');\n });\n await newStep('Compiling TypeScript files', async (step) => {\n await spawnAsync(packageManager, ['run', 'build'], {\n cwd: targetDir,\n stdio: 'ignore',\n });\n step.succeed('Compiled TypeScript files');\n });\n }\n\n if (!options.source) {\n // Files in the downloaded tarball are wrapped in `package` dir.\n // We should remove it after all.\n await fs.remove(packagePath);\n }\n if (!options.local && data.type !== 'local') {\n if (!options.withReadme) {\n await fs.remove(path.join(targetDir, 'README.md'));\n }\n if (!options.withChangelog) {\n await fs.remove(path.join(targetDir, 'CHANGELOG.md'));\n }\n if (options.example) {\n // Create \"example\" folder\n await createExampleApp(data, targetDir, packageManager);\n }\n\n await newStep('Creating an empty Git repository', async (step) => {\n try {\n const result = await createGitRepositoryAsync(targetDir);\n if (result) {\n step.succeed('Created an empty Git repository');\n } else if (result === null) {\n step.succeed('Skipped creating an empty Git repository, already within a Git repository');\n } else if (result === false) {\n step.warn(\n 'Could not create an empty Git repository, see debug logs with EXPO_DEBUG=true'\n );\n }\n } catch (e: any) {\n step.fail(e.toString());\n }\n });\n }\n\n console.log();\n if (options.local) {\n console.log(`✅ Successfully created Expo module in ${chalk.bold.italic(`modules/${slug}`)}`);\n printFurtherLocalInstructions(slug, data.project.moduleName);\n } else {\n console.log('✅ Successfully created Expo module');\n printFurtherInstructions(targetDir, packageManager, options.example);\n }\n}\n\n/**\n * Recursively scans for the files within the directory. Returned paths are relative to the `root` path.\n */\nasync function getFilesAsync(root: string, dir: string | null = null): Promise<string[]> {\n const files: string[] = [];\n const baseDir = dir ? path.join(root, dir) : root;\n\n for (const file of await fs.readdir(baseDir)) {\n const relativePath = dir ? path.join(dir, file) : file;\n\n if (IGNORES_PATHS.includes(relativePath) || IGNORES_PATHS.includes(file)) {\n continue;\n }\n\n const fullPath = path.join(baseDir, file);\n const stat = await fs.lstat(fullPath);\n\n if (stat.isDirectory()) {\n files.push(...(await getFilesAsync(root, relativePath)));\n } else {\n files.push(relativePath);\n }\n }\n return files;\n}\n\n/**\n * Asks NPM registry for the url to the tarball.\n */\nasync function getNpmTarballUrl(packageName: string, version: string = 'latest'): Promise<string> {\n debug(`Using module template ${chalk.bold(packageName)}@${chalk.bold(version)}`);\n const { stdout } = await spawnAsync('npm', ['view', `${packageName}@${version}`, 'dist.tarball']);\n return stdout.trim();\n}\n\n/**\n * Gets expo SDK version major from the local package.json.\n */\nasync function getLocalSdkMajorVersion(): Promise<string | null> {\n const path = require.resolve('expo/package.json', { paths: [process.cwd()] });\n if (!path) {\n return null;\n }\n const { version } = require(path) ?? {};\n return version?.split('.')[0] ?? null;\n}\n\n/**\n * Selects correct version of the template based on the SDK version for local modules and EXPO_BETA flag.\n */\nasync function getTemplateVersion(isLocal: boolean) {\n if (EXPO_BETA) {\n return 'next';\n }\n if (!isLocal) {\n return 'latest';\n }\n try {\n const sdkVersionMajor = await getLocalSdkMajorVersion();\n return sdkVersionMajor ? `sdk-${sdkVersionMajor}` : 'latest';\n } catch {\n console.log();\n console.warn(\n chalk.yellow(\n \"Couldn't determine the SDK version from the local project, using `latest` as the template version.\"\n )\n );\n return 'latest';\n }\n}\n\n/**\n * Downloads the template from NPM registry.\n */\nasync function downloadPackageAsync(targetDir: string, isLocal = false): Promise<string> {\n return await newStep('Downloading module template from npm', async (step) => {\n const templateVersion = await getTemplateVersion(isLocal);\n let tarballUrl: string | null = null;\n try {\n tarballUrl = await getNpmTarballUrl(\n isLocal ? 'expo-module-template-local' : 'expo-module-template',\n templateVersion\n );\n } catch {\n console.log();\n console.warn(\n chalk.yellow(\n \"Couldn't download the versioned template from npm, falling back to the latest version.\"\n )\n );\n tarballUrl = await getNpmTarballUrl(\n isLocal ? 'expo-module-template-local' : 'expo-module-template',\n 'latest'\n );\n }\n\n await downloadTarball({\n url: tarballUrl,\n dir: targetDir,\n });\n\n step.succeed('Downloaded module template from npm');\n\n return path.join(targetDir, 'package');\n });\n}\n\nfunction handleSuffix(name: string, suffix: string): string {\n if (name.endsWith(suffix)) {\n return name;\n }\n return `${name}${suffix}`;\n}\n\n/**\n * Creates the module based on the `ejs` template (e.g. `expo-module-template` package).\n */\nasync function createModuleFromTemplate(\n templatePath: string,\n targetPath: string,\n data: SubstitutionData | LocalSubstitutionData\n) {\n const files = await getFilesAsync(templatePath);\n\n // Iterate through all template files.\n for (const file of files) {\n const renderedRelativePath = ejs.render(file.replace(/^\\$/, ''), data, {\n openDelimiter: '{',\n closeDelimiter: '}',\n escape: (value: string) => value.replace(/\\./g, path.sep),\n });\n const fromPath = path.join(templatePath, file);\n const toPath = path.join(targetPath, renderedRelativePath);\n const template = await fs.readFile(fromPath, { encoding: 'utf8' });\n const renderedContent = ejs.render(template, data);\n\n await fs.outputFile(toPath, renderedContent, { encoding: 'utf8' });\n }\n}\n\nasync function createGitRepositoryAsync(targetDir: string) {\n // Check if we are inside a git repository already\n try {\n await spawnAsync('git', ['rev-parse', '--is-inside-work-tree'], {\n stdio: 'ignore',\n cwd: targetDir,\n });\n debug(chalk.dim('New project is already inside of a Git repo, skipping git init.'));\n return null;\n } catch (e: any) {\n if (e.errno === 'ENOENT') {\n debug(chalk.dim('Unable to initialize Git repo. `git` not in $PATH.'));\n return false;\n }\n }\n\n // Create a new git repository\n await spawnAsync('git', ['init'], { stdio: 'ignore', cwd: targetDir });\n await spawnAsync('git', ['add', '-A'], { stdio: 'ignore', cwd: targetDir });\n\n const commitMsg = `Initial commit\\n\\nGenerated by ${packageJson.name} ${packageJson.version}.`;\n await spawnAsync('git', ['commit', '-m', commitMsg], {\n stdio: 'ignore',\n cwd: targetDir,\n });\n\n debug(chalk.dim('Initialized a Git repository.'));\n return true;\n}\n\n/**\n * Asks the user for the package slug (npm package name).\n */\nasync function askForPackageSlugAsync(customTargetPath?: string, isLocal = false): Promise<string> {\n const { slug } = await prompts(\n (isLocal ? getLocalFolderNamePrompt : getSlugPrompt)(customTargetPath),\n {\n onCancel: () => process.exit(0),\n }\n );\n return slug;\n}\n\n/**\n * Asks the user for some data necessary to render the template.\n * Some values may already be provided by command options, the prompt is skipped in that case.\n */\nasync function askForSubstitutionDataAsync(\n slug: string,\n isLocal = false\n): Promise<SubstitutionData | LocalSubstitutionData> {\n const promptQueries = await (\n isLocal ? getLocalSubstitutionDataPrompts : getSubstitutionDataPrompts\n )(slug);\n\n // Stop the process when the user cancels/exits the prompt.\n const onCancel = () => {\n process.exit(0);\n };\n\n const {\n name,\n description,\n package: projectPackage,\n authorName,\n authorEmail,\n authorUrl,\n repo,\n } = await prompts(promptQueries, { onCancel });\n\n if (isLocal) {\n return {\n project: {\n slug,\n name,\n package: projectPackage,\n moduleName: handleSuffix(name, 'Module'),\n viewName: handleSuffix(name, 'View'),\n },\n type: 'local',\n };\n }\n\n return {\n project: {\n slug,\n name,\n version: '0.1.0',\n description,\n package: projectPackage,\n moduleName: handleSuffix(name, 'Module'),\n viewName: handleSuffix(name, 'View'),\n },\n author: `${authorName} <${authorEmail}> (${authorUrl})`,\n license: 'MIT',\n repo,\n type: 'remote',\n };\n}\n\n/**\n * Checks whether the target directory is empty and if not, asks the user to confirm if he wants to continue.\n */\nasync function confirmTargetDirAsync(targetDir: string): Promise<void> {\n const files = await fs.readdir(targetDir);\n\n if (files.length === 0) {\n return;\n }\n const { shouldContinue } = await prompts(\n {\n type: 'confirm',\n name: 'shouldContinue',\n message: `The target directory ${chalk.magenta(\n targetDir\n )} is not empty, do you want to continue anyway?`,\n initial: true,\n },\n {\n onCancel: () => false,\n }\n );\n if (!shouldContinue) {\n process.exit(0);\n }\n}\n\n/**\n * Prints how the user can follow up once the script finishes creating the module.\n */\nfunction printFurtherInstructions(\n targetDir: string,\n packageManager: PackageManagerName,\n includesExample: boolean\n) {\n if (includesExample) {\n const commands = [\n `cd ${path.relative(CWD, targetDir)}`,\n formatRunCommand(packageManager, 'open:ios'),\n formatRunCommand(packageManager, 'open:android'),\n ];\n\n console.log();\n console.log(\n 'To start developing your module, navigate to the directory and open iOS and Android projects of the example app'\n );\n commands.forEach((command) => console.log(chalk.gray('>'), chalk.bold(command)));\n console.log();\n }\n console.log(`Learn more on Expo Modules APIs: ${chalk.blue.bold(DOCS_URL)}`);\n}\n\nfunction printFurtherLocalInstructions(slug: string, name: string) {\n console.log();\n console.log(`You can now import this module inside your application.`);\n console.log(`For example, you can add this line to your App.js or App.tsx file:`);\n console.log(`${chalk.gray.italic(`import ${name} './modules/${slug}';`)}`);\n console.log();\n console.log(`Learn more on Expo Modules APIs: ${chalk.blue.bold(DOCS_URL)}`);\n console.log(\n chalk.yellow(\n `Remember to re-build your native app (for example, with ${chalk.bold('npx expo run')}) when you make changes to the module. Native code changes are not reloaded with Fast Refresh.`\n )\n );\n}\n\nconst program = new Command();\n\nprogram\n .name(packageJson.name)\n .version(packageJson.version)\n .description(packageJson.description)\n .arguments('[path]')\n .option(\n '-s, --source <source_dir>',\n 'Local path to the template. By default it downloads `expo-module-template` from NPM.'\n )\n .option('--with-readme', 'Whether to include README.md file.', false)\n .option('--with-changelog', 'Whether to include CHANGELOG.md file.', false)\n .option('--no-example', 'Whether to skip creating the example app.', false)\n .option(\n '--local',\n 'Whether to create a local module in the current project, skipping installing node_modules and creating the example directory.',\n false\n )\n .action(main);\n\nprogram\n .hook('postAction', async () => {\n await getTelemetryClient().flush?.();\n })\n .parse(process.argv);\n"]}
1
+ {"version":3,"file":"create-expo-module.js","sourceRoot":"","sources":["../src/create-expo-module.ts"],"names":[],"mappings":";;;;;AAAA,oEAA2C;AAC3C,kDAA0B;AAC1B,yCAAoC;AACpC,wEAA+C;AAC/C,8CAAsB;AACtB,sDAA6B;AAC7B,wDAA0B;AAC1B,mCAAiC;AACjC,gDAAwB;AACxB,sDAA8B;AAE9B,yDAAsD;AACtD,qDAAuD;AACvD,uCAKmB;AACnB,mEAIiC;AACjC,2CAAuF;AAEvF,qCAAsC;AAEtC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,yBAAyB,CAAuB,CAAC;AAChF,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE/C,gCAAgC;AAChC,MAAM,SAAS,GAAG,IAAA,gBAAO,EAAC,WAAW,EAAE,KAAK,CAAC,CAAC;AAE9C,oFAAoF;AACpF,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;AAElD,iEAAiE;AACjE,yDAAyD;AACzD,MAAM,aAAa,GAAG;IACpB,WAAW;IACX,OAAO;IACP,cAAc;IACd,cAAc;IACd,YAA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KAC1E,MAAM,CACL,SAAS,EACT,+HAA+H,EAC/H,KAAK,CACN;KACA,MAAM,CAAC,IAAI,CAAC,CAAC;AAEhB,OAAO;KACJ,IAAI,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;IAC7B,MAAM,IAAA,8BAAkB,GAAE,CAAC,KAAK,EAAE,EAAE,CAAC;AACvC,CAAC,CAAC;KACD,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport { Command } from 'commander';\nimport downloadTarball from 'download-tarball';\nimport ejs from 'ejs';\nimport findUp from 'find-up';\nimport fs from 'fs-extra';\nimport { boolish } from 'getenv';\nimport path from 'path';\nimport prompts from 'prompts';\n\nimport { createExampleApp } from './createExampleApp';\nimport { installDependencies } from './packageManager';\nimport {\n getLocalFolderNamePrompt,\n getLocalSubstitutionDataPrompts,\n getSlugPrompt,\n getSubstitutionDataPrompts,\n} from './prompts';\nimport {\n formatRunCommand,\n PackageManagerName,\n resolvePackageManager,\n} from './resolvePackageManager';\nimport { eventCreateExpoModule, getTelemetryClient, logEventAsync } from './telemetry';\nimport { CommandOptions, LocalSubstitutionData, SubstitutionData } from './types';\nimport { newStep } from './utils/ora';\n\nconst debug = require('debug')('create-expo-module:main') as typeof console.log;\nconst packageJson = require('../package.json');\n\n// Opt in to using beta versions\nconst EXPO_BETA = boolish('EXPO_BETA', false);\n\n// `yarn run` may change the current working dir, then we should use `INIT_CWD` env.\nconst CWD = process.env.INIT_CWD || process.cwd();\n\n// Ignore some paths. Especially `package.json` as it is rendered\n// from `$package.json` file instead of the original one.\nconst IGNORES_PATHS = [\n '.DS_Store',\n 'build',\n 'node_modules',\n 'package.json',\n '.npmignore',\n '.gitignore',\n];\n\n// Url to the documentation on Expo Modules\nconst DOCS_URL = 'https://docs.expo.dev/modules';\n\nconst FYI_LOCAL_DIR = 'https://expo.fyi/expo-module-local-autolinking.md';\n\nasync function getCorrectLocalDirectory(targetOrSlug: string) {\n const packageJsonPath = await findUp('package.json', { cwd: CWD });\n if (!packageJsonPath) {\n console.log(\n chalk.red.bold(\n '⚠️ This command should be run inside your Expo project when run with the --local flag.'\n )\n );\n console.log(\n chalk.red(\n 'For native modules to autolink correctly, you need to place them in the `modules` directory in the root of the project.'\n )\n );\n return null;\n }\n return path.join(packageJsonPath, '..', 'modules', targetOrSlug);\n}\n\n/**\n * The main function of the command.\n *\n * @param target Path to the directory where to create the module. Defaults to current working dir.\n * @param command An object from `commander`.\n */\nasync function main(target: string | undefined, options: CommandOptions) {\n if (options.local) {\n console.log();\n console.log(\n `${chalk.gray('The local module will be created in the ')}${chalk.gray.bold.italic(\n 'modules'\n )} ${chalk.gray('directory in the root of your project. Learn more: ')}${chalk.gray.bold(\n FYI_LOCAL_DIR\n )}`\n );\n console.log();\n }\n const slug = await askForPackageSlugAsync(target, options.local);\n const targetDir = options.local\n ? await getCorrectLocalDirectory(target || slug)\n : path.join(CWD, target || slug);\n\n if (!targetDir) {\n return;\n }\n await fs.ensureDir(targetDir);\n await confirmTargetDirAsync(targetDir);\n\n options.target = targetDir;\n\n const data = await askForSubstitutionDataAsync(slug, options.local);\n\n // Make one line break between prompts and progress logs\n console.log();\n\n const packageManager = resolvePackageManager();\n const packagePath = options.source\n ? path.join(CWD, options.source)\n : await downloadPackageAsync(targetDir, options.local);\n\n logEventAsync(eventCreateExpoModule(packageManager, options));\n\n await newStep('Creating the module from template files', async (step) => {\n await createModuleFromTemplate(packagePath, targetDir, data);\n step.succeed('Created the module from template files');\n });\n if (!options.local) {\n await newStep('Installing module dependencies', async (step) => {\n await installDependencies(packageManager, targetDir);\n step.succeed('Installed module dependencies');\n });\n await newStep('Compiling TypeScript files', async (step) => {\n await spawnAsync(packageManager, ['run', 'build'], {\n cwd: targetDir,\n stdio: 'ignore',\n });\n step.succeed('Compiled TypeScript files');\n });\n }\n\n if (!options.source) {\n // Files in the downloaded tarball are wrapped in `package` dir.\n // We should remove it after all.\n await fs.remove(packagePath);\n }\n if (!options.local && data.type !== 'local') {\n if (!options.withReadme) {\n await fs.remove(path.join(targetDir, 'README.md'));\n }\n if (!options.withChangelog) {\n await fs.remove(path.join(targetDir, 'CHANGELOG.md'));\n }\n if (options.example) {\n // Create \"example\" folder\n await createExampleApp(data, targetDir, packageManager);\n }\n\n await newStep('Creating an empty Git repository', async (step) => {\n try {\n const result = await createGitRepositoryAsync(targetDir);\n if (result) {\n step.succeed('Created an empty Git repository');\n } else if (result === null) {\n step.succeed('Skipped creating an empty Git repository, already within a Git repository');\n } else if (result === false) {\n step.warn(\n 'Could not create an empty Git repository, see debug logs with EXPO_DEBUG=true'\n );\n }\n } catch (e: any) {\n step.fail(e.toString());\n }\n });\n }\n\n console.log();\n if (options.local) {\n console.log(`✅ Successfully created Expo module in ${chalk.bold.italic(`modules/${slug}`)}`);\n printFurtherLocalInstructions(slug, data.project.moduleName);\n } else {\n console.log('✅ Successfully created Expo module');\n printFurtherInstructions(targetDir, packageManager, options.example);\n }\n}\n\n/**\n * Recursively scans for the files within the directory. Returned paths are relative to the `root` path.\n */\nasync function getFilesAsync(root: string, dir: string | null = null): Promise<string[]> {\n const files: string[] = [];\n const baseDir = dir ? path.join(root, dir) : root;\n\n for (const file of await fs.readdir(baseDir)) {\n const relativePath = dir ? path.join(dir, file) : file;\n\n if (IGNORES_PATHS.includes(relativePath) || IGNORES_PATHS.includes(file)) {\n continue;\n }\n\n const fullPath = path.join(baseDir, file);\n const stat = await fs.lstat(fullPath);\n\n if (stat.isDirectory()) {\n files.push(...(await getFilesAsync(root, relativePath)));\n } else {\n files.push(relativePath);\n }\n }\n return files;\n}\n\n/**\n * Asks NPM registry for the url to the tarball.\n */\nasync function getNpmTarballUrl(packageName: string, version: string = 'latest'): Promise<string> {\n debug(`Using module template ${chalk.bold(packageName)}@${chalk.bold(version)}`);\n const { stdout } = await spawnAsync('npm', ['view', `${packageName}@${version}`, 'dist.tarball']);\n return stdout.trim();\n}\n\n/**\n * Gets expo SDK version major from the local package.json.\n */\nasync function getLocalSdkMajorVersion(): Promise<string | null> {\n const path = require.resolve('expo/package.json', { paths: [process.cwd()] });\n if (!path) {\n return null;\n }\n const { version } = require(path) ?? {};\n return version?.split('.')[0] ?? null;\n}\n\n/**\n * Selects correct version of the template based on the SDK version for local modules and EXPO_BETA flag.\n */\nasync function getTemplateVersion(isLocal: boolean) {\n if (EXPO_BETA) {\n return 'next';\n }\n if (!isLocal) {\n return 'latest';\n }\n try {\n const sdkVersionMajor = await getLocalSdkMajorVersion();\n return sdkVersionMajor ? `sdk-${sdkVersionMajor}` : 'latest';\n } catch {\n console.log();\n console.warn(\n chalk.yellow(\n \"Couldn't determine the SDK version from the local project, using `latest` as the template version.\"\n )\n );\n return 'latest';\n }\n}\n\n/**\n * Downloads the template from NPM registry.\n */\nasync function downloadPackageAsync(targetDir: string, isLocal = false): Promise<string> {\n return await newStep('Downloading module template from npm', async (step) => {\n const templateVersion = await getTemplateVersion(isLocal);\n let tarballUrl: string | null = null;\n try {\n tarballUrl = await getNpmTarballUrl(\n isLocal ? 'expo-module-template-local' : 'expo-module-template',\n templateVersion\n );\n } catch {\n console.log();\n console.warn(\n chalk.yellow(\n \"Couldn't download the versioned template from npm, falling back to the latest version.\"\n )\n );\n tarballUrl = await getNpmTarballUrl(\n isLocal ? 'expo-module-template-local' : 'expo-module-template',\n 'latest'\n );\n }\n\n await downloadTarball({\n url: tarballUrl,\n dir: targetDir,\n });\n\n step.succeed('Downloaded module template from npm');\n\n return path.join(targetDir, 'package');\n });\n}\n\nfunction handleSuffix(name: string, suffix: string): string {\n if (name.endsWith(suffix)) {\n return name;\n }\n return `${name}${suffix}`;\n}\n\n/**\n * Creates the module based on the `ejs` template (e.g. `expo-module-template` package).\n */\nasync function createModuleFromTemplate(\n templatePath: string,\n targetPath: string,\n data: SubstitutionData | LocalSubstitutionData\n) {\n const files = await getFilesAsync(templatePath);\n\n // Iterate through all template files.\n for (const file of files) {\n const renderedRelativePath = ejs.render(file.replace(/^\\$/, ''), data, {\n openDelimiter: '{',\n closeDelimiter: '}',\n escape: (value: string) => value.replace(/\\./g, path.sep),\n });\n const fromPath = path.join(templatePath, file);\n const toPath = path.join(targetPath, renderedRelativePath);\n const template = await fs.readFile(fromPath, { encoding: 'utf8' });\n const renderedContent = ejs.render(template, data);\n\n await fs.outputFile(toPath, renderedContent, { encoding: 'utf8' });\n }\n}\n\nasync function createGitRepositoryAsync(targetDir: string) {\n // Check if we are inside a git repository already\n try {\n await spawnAsync('git', ['rev-parse', '--is-inside-work-tree'], {\n stdio: 'ignore',\n cwd: targetDir,\n });\n debug(chalk.dim('New project is already inside of a Git repo, skipping git init.'));\n return null;\n } catch (e: any) {\n if (e.errno === 'ENOENT') {\n debug(chalk.dim('Unable to initialize Git repo. `git` not in $PATH.'));\n return false;\n }\n }\n\n // Create a new git repository\n await spawnAsync('git', ['init'], { stdio: 'ignore', cwd: targetDir });\n await spawnAsync('git', ['add', '-A'], { stdio: 'ignore', cwd: targetDir });\n\n const commitMsg = `Initial commit\\n\\nGenerated by ${packageJson.name} ${packageJson.version}.`;\n await spawnAsync('git', ['commit', '-m', commitMsg], {\n stdio: 'ignore',\n cwd: targetDir,\n });\n\n debug(chalk.dim('Initialized a Git repository.'));\n return true;\n}\n\n/**\n * Asks the user for the package slug (npm package name).\n */\nasync function askForPackageSlugAsync(customTargetPath?: string, isLocal = false): Promise<string> {\n const { slug } = await prompts(\n (isLocal ? getLocalFolderNamePrompt : getSlugPrompt)(customTargetPath),\n {\n onCancel: () => process.exit(0),\n }\n );\n return slug;\n}\n\n/**\n * Asks the user for some data necessary to render the template.\n * Some values may already be provided by command options, the prompt is skipped in that case.\n */\nasync function askForSubstitutionDataAsync(\n slug: string,\n isLocal = false\n): Promise<SubstitutionData | LocalSubstitutionData> {\n const promptQueries = await (\n isLocal ? getLocalSubstitutionDataPrompts : getSubstitutionDataPrompts\n )(slug);\n\n // Stop the process when the user cancels/exits the prompt.\n const onCancel = () => {\n process.exit(0);\n };\n\n const {\n name,\n description,\n package: projectPackage,\n authorName,\n authorEmail,\n authorUrl,\n repo,\n } = await prompts(promptQueries, { onCancel });\n\n if (isLocal) {\n return {\n project: {\n slug,\n name,\n package: projectPackage,\n moduleName: handleSuffix(name, 'Module'),\n viewName: handleSuffix(name, 'View'),\n },\n type: 'local',\n };\n }\n\n return {\n project: {\n slug,\n name,\n version: '0.1.0',\n description,\n package: projectPackage,\n moduleName: handleSuffix(name, 'Module'),\n viewName: handleSuffix(name, 'View'),\n },\n author: `${authorName} <${authorEmail}> (${authorUrl})`,\n license: 'MIT',\n repo,\n type: 'remote',\n };\n}\n\n/**\n * Checks whether the target directory is empty and if not, asks the user to confirm if he wants to continue.\n */\nasync function confirmTargetDirAsync(targetDir: string): Promise<void> {\n const files = await fs.readdir(targetDir);\n\n if (files.length === 0) {\n return;\n }\n const { shouldContinue } = await prompts(\n {\n type: 'confirm',\n name: 'shouldContinue',\n message: `The target directory ${chalk.magenta(\n targetDir\n )} is not empty, do you want to continue anyway?`,\n initial: true,\n },\n {\n onCancel: () => false,\n }\n );\n if (!shouldContinue) {\n process.exit(0);\n }\n}\n\n/**\n * Prints how the user can follow up once the script finishes creating the module.\n */\nfunction printFurtherInstructions(\n targetDir: string,\n packageManager: PackageManagerName,\n includesExample: boolean\n) {\n if (includesExample) {\n const commands = [\n `cd ${path.relative(CWD, targetDir)}`,\n formatRunCommand(packageManager, 'open:ios'),\n formatRunCommand(packageManager, 'open:android'),\n ];\n\n console.log();\n console.log(\n 'To start developing your module, navigate to the directory and open iOS and Android projects of the example app'\n );\n commands.forEach((command) => console.log(chalk.gray('>'), chalk.bold(command)));\n console.log();\n }\n console.log(`Learn more on Expo Modules APIs: ${chalk.blue.bold(DOCS_URL)}`);\n}\n\nfunction printFurtherLocalInstructions(slug: string, name: string) {\n console.log();\n console.log(`You can now import this module inside your application.`);\n console.log(`For example, you can add this line to your App.js or App.tsx file:`);\n console.log(`${chalk.gray.italic(`import ${name} './modules/${slug}';`)}`);\n console.log();\n console.log(`Learn more on Expo Modules APIs: ${chalk.blue.bold(DOCS_URL)}`);\n console.log(\n chalk.yellow(\n `Remember to re-build your native app (for example, with ${chalk.bold('npx expo run')}) when you make changes to the module. Native code changes are not reloaded with Fast Refresh.`\n )\n );\n}\n\nconst program = new Command();\n\nprogram\n .name(packageJson.name)\n .version(packageJson.version)\n .description(packageJson.description)\n .arguments('[path]')\n .option(\n '-s, --source <source_dir>',\n 'Local path to the template. By default it downloads `expo-module-template` from NPM.'\n )\n .option('--with-readme', 'Whether to include README.md file.', false)\n .option('--with-changelog', 'Whether to include CHANGELOG.md file.', false)\n .option('--no-example', 'Whether to skip creating the example app.', false)\n .option(\n '--local',\n 'Whether to create a local module in the current project, skipping installing node_modules and creating the example directory.',\n false\n )\n .action(main);\n\nprogram\n .hook('postAction', async () => {\n await getTelemetryClient().flush?.();\n })\n .parse(process.argv);\n"]}
@@ -33,15 +33,7 @@ async function createExampleApp(data, targetDir, packageManager) {
33
33
  const templateVersion = EXPO_BETA ? 'next' : 'latest';
34
34
  const template = `expo-template-blank-typescript@${templateVersion}`;
35
35
  debug(`Using example template: ${template}`);
36
- const command = [
37
- 'create',
38
- 'expo-app',
39
- '--',
40
- exampleProjectSlug,
41
- '--template',
42
- template,
43
- '--yes',
44
- ];
36
+ const command = createCommand(packageManager, exampleProjectSlug, template);
45
37
  try {
46
38
  await (0, spawn_async_1.default)(packageManager, command, {
47
39
  cwd: targetDir,
@@ -80,6 +72,13 @@ async function createExampleApp(data, targetDir, packageManager) {
80
72
  });
81
73
  }
82
74
  exports.createExampleApp = createExampleApp;
75
+ function createCommand(packageManager, exampleProjectSlug, template) {
76
+ const command = ['create', 'expo-app'];
77
+ if (packageManager === 'npm') {
78
+ command.push('--');
79
+ }
80
+ return command.concat([exampleProjectSlug, '--template', template, '--yes']);
81
+ }
83
82
  /**
84
83
  * Copies files from one directory to another.
85
84
  */
@@ -1 +1 @@
1
- {"version":3,"file":"createExampleApp.js","sourceRoot":"","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AM,IAAA,qBAAU,EAAC,KAAK,EAAE,CAAC,SAAS,CAAC,EAAE;QACnC,GAAG,EAAE,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC;QAC9B,KAAK,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC;KACpC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport fs from 'fs-extra';\nimport getenv from 'getenv';\nimport os from 'os';\nimport path from 'path';\n\nimport { installDependencies } from './packageManager';\nimport { PackageManagerName } from './resolvePackageManager';\nimport { SubstitutionData } from './types';\nimport { newStep } from './utils/ora';\n\nconst debug = require('debug')('create-expo-module:createExampleApp') as typeof console.log;\n\n// These dependencies will be removed from the example app (`expo init` adds them)\nconst DEPENDENCIES_TO_REMOVE = ['expo-status-bar', 'expo-splash-screen'];\nconst EXPO_BETA = getenv.boolish('EXPO_BETA', false);\n\n/**\n * Initializes a new Expo project as an example app.\n */\nexport async function createExampleApp(\n data: SubstitutionData,\n targetDir: string,\n packageManager: PackageManagerName\n): Promise<void> {\n // Package name for the example app\n const exampleProjectSlug = `${data.project.slug}-example`;\n\n // `expo init` creates a new folder with the same name as the project slug\n const appTmpPath = path.join(targetDir, exampleProjectSlug);\n\n // Path to the target example dir\n const appTargetPath = path.join(targetDir, 'example');\n\n if (!(await fs.pathExists(appTargetPath))) {\n // The template doesn't include the example app, so just skip this phase\n return;\n }\n\n await newStep('Initializing the example app', async (step) => {\n const templateVersion = EXPO_BETA ? 'next' : 'latest';\n const template = `expo-template-blank-typescript@${templateVersion}`;\n debug(`Using example template: ${template}`);\n const command = [\n 'create',\n 'expo-app',\n '--',\n exampleProjectSlug,\n '--template',\n template,\n '--yes',\n ];\n try {\n await spawnAsync(packageManager, command, {\n cwd: targetDir,\n });\n } catch (error: any) {\n throw new Error(\n `${command.join(' ')} failed with exit code: ${error?.status}.\\n\\nError stack:\\n${error?.stderr}`\n );\n }\n\n step.succeed('Initialized the example app');\n });\n\n await newStep('Configuring the example app', async (step) => {\n // \"example\" folder already exists and contains template files,\n // that should replace these created by `expo init`.\n await moveFiles(appTargetPath, appTmpPath);\n\n // Cleanup the \"example\" dir\n await fs.rmdir(appTargetPath);\n\n // Clean up the \".git\" from example app\n // note, this directory has contents, rmdir will throw\n await fs.remove(path.join(appTmpPath, '.git'));\n\n // Move the temporary example app to \"example\" dir\n await fs.rename(appTmpPath, appTargetPath);\n\n await addMissingAppConfigFields(appTargetPath, data);\n\n step.succeed('Configured the example app');\n });\n\n await prebuildExampleApp(appTargetPath);\n\n await modifyPackageJson(appTargetPath);\n\n await newStep('Installing dependencies in the example app', async (step) => {\n await installDependencies(packageManager, appTargetPath);\n if (os.platform() === 'darwin') {\n await podInstall(appTargetPath);\n step.succeed('Installed dependencies in the example app');\n } else {\n step.succeed('Installed dependencies in the example app (skipped installing CocoaPods)');\n }\n });\n}\n\n/**\n * Copies files from one directory to another.\n */\nasync function moveFiles(fromPath: string, toPath: string): Promise<void> {\n for (const file of await fs.readdir(fromPath)) {\n await fs.move(path.join(fromPath, file), path.join(toPath, file), {\n overwrite: true,\n });\n }\n}\n\n/**\n * Adds missing configuration that are required to run `npx expo prebuild`.\n */\nasync function addMissingAppConfigFields(appPath: string, data: SubstitutionData): Promise<void> {\n const appConfigPath = path.join(appPath, 'app.json');\n const appConfig = await fs.readJson(appConfigPath);\n const appId = `${data.project.package}.example`;\n\n // Android package name needs to be added to app.json\n if (!appConfig.expo.android) {\n appConfig.expo.android = {};\n }\n appConfig.expo.android.package = appId;\n\n // Specify iOS bundle identifier\n if (!appConfig.expo.ios) {\n appConfig.expo.ios = {};\n }\n appConfig.expo.ios.bundleIdentifier = appId;\n\n await fs.writeJson(appConfigPath, appConfig, {\n spaces: 2,\n });\n}\n\n/**\n * Applies necessary changes to **package.json** of the example app.\n * It means setting the autolinking config and removing unnecessary dependencies.\n */\nasync function modifyPackageJson(appPath: string): Promise<void> {\n const packageJsonPath = path.join(appPath, 'package.json');\n const packageJson = await fs.readJson(packageJsonPath);\n\n if (!packageJson.expo) {\n packageJson.expo = {};\n }\n\n // Set the native modules dir to the root folder,\n // so that the autolinking can detect and link the module.\n packageJson.expo.autolinking = {\n nativeModulesDir: '..',\n };\n\n // Remove unnecessary dependencies\n for (const dependencyToRemove of DEPENDENCIES_TO_REMOVE) {\n delete packageJson.dependencies[dependencyToRemove];\n }\n\n await fs.writeJson(packageJsonPath, packageJson, {\n spaces: 2,\n });\n}\n\n/**\n * Runs `npx expo prebuild` in the example app.\n */\nasync function prebuildExampleApp(exampleAppPath: string): Promise<void> {\n await newStep('Prebuilding the example app', async (step) => {\n await spawnAsync('npx', ['expo', 'prebuild', '--no-install'], {\n cwd: exampleAppPath,\n stdio: ['ignore', 'ignore', 'pipe'],\n });\n step.succeed('Prebuilt the example app');\n });\n}\n\n/**\n * Runs `pod install` in the iOS project at the given path.\n */\nasync function podInstall(appPath: string): Promise<void> {\n await spawnAsync('pod', ['install'], {\n cwd: path.join(appPath, 'ios'),\n stdio: ['ignore', 'ignore', 'pipe'],\n });\n}\n"]}
1
+ {"version":3,"file":"createExampleApp.js","sourceRoot":"","sources":["../src/createExampleApp.ts"],"names":[],"mappings":";;;;;;AAAA,oEAA2C;AAC3C,wDAA0B;AAC1B,oDAA4B;AAC5B,4CAAoB;AACpB,gDAAwB;AAExB,qDAAuD;AAGvD,qCAAsC;AAEtC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,qCAAqC,CAAuB,CAAC;AAE5F,kFAAkF;AAClF,MAAM,sBAAsB,GAAG,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,CAAC;AACzE,MAAM,SAAS,GAAG,gBAAM,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;AAErD;;GAEG;AACI,KAAK,UAAU,gBAAgB,CACpC,IAAsB,EACtB,SAAiB,EACjB,cAAkC;IAElC,mCAAmC;IACnC,MAAM,kBAAkB,GAAG,GAAG,IAAI,CAAC,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spawnAsync from '@expo/spawn-async';\nimport fs from 'fs-extra';\nimport getenv from 'getenv';\nimport os from 'os';\nimport path from 'path';\n\nimport { installDependencies } from './packageManager';\nimport { PackageManagerName } from './resolvePackageManager';\nimport { SubstitutionData } from './types';\nimport { newStep } from './utils/ora';\n\nconst debug = require('debug')('create-expo-module:createExampleApp') as typeof console.log;\n\n// These dependencies will be removed from the example app (`expo init` adds them)\nconst DEPENDENCIES_TO_REMOVE = ['expo-status-bar', 'expo-splash-screen'];\nconst EXPO_BETA = getenv.boolish('EXPO_BETA', false);\n\n/**\n * Initializes a new Expo project as an example app.\n */\nexport async function createExampleApp(\n data: SubstitutionData,\n targetDir: string,\n packageManager: PackageManagerName\n): Promise<void> {\n // Package name for the example app\n const exampleProjectSlug = `${data.project.slug}-example`;\n\n // `expo init` creates a new folder with the same name as the project slug\n const appTmpPath = path.join(targetDir, exampleProjectSlug);\n\n // Path to the target example dir\n const appTargetPath = path.join(targetDir, 'example');\n\n if (!(await fs.pathExists(appTargetPath))) {\n // The template doesn't include the example app, so just skip this phase\n return;\n }\n\n await newStep('Initializing the example app', async (step) => {\n const templateVersion = EXPO_BETA ? 'next' : 'latest';\n const template = `expo-template-blank-typescript@${templateVersion}`;\n debug(`Using example template: ${template}`);\n const command = createCommand(packageManager, exampleProjectSlug, template);\n try {\n await spawnAsync(packageManager, command, {\n cwd: targetDir,\n });\n } catch (error: any) {\n throw new Error(\n `${command.join(' ')} failed with exit code: ${error?.status}.\\n\\nError stack:\\n${error?.stderr}`\n );\n }\n\n step.succeed('Initialized the example app');\n });\n\n await newStep('Configuring the example app', async (step) => {\n // \"example\" folder already exists and contains template files,\n // that should replace these created by `expo init`.\n await moveFiles(appTargetPath, appTmpPath);\n\n // Cleanup the \"example\" dir\n await fs.rmdir(appTargetPath);\n\n // Clean up the \".git\" from example app\n // note, this directory has contents, rmdir will throw\n await fs.remove(path.join(appTmpPath, '.git'));\n\n // Move the temporary example app to \"example\" dir\n await fs.rename(appTmpPath, appTargetPath);\n\n await addMissingAppConfigFields(appTargetPath, data);\n\n step.succeed('Configured the example app');\n });\n\n await prebuildExampleApp(appTargetPath);\n\n await modifyPackageJson(appTargetPath);\n\n await newStep('Installing dependencies in the example app', async (step) => {\n await installDependencies(packageManager, appTargetPath);\n if (os.platform() === 'darwin') {\n await podInstall(appTargetPath);\n step.succeed('Installed dependencies in the example app');\n } else {\n step.succeed('Installed dependencies in the example app (skipped installing CocoaPods)');\n }\n });\n}\n\nfunction createCommand(\n packageManager: PackageManagerName,\n exampleProjectSlug: string,\n template: string\n): string[] {\n const command = ['create', 'expo-app'];\n if (packageManager === 'npm') {\n command.push('--');\n }\n return command.concat([exampleProjectSlug, '--template', template, '--yes']);\n}\n\n/**\n * Copies files from one directory to another.\n */\nasync function moveFiles(fromPath: string, toPath: string): Promise<void> {\n for (const file of await fs.readdir(fromPath)) {\n await fs.move(path.join(fromPath, file), path.join(toPath, file), {\n overwrite: true,\n });\n }\n}\n\n/**\n * Adds missing configuration that are required to run `npx expo prebuild`.\n */\nasync function addMissingAppConfigFields(appPath: string, data: SubstitutionData): Promise<void> {\n const appConfigPath = path.join(appPath, 'app.json');\n const appConfig = await fs.readJson(appConfigPath);\n const appId = `${data.project.package}.example`;\n\n // Android package name needs to be added to app.json\n if (!appConfig.expo.android) {\n appConfig.expo.android = {};\n }\n appConfig.expo.android.package = appId;\n\n // Specify iOS bundle identifier\n if (!appConfig.expo.ios) {\n appConfig.expo.ios = {};\n }\n appConfig.expo.ios.bundleIdentifier = appId;\n\n await fs.writeJson(appConfigPath, appConfig, {\n spaces: 2,\n });\n}\n\n/**\n * Applies necessary changes to **package.json** of the example app.\n * It means setting the autolinking config and removing unnecessary dependencies.\n */\nasync function modifyPackageJson(appPath: string): Promise<void> {\n const packageJsonPath = path.join(appPath, 'package.json');\n const packageJson = await fs.readJson(packageJsonPath);\n\n if (!packageJson.expo) {\n packageJson.expo = {};\n }\n\n // Set the native modules dir to the root folder,\n // so that the autolinking can detect and link the module.\n packageJson.expo.autolinking = {\n nativeModulesDir: '..',\n };\n\n // Remove unnecessary dependencies\n for (const dependencyToRemove of DEPENDENCIES_TO_REMOVE) {\n delete packageJson.dependencies[dependencyToRemove];\n }\n\n await fs.writeJson(packageJsonPath, packageJson, {\n spaces: 2,\n });\n}\n\n/**\n * Runs `npx expo prebuild` in the example app.\n */\nasync function prebuildExampleApp(exampleAppPath: string): Promise<void> {\n await newStep('Prebuilding the example app', async (step) => {\n await spawnAsync('npx', ['expo', 'prebuild', '--no-install'], {\n cwd: exampleAppPath,\n stdio: ['ignore', 'ignore', 'pipe'],\n });\n step.succeed('Prebuilt the example app');\n });\n}\n\n/**\n * Runs `pod install` in the iOS project at the given path.\n */\nasync function podInstall(appPath: string): Promise<void> {\n await spawnAsync('pod', ['install'], {\n cwd: path.join(appPath, 'ios'),\n stdio: ['ignore', 'ignore', 'pipe'],\n });\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-expo-module",
3
- "version": "0.8.5",
3
+ "version": "0.8.6",
4
4
  "description": "The script to create the Expo module",
5
5
  "main": "build/create-expo-module.js",
6
6
  "types": "build/create-expo-module.d.ts",
@@ -39,7 +39,7 @@
39
39
  "@expo/spawn-async": "^1.7.2",
40
40
  "chalk": "^4.1.2",
41
41
  "commander": "^8.3.0",
42
- "cross-spawn": "^7.0.3",
42
+ "cross-spawn": "^7.0.5",
43
43
  "debug": "^4.3.4",
44
44
  "download-tarball": "^2.0.0",
45
45
  "ejs": "^3.1.10",
@@ -57,5 +57,5 @@
57
57
  "@types/prompts": "^2.4.9",
58
58
  "expo-module-scripts": "^4.0.0"
59
59
  },
60
- "gitHead": "563c85837bc5055672846887f70f3daf5763b16d"
60
+ "gitHead": "128718d43bac2eaed764b3551469b95400f2363e"
61
61
  }
@@ -105,7 +105,7 @@ async function main(target: string | undefined, options: CommandOptions) {
105
105
  // Make one line break between prompts and progress logs
106
106
  console.log();
107
107
 
108
- const packageManager = await resolvePackageManager();
108
+ const packageManager = resolvePackageManager();
109
109
  const packagePath = options.source
110
110
  ? path.join(CWD, options.source)
111
111
  : await downloadPackageAsync(targetDir, options.local);
@@ -41,15 +41,7 @@ export async function createExampleApp(
41
41
  const templateVersion = EXPO_BETA ? 'next' : 'latest';
42
42
  const template = `expo-template-blank-typescript@${templateVersion}`;
43
43
  debug(`Using example template: ${template}`);
44
- const command = [
45
- 'create',
46
- 'expo-app',
47
- '--',
48
- exampleProjectSlug,
49
- '--template',
50
- template,
51
- '--yes',
52
- ];
44
+ const command = createCommand(packageManager, exampleProjectSlug, template);
53
45
  try {
54
46
  await spawnAsync(packageManager, command, {
55
47
  cwd: targetDir,
@@ -98,6 +90,18 @@ export async function createExampleApp(
98
90
  });
99
91
  }
100
92
 
93
+ function createCommand(
94
+ packageManager: PackageManagerName,
95
+ exampleProjectSlug: string,
96
+ template: string
97
+ ): string[] {
98
+ const command = ['create', 'expo-app'];
99
+ if (packageManager === 'npm') {
100
+ command.push('--');
101
+ }
102
+ return command.concat([exampleProjectSlug, '--template', template, '--yes']);
103
+ }
104
+
101
105
  /**
102
106
  * Copies files from one directory to another.
103
107
  */