create-expo-module 0.5.0 → 0.5.2

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.
@@ -26,7 +26,7 @@ async function createExampleApp(data, targetDir, packageManager) {
26
26
  return;
27
27
  }
28
28
  await (0, utils_1.newStep)('Initializing the example app', async (step) => {
29
- await (0, spawn_async_1.default)(packageManager, ['create', 'expo-app', exampleProjectSlug, '--template', 'blank-typescript'], {
29
+ await (0, spawn_async_1.default)(packageManager, ['create', 'expo-app', '--', exampleProjectSlug, '--template', 'blank-typescript', '--yes'], {
30
30
  cwd: targetDir,
31
31
  stdio: 'ignore',
32
32
  });
@@ -38,6 +38,9 @@ async function createExampleApp(data, targetDir, packageManager) {
38
38
  await moveFiles(appTargetPath, appTmpPath);
39
39
  // Cleanup the "example" dir
40
40
  await fs_extra_1.default.rmdir(appTargetPath);
41
+ // Clean up the ".git" from example app
42
+ // note, this directory has contents, rmdir will throw
43
+ await fs_extra_1.default.remove(path_1.default.join(appTmpPath, '.git'));
41
44
  // Move the temporary example app to "example" dir
42
45
  await fs_extra_1.default.rename(appTmpPath, appTargetPath);
43
46
  await addMissingAppConfigFields(appTargetPath, data);
@@ -107,11 +110,11 @@ async function modifyPackageJson(appPath) {
107
110
  });
108
111
  }
109
112
  /**
110
- * Runs `expo prebuild` in the example app.
113
+ * Runs `npx expo prebuild` in the example app.
111
114
  */
112
115
  async function prebuildExampleApp(exampleAppPath) {
113
116
  await (0, utils_1.newStep)('Prebuilding the example app', async (step) => {
114
- await (0, spawn_async_1.default)('expo', ['prebuild', '--no-install'], {
117
+ await (0, spawn_async_1.default)('npx', ['expo', 'prebuild', '--no-install'], {
115
118
  cwd: exampleAppPath,
116
119
  stdio: ['ignore', 'ignore', 'pipe'],
117
120
  });
@@ -1 +1 @@
1
- {"version":3,"file":"createExampleApp.js","sourceRoot":"","sources":["../src/createExampleApp.ts"],"names":[],"mappings":";;;;;;AAAA,oEAA2C;AAC3C,wDAA0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U,EAAC,MAAM,EAAE,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE;YACrD,GAAG,EAAE,cAAc;YACnB,KAAK,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC;SACpC,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,UAAU,CAAC,OAAe;IACvC,MAAM,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 path from 'path';\n\nimport { installDependencies } from './packageManager';\nimport { PackageManagerName } from './resolvePackageManager';\nimport { SubstitutionData } from './types';\nimport { newStep } from './utils';\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'];\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 await spawnAsync(\n packageManager,\n ['create', 'expo-app', exampleProjectSlug, '--template', 'blank-typescript'],\n {\n cwd: targetDir,\n stdio: 'ignore',\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 // 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 await podInstall(appTargetPath);\n step.succeed('Installed dependencies in the example app');\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 `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 `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('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,gDAAwB;AAExB,qDAAuD;AAGvD,mCAAkC;AAElC,kFAAkF;AAClF,MAAM,sBAAsB,GAAG,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,CAAC;AAEzE;;GAEG;AACI,KAAK,UAAU,gBAAgB,CACpC,IAAsB,EACtB,SAAiB,EACjB,cAAkC;IAElC,mCAAmC;IACnC,MAAM,kBAAkB,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC;IAE1D,0EAA0E;IAC1E,MAAM,UAAU,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;IAE5D,iCAAiC;IACjC,MAAM,aAAa,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAEtD,IAAI,CAAC,CAAC,MAAM,kBAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,EAAE;QACzC,wEAAwE;QACxE,OAAO;KACR;IAED,MAAM,I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AC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC;KACpC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nimport { installDependencies } from './packageManager';\nimport { PackageManagerName } from './resolvePackageManager';\nimport { SubstitutionData } from './types';\nimport { newStep } from './utils';\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'];\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 await spawnAsync(\n packageManager,\n ['create', 'expo-app', '--', exampleProjectSlug, '--template', 'blank-typescript', '--yes'],\n {\n cwd: targetDir,\n stdio: 'ignore',\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 await podInstall(appTargetPath);\n step.succeed('Installed dependencies in the example app');\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 `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"]}
@@ -6,13 +6,13 @@ const child_process_1 = require("child_process");
6
6
  function resolvePackageManager() {
7
7
  // Attempt to detect if the user started the command using `yarn` or `pnpm`
8
8
  const userAgent = process.env.npm_config_user_agent;
9
- if (userAgent === null || userAgent === void 0 ? void 0 : userAgent.startsWith('yarn')) {
9
+ if (userAgent?.startsWith('yarn')) {
10
10
  return 'yarn';
11
11
  }
12
- else if (userAgent === null || userAgent === void 0 ? void 0 : userAgent.startsWith('pnpm')) {
12
+ else if (userAgent?.startsWith('pnpm')) {
13
13
  return 'pnpm';
14
14
  }
15
- else if (userAgent === null || userAgent === void 0 ? void 0 : userAgent.startsWith('npm')) {
15
+ else if (userAgent?.startsWith('npm')) {
16
16
  return 'npm';
17
17
  }
18
18
  // Try availability
@@ -1 +1 @@
1
- {"version":3,"file":"resolvePackageManager.js","sourceRoot":"","sources":["../src/resolvePackageManager.ts"],"names":[],"mappings":";;;AAAA,iDAAyC;AAIzC,+GAA+G;AAC/G,SAAgB,qBAAqB;IACnC,2EAA2E;IAC3E,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;IAEpD,IAAI,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,UAAU,CAAC,MAAM,CAAC,EAAE;QACjC,OAAO,MAAM,CAAC;KACf;SAAM,IAAI,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,UAAU,CAAC,MAAM,CAAC,EAAE;QACxC,OAAO,MAAM,CAAC;KACf;SAAM,IAAI,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,UAAU,CAAC,KAAK,CAAC,EAAE;QACvC,OAAO,KAAK,CAAC;KACd;IAED,mBAAmB;IACnB,IAAI,yBAAyB,CAAC,MAAM,CAAC,EAAE;QACrC,OAAO,MAAM,CAAC;KACf;SAAM,IAAI,yBAAyB,CAAC,MAAM,CAAC,EAAE;QAC5C,OAAO,MAAM,CAAC;KACf;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AApBD,sDAoBC;AAED,SAAS,yBAAyB,CAAC,OAA2B;IAC5D,IAAI;QACF,IAAA,wBAAQ,EAAC,GAAG,OAAO,YAAY,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC;KACb;IAAC,MAAM,GAAE;IACV,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { execSync } from 'child_process';\n\nexport type PackageManagerName = 'npm' | 'pnpm' | 'yarn';\n\n/** Determine which package manager to use for installing dependencies based on how the process was started. */\nexport function resolvePackageManager(): PackageManagerName {\n // Attempt to detect if the user started the command using `yarn` or `pnpm`\n const userAgent = process.env.npm_config_user_agent;\n\n if (userAgent?.startsWith('yarn')) {\n return 'yarn';\n } else if (userAgent?.startsWith('pnpm')) {\n return 'pnpm';\n } else if (userAgent?.startsWith('npm')) {\n return 'npm';\n }\n\n // Try availability\n if (isPackageManagerAvailable('yarn')) {\n return 'yarn';\n } else if (isPackageManagerAvailable('pnpm')) {\n return 'pnpm';\n }\n\n return 'npm';\n}\n\nfunction isPackageManagerAvailable(manager: PackageManagerName): boolean {\n try {\n execSync(`${manager} --version`, { stdio: 'ignore' });\n return true;\n } catch {}\n return false;\n}\n"]}
1
+ {"version":3,"file":"resolvePackageManager.js","sourceRoot":"","sources":["../src/resolvePackageManager.ts"],"names":[],"mappings":";;;AAAA,iDAAyC;AAIzC,+GAA+G;AAC/G,SAAgB,qBAAqB;IACnC,2EAA2E;IAC3E,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;IAEpD,IAAI,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE;QACjC,OAAO,MAAM,CAAC;KACf;SAAM,IAAI,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE;QACxC,OAAO,MAAM,CAAC;KACf;SAAM,IAAI,SAAS,EAAE,UAAU,CAAC,KAAK,CAAC,EAAE;QACvC,OAAO,KAAK,CAAC;KACd;IAED,mBAAmB;IACnB,IAAI,yBAAyB,CAAC,MAAM,CAAC,EAAE;QACrC,OAAO,MAAM,CAAC;KACf;SAAM,IAAI,yBAAyB,CAAC,MAAM,CAAC,EAAE;QAC5C,OAAO,MAAM,CAAC;KACf;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AApBD,sDAoBC;AAED,SAAS,yBAAyB,CAAC,OAA2B;IAC5D,IAAI;QACF,IAAA,wBAAQ,EAAC,GAAG,OAAO,YAAY,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC;KACb;IAAC,MAAM,GAAE;IACV,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { execSync } from 'child_process';\n\nexport type PackageManagerName = 'npm' | 'pnpm' | 'yarn';\n\n/** Determine which package manager to use for installing dependencies based on how the process was started. */\nexport function resolvePackageManager(): PackageManagerName {\n // Attempt to detect if the user started the command using `yarn` or `pnpm`\n const userAgent = process.env.npm_config_user_agent;\n\n if (userAgent?.startsWith('yarn')) {\n return 'yarn';\n } else if (userAgent?.startsWith('pnpm')) {\n return 'pnpm';\n } else if (userAgent?.startsWith('npm')) {\n return 'npm';\n }\n\n // Try availability\n if (isPackageManagerAvailable('yarn')) {\n return 'yarn';\n } else if (isPackageManagerAvailable('pnpm')) {\n return 'pnpm';\n }\n\n return 'npm';\n}\n\nfunction isPackageManagerAvailable(manager: PackageManagerName): boolean {\n try {\n execSync(`${manager} --version`, { stdio: 'ignore' });\n return true;\n } catch {}\n return false;\n}\n"]}
package/build/utils.js CHANGED
@@ -55,9 +55,8 @@ exports.findGitHubEmail = findGitHubEmail;
55
55
  * Get the GitHub username from an email address if the email can be found in any commits on GitHub.
56
56
  */
57
57
  async function findGitHubProfileUrl(email) {
58
- var _a;
59
58
  try {
60
- const username = (_a = (await (0, github_username_1.default)(email))) !== null && _a !== void 0 ? _a : '';
59
+ const username = (await (0, github_username_1.default)(email)) ?? '';
61
60
  return `https://github.com/${username}`;
62
61
  }
63
62
  catch {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,8DAAgC;AAChC,sEAA6C;AAC7C,8CAAsB;AAIf,KAAK,UAAU,OAAO,CAC3B,KAAa,EACb,MAAmD,EACnD,UAAuB,EAAE;IAEzB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;IAC1D,MAAM,IAAI,GAAG,IAAA,aAAG,EAAC;QACf,IAAI,EAAE,eAAK,CAAC,IAAI,CAAC,KAAK,CAAC;QACvB,SAAS,EAAE,CAAC,QAAQ;QACpB,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM;QAClD,GAAG,OAAO;KACX,CAAC,CAAC;IAEH,IAAI,CAAC,KAAK,EAAE,CAAC;IAEb,IAAI;QACF,OAAO,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;KAC3B;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC;AAtBD,0BAsBC;AAED;;GAEG;AACI,KAAK,UAAU,UAAU;IAC9B,IAAI;QACF,OAAO,qBAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;KACrF;IAAC,MAAM;QACN,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AAND,gCAMC;AAED;;GAEG;AACI,KAAK,UAAU,eAAe;IACnC,IAAI;QACF,OAAO,qBAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;KACtF;IAAC,MAAM;QACN,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AAND,0CAMC;AAED;;GAEG;AACI,KAAK,UAAU,oBAAoB,CAAC,KAAa;;IACtD,IAAI;QACF,MAAM,QAAQ,GAAG,MAAA,CAAC,MAAM,IAAA,yBAAc,EAAC,KAAK,CAAC,CAAC,mCAAI,EAAE,CAAC;QACrD,OAAO,sBAAsB,QAAQ,EAAE,CAAC;KACzC;IAAC,MAAM;QACN,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AAPD,oDAOC;AAED;;GAEG;AACI,KAAK,UAAU,YAAY,CAAC,SAAiB,EAAE,IAAY;IAChE,IAAI,+BAA+B,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;QACnD,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAClE,OAAO,GAAG,SAAS,IAAI,cAAc,EAAE,CAAC;KACzC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAND,oCAMC","sourcesContent":["import chalk from 'chalk';\nimport spawn from 'cross-spawn';\nimport githubUsername from 'github-username';\nimport ora from 'ora';\n\nexport type StepOptions = ora.Options;\n\nexport async function newStep<Result>(\n title: string,\n action: (step: ora.Ora) => Promise<Result> | Result,\n options: StepOptions = {}\n): Promise<Result> {\n const disabled = process.env.CI || process.env.EXPO_DEBUG;\n const step = ora({\n text: chalk.bold(title),\n isEnabled: !disabled,\n stream: disabled ? process.stdout : process.stderr,\n ...options,\n });\n\n step.start();\n\n try {\n return await action(step);\n } catch (error) {\n step.fail();\n console.error(error);\n process.exit(1);\n }\n}\n\n/**\n * Finds user's name by reading it from the git config.\n */\nexport async function findMyName(): Promise<string> {\n try {\n return spawn.sync('git', ['config', '--get', 'user.name']).stdout.toString().trim();\n } catch {\n return '';\n }\n}\n\n/**\n * Finds user's email by reading it from the git config.\n */\nexport async function findGitHubEmail(): Promise<string> {\n try {\n return spawn.sync('git', ['config', '--get', 'user.email']).stdout.toString().trim();\n } catch {\n return '';\n }\n}\n\n/**\n * Get the GitHub username from an email address if the email can be found in any commits on GitHub.\n */\nexport async function findGitHubProfileUrl(email: string): Promise<string> {\n try {\n const username = (await githubUsername(email)) ?? '';\n return `https://github.com/${username}`;\n } catch {\n return '';\n }\n}\n\n/**\n * Guesses the repository URL based on the author profile URL and the package slug.\n */\nexport async function guessRepoUrl(authorUrl: string, slug: string) {\n if (/^https?:\\/\\/github.com\\/[^/]+/.test(authorUrl)) {\n const normalizedSlug = slug.replace(/^@/, '').replace(/\\//g, '-');\n return `${authorUrl}/${normalizedSlug}`;\n }\n return '';\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,8DAAgC;AAChC,sEAA6C;AAC7C,8CAAsB;AAIf,KAAK,UAAU,OAAO,CAC3B,KAAa,EACb,MAAmD,EACnD,UAAuB,EAAE;IAEzB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;IAC1D,MAAM,IAAI,GAAG,IAAA,aAAG,EAAC;QACf,IAAI,EAAE,eAAK,CAAC,IAAI,CAAC,KAAK,CAAC;QACvB,SAAS,EAAE,CAAC,QAAQ;QACpB,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM;QAClD,GAAG,OAAO;K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M,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAClE,OAAO,GAAG,SAAS,IAAI,cAAc,EAAE,CAAC;KACzC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAND,oCAMC","sourcesContent":["import chalk from 'chalk';\nimport spawn from 'cross-spawn';\nimport githubUsername from 'github-username';\nimport ora from 'ora';\n\nexport type StepOptions = ora.Options;\n\nexport async function newStep<Result>(\n title: string,\n action: (step: ora.Ora) => Promise<Result> | Result,\n options: StepOptions = {}\n): Promise<Result> {\n const disabled = process.env.CI || process.env.EXPO_DEBUG;\n const step = ora({\n text: chalk.bold(title),\n isEnabled: !disabled,\n stream: disabled ? process.stdout : process.stderr,\n ...options,\n });\n\n step.start();\n\n try {\n return await action(step);\n } catch (error) {\n step.fail();\n console.error(error);\n process.exit(1);\n }\n}\n\n/**\n * Finds user's name by reading it from the git config.\n */\nexport async function findMyName(): Promise<string> {\n try {\n return spawn.sync('git', ['config', '--get', 'user.name']).stdout.toString().trim();\n } catch {\n return '';\n }\n}\n\n/**\n * Finds user's email by reading it from the git config.\n */\nexport async function findGitHubEmail(): Promise<string> {\n try {\n return spawn.sync('git', ['config', '--get', 'user.email']).stdout.toString().trim();\n } catch {\n return '';\n }\n}\n\n/**\n * Get the GitHub username from an email address if the email can be found in any commits on GitHub.\n */\nexport async function findGitHubProfileUrl(email: string): Promise<string> {\n try {\n const username = (await githubUsername(email)) ?? '';\n return `https://github.com/${username}`;\n } catch {\n return '';\n }\n}\n\n/**\n * Guesses the repository URL based on the author profile URL and the package slug.\n */\nexport async function guessRepoUrl(authorUrl: string, slug: string) {\n if (/^https?:\\/\\/github.com\\/[^/]+/.test(authorUrl)) {\n const normalizedSlug = slug.replace(/^@/, '').replace(/\\//g, '-');\n return `${authorUrl}/${normalizedSlug}`;\n }\n return '';\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-expo-module",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
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",
@@ -46,9 +46,10 @@
46
46
  "validate-npm-package-name": "^4.0.0"
47
47
  },
48
48
  "devDependencies": {
49
+ "@tsconfig/node14": "^1.0.3",
49
50
  "@types/ejs": "^3.1.0",
50
51
  "@types/prompts": "^2.0.14",
51
- "expo-module-scripts": "^2.0.0"
52
+ "expo-module-scripts": "^3.0.0"
52
53
  },
53
- "gitHead": "1ba5fa454b86aef6f32c0f4ce0f34e4ea98e969f"
54
+ "gitHead": "eab2b09c735fb0fc2bf734a3f29a6593adba3838"
54
55
  }
@@ -35,7 +35,7 @@ export async function createExampleApp(
35
35
  await newStep('Initializing the example app', async (step) => {
36
36
  await spawnAsync(
37
37
  packageManager,
38
- ['create', 'expo-app', exampleProjectSlug, '--template', 'blank-typescript'],
38
+ ['create', 'expo-app', '--', exampleProjectSlug, '--template', 'blank-typescript', '--yes'],
39
39
  {
40
40
  cwd: targetDir,
41
41
  stdio: 'ignore',
@@ -52,6 +52,10 @@ export async function createExampleApp(
52
52
  // Cleanup the "example" dir
53
53
  await fs.rmdir(appTargetPath);
54
54
 
55
+ // Clean up the ".git" from example app
56
+ // note, this directory has contents, rmdir will throw
57
+ await fs.remove(path.join(appTmpPath, '.git'));
58
+
55
59
  // Move the temporary example app to "example" dir
56
60
  await fs.rename(appTmpPath, appTargetPath);
57
61
 
@@ -136,11 +140,11 @@ async function modifyPackageJson(appPath: string): Promise<void> {
136
140
  }
137
141
 
138
142
  /**
139
- * Runs `expo prebuild` in the example app.
143
+ * Runs `npx expo prebuild` in the example app.
140
144
  */
141
145
  async function prebuildExampleApp(exampleAppPath: string): Promise<void> {
142
146
  await newStep('Prebuilding the example app', async (step) => {
143
- await spawnAsync('expo', ['prebuild', '--no-install'], {
147
+ await spawnAsync('npx', ['expo', 'prebuild', '--no-install'], {
144
148
  cwd: exampleAppPath,
145
149
  stdio: ['ignore', 'ignore', 'pipe'],
146
150
  });
package/tsconfig.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "@tsconfig/node12/tsconfig.json",
2
+ "extends": "@tsconfig/node14/tsconfig.json",
3
3
  "include": ["./src"],
4
4
  "exclude": ["**/__mocks__/*", "**/__tests__/*"],
5
5
  "compilerOptions": {