@expo/cli 0.1.5 → 0.2.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.
- package/build/bin/cli +83 -4
- package/build/bin/cli.map +1 -1
- package/build/src/api/rest/wrapFetchWithOffline.js +2 -23
- package/build/src/api/rest/wrapFetchWithOffline.js.map +1 -1
- package/build/src/customize/customizeAsync.js +40 -0
- package/build/src/customize/customizeAsync.js.map +1 -0
- package/build/src/customize/generate.js +77 -0
- package/build/src/customize/generate.js.map +1 -0
- package/build/src/customize/index.js +41 -0
- package/build/src/customize/index.js.map +1 -0
- package/build/src/customize/resolveOptions.js +18 -0
- package/build/src/customize/resolveOptions.js.map +1 -0
- package/build/src/customize/templates.js +118 -0
- package/build/src/customize/templates.js.map +1 -0
- package/build/src/export/createMetadataJson.js +10 -7
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/exportApp.js +32 -0
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +2 -3
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +51 -34
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/index.js +14 -10
- package/build/src/export/index.js.map +1 -1
- package/build/src/export/printBundleSizes.js +27 -48
- package/build/src/export/printBundleSizes.js.map +1 -1
- package/build/src/export/resolveOptions.js +44 -5
- package/build/src/export/resolveOptions.js.map +1 -1
- package/build/src/export/saveAssets.js +2 -1
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/export/web/exportWebAsync.js +37 -0
- package/build/src/export/web/exportWebAsync.js.map +1 -0
- package/build/src/export/web/index.js +66 -0
- package/build/src/export/web/index.js.map +1 -0
- package/build/src/export/web/resolveOptions.js +13 -0
- package/build/src/export/web/resolveOptions.js.map +1 -0
- package/build/src/export/writeContents.js.map +1 -1
- package/build/src/install/checkPackages.js +2 -1
- package/build/src/install/checkPackages.js.map +1 -1
- package/build/src/install/index.js +1 -0
- package/build/src/install/index.js.map +1 -1
- package/build/src/install/installAsync.js +13 -5
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/install/resolveOptions.js +12 -65
- package/build/src/install/resolveOptions.js.map +1 -1
- package/build/src/install/utils/autoAddConfigPlugins.js +5 -26
- package/build/src/install/utils/autoAddConfigPlugins.js.map +1 -1
- package/build/src/log.js.map +1 -1
- package/build/src/prebuild/copyTemplateFiles.js +5 -23
- package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
- package/build/src/prebuild/index.js +18 -12
- package/build/src/prebuild/index.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +11 -12
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/prebuild/resolveOptions.js +17 -0
- package/build/src/prebuild/resolveOptions.js.map +1 -1
- package/build/src/prebuild/resolveTemplate.js +2 -1
- package/build/src/prebuild/resolveTemplate.js.map +1 -1
- package/build/src/prebuild/updatePackageJson.js +5 -5
- package/build/src/prebuild/updatePackageJson.js.map +1 -1
- package/build/src/run/android/resolveInstallApkName.js +5 -26
- package/build/src/run/android/resolveInstallApkName.js.map +1 -1
- package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js +2 -0
- package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/XcodePrerequisite.js +2 -0
- package/build/src/start/doctor/apple/XcodePrerequisite.js.map +1 -1
- package/build/src/start/doctor/dependencies/bundledNativeModules.js +3 -2
- package/build/src/start/doctor/dependencies/bundledNativeModules.js.map +1 -1
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js +7 -13
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js.map +1 -1
- package/build/src/start/doctor/dependencies/getMissingPackages.js +3 -24
- package/build/src/start/doctor/dependencies/getMissingPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +2 -23
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +17 -9
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/doctor/ngrok/ExternalModule.js +2 -1
- package/build/src/start/doctor/ngrok/ExternalModule.js.map +1 -1
- package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js +4 -3
- package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js.map +1 -1
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +32 -31
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
- package/build/src/start/interface/KeyPressHandler.js +2 -0
- package/build/src/start/interface/KeyPressHandler.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +5 -5
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/interface/startInterface.js +3 -2
- package/build/src/start/interface/startInterface.js.map +1 -1
- package/build/src/start/platforms/ExpoGoInstaller.js +2 -1
- package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
- package/build/src/start/platforms/PlatformManager.js +4 -24
- package/build/src/start/platforms/PlatformManager.js.map +1 -1
- package/build/src/start/platforms/android/ADBServer.js +17 -32
- package/build/src/start/platforms/android/ADBServer.js.map +1 -1
- package/build/src/start/platforms/android/AndroidSdk.js +41 -0
- package/build/src/start/platforms/android/AndroidSdk.js.map +1 -0
- package/build/src/start/platforms/android/activateWindow.js +4 -4
- package/build/src/start/platforms/android/activateWindow.js.map +1 -1
- package/build/src/start/platforms/android/adb.js +8 -3
- package/build/src/start/platforms/android/adb.js.map +1 -1
- package/build/src/start/platforms/android/adbReverse.js +3 -2
- package/build/src/start/platforms/android/adbReverse.js.map +1 -1
- package/build/src/start/platforms/android/gradle.js +2 -2
- package/build/src/start/platforms/android/gradle.js.map +1 -1
- package/build/src/start/platforms/ios/getBestSimulator.js +4 -4
- package/build/src/start/platforms/ios/getBestSimulator.js.map +1 -1
- package/build/src/start/platforms/ios/xcrun.js +2 -23
- package/build/src/start/platforms/ios/xcrun.js.map +1 -1
- package/build/src/start/project/devices.js +2 -0
- package/build/src/start/project/devices.js.map +1 -1
- package/build/src/start/server/AsyncNgrok.js +6 -5
- package/build/src/start/server/AsyncNgrok.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +15 -8
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/DevServerManager.js +15 -5
- package/build/src/start/server/DevServerManager.js.map +1 -1
- package/build/src/start/server/DevelopmentSession.js +4 -0
- package/build/src/start/server/DevelopmentSession.js.map +1 -1
- package/build/src/start/server/UrlCreator.js +10 -3
- package/build/src/start/server/UrlCreator.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +9 -0
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.js +5 -0
- package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +11 -1
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/resolveFromProject.js +8 -0
- package/build/src/start/server/metro/resolveFromProject.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +115 -0
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -0
- package/build/src/start/server/middleware/ClassicManifestMiddleware.js +1 -1
- package/build/src/start/server/middleware/ExpoMiddleware.js +9 -4
- package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/HistoryFallbackMiddleware.js +24 -0
- package/build/src/start/server/middleware/HistoryFallbackMiddleware.js.map +1 -0
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js +2 -0
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +57 -6
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js +6 -1
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ServeStaticMiddleware.js +62 -0
- package/build/src/start/server/middleware/ServeStaticMiddleware.js.map +1 -0
- package/build/src/start/server/platformBundlers.js +18 -0
- package/build/src/start/server/platformBundlers.js.map +1 -0
- package/build/src/start/server/webTemplate.js +68 -0
- package/build/src/start/server/webTemplate.js.map +1 -0
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js +59 -19
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
- package/build/src/start/server/webpack/compile.js +64 -0
- package/build/src/start/server/webpack/compile.js.map +1 -0
- package/build/src/start/startAsync.js +21 -17
- package/build/src/start/startAsync.js.map +1 -1
- package/build/src/utils/FileNotifier.js +5 -2
- package/build/src/utils/FileNotifier.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/build/src/utils/downloadAppAsync.js +3 -2
- package/build/src/utils/downloadAppAsync.js.map +1 -1
- package/build/src/utils/downloadExpoGoAsync.js +7 -32
- package/build/src/utils/downloadExpoGoAsync.js.map +1 -1
- package/build/src/utils/editor.js +3 -2
- package/build/src/utils/editor.js.map +1 -1
- package/build/src/utils/env.js +3 -0
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/exit.js +4 -25
- package/build/src/utils/exit.js.map +1 -1
- package/build/src/utils/getRunningProcess.js +6 -2
- package/build/src/utils/getRunningProcess.js.map +1 -1
- package/build/src/utils/nodeModules.js +13 -102
- package/build/src/utils/nodeModules.js.map +1 -1
- package/build/src/utils/npm.js +3 -24
- package/build/src/utils/npm.js.map +1 -1
- package/build/src/utils/ora.js +1 -13
- package/build/src/utils/ora.js.map +1 -1
- package/build/src/utils/progress.js +46 -0
- package/build/src/utils/progress.js.map +1 -1
- package/build/src/utils/prompts.js +4 -4
- package/build/src/utils/prompts.js.map +1 -1
- package/build/src/utils/tar.js +3 -0
- package/build/src/utils/tar.js.map +1 -1
- package/build/src/utils/validateApplicationId.js +9 -2
- package/build/src/utils/validateApplicationId.js.map +1 -1
- package/build/src/utils/variadic.js +47 -0
- package/build/src/utils/variadic.js.map +1 -0
- package/package.json +12 -7
- package/static/template/babel.config.js +6 -0
- package/static/template/index.html +117 -0
- package/static/template/metro.config.js +4 -0
- package/static/template/serve.json +13 -0
- package/static/template/webpack.config.js +7 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/install/resolveOptions.ts"],"sourcesContent":["import * as PackageManager from '@expo/package-manager';\n\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/install/resolveOptions.ts"],"sourcesContent":["import * as PackageManager from '@expo/package-manager';\n\nimport { CommandError } from '../utils/errors';\nimport { assertUnexpectedObjectKeys, parseVariadicArguments } from '../utils/variadic';\n\nexport type Options = Pick<PackageManager.CreateForProjectOptions, 'npm' | 'pnpm' | 'yarn'> & {\n /** Check which packages need to be updated, does not install any provided packages. */\n check?: boolean;\n /** Should the dependencies be fixed automatically. */\n fix?: boolean;\n /** Should disable install output, used for commands like `prebuild` that run install internally. */\n silent?: boolean;\n};\n\nfunction resolveOptions(options: Options): Options {\n if (options.fix && options.check) {\n throw new CommandError('BAD_ARGS', 'Specify at most one of: --check, --fix');\n }\n if ([options.npm, options.pnpm, options.yarn].filter(Boolean).length > 1) {\n throw new CommandError('BAD_ARGS', 'Specify at most one of: --npm, --pnpm, --yarn');\n }\n return {\n ...options,\n };\n}\n\nexport async function resolveArgsAsync(\n argv: string[]\n): Promise<{ variadic: string[]; options: Options; extras: string[] }> {\n const { variadic, extras, flags } = parseVariadicArguments(argv);\n\n assertUnexpectedObjectKeys(['--check', '--fix', '--npm', '--pnpm', '--yarn'], flags);\n\n return {\n // Variadic arguments like `npx expo install react react-dom` -> ['react', 'react-dom']\n variadic,\n options: resolveOptions({\n fix: !!flags['--fix'],\n check: !!flags['--check'],\n yarn: !!flags['--yarn'],\n npm: !!flags['--npm'],\n pnpm: !!flags['--pnpm'],\n }),\n extras,\n };\n}\n"],"names":["resolveArgsAsync","resolveOptions","options","fix","check","CommandError","npm","pnpm","yarn","filter","Boolean","length","argv","variadic","extras","flags","parseVariadicArguments","assertUnexpectedObjectKeys"],"mappings":"AAAA;;;;QA0BsBA,gBAAgB,GAAhBA,gBAAgB;AAxBT,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;AACqB,IAAA,SAAmB,WAAnB,mBAAmB,CAAA;AAWtF,SAASC,cAAc,CAACC,OAAgB,EAAW;IACjD,IAAIA,OAAO,CAACC,GAAG,IAAID,OAAO,CAACE,KAAK,EAAE;QAChC,MAAM,IAAIC,OAAY,aAAA,CAAC,UAAU,EAAE,wCAAwC,CAAC,CAAC;KAC9E;IACD,IAAI;QAACH,OAAO,CAACI,GAAG;QAAEJ,OAAO,CAACK,IAAI;QAAEL,OAAO,CAACM,IAAI;KAAC,CAACC,MAAM,CAACC,OAAO,CAAC,CAACC,MAAM,GAAG,CAAC,EAAE;QACxE,MAAM,IAAIN,OAAY,aAAA,CAAC,UAAU,EAAE,+CAA+C,CAAC,CAAC;KACrF;IACD,OAAO;QACL,GAAGH,OAAO;KACX,CAAC;CACH;AAEM,eAAeF,gBAAgB,CACpCY,IAAc,EACuD;IACrE,MAAM,EAAEC,QAAQ,CAAA,EAAEC,MAAM,CAAA,EAAEC,KAAK,CAAA,EAAE,GAAGC,CAAAA,GAAAA,SAAsB,AAAM,CAAA,uBAAN,CAACJ,IAAI,CAAC,AAAC;IAEjEK,CAAAA,GAAAA,SAA0B,AAA0D,CAAA,2BAA1D,CAAC;QAAC,SAAS;QAAE,OAAO;QAAE,OAAO;QAAE,QAAQ;QAAE,QAAQ;KAAC,EAAEF,KAAK,CAAC,CAAC;IAErF,OAAO;QACL,uFAAuF;QACvFF,QAAQ;QACRX,OAAO,EAAED,cAAc,CAAC;YACtBE,GAAG,EAAE,CAAC,CAACY,KAAK,CAAC,OAAO,CAAC;YACrBX,KAAK,EAAE,CAAC,CAACW,KAAK,CAAC,SAAS,CAAC;YACzBP,IAAI,EAAE,CAAC,CAACO,KAAK,CAAC,QAAQ,CAAC;YACvBT,GAAG,EAAE,CAAC,CAACS,KAAK,CAAC,OAAO,CAAC;YACrBR,IAAI,EAAE,CAAC,CAACQ,KAAK,CAAC,QAAQ,CAAC;SACxB,CAAC;QACFD,MAAM;KACP,CAAC;CACH"}
|
|
@@ -6,29 +6,8 @@ exports.getNamedPlugins = getNamedPlugins;
|
|
|
6
6
|
exports.autoAddConfigPluginsAsync = autoAddConfigPluginsAsync;
|
|
7
7
|
var _pluginResolver = require("@expo/config-plugins/build/utils/plugin-resolver");
|
|
8
8
|
var _prebuildConfig = require("@expo/prebuild-config");
|
|
9
|
-
var Log = _interopRequireWildcard(require("../../log"));
|
|
10
9
|
var _modifyConfigPlugins = require("../../utils/modifyConfigPlugins");
|
|
11
|
-
|
|
12
|
-
if (obj && obj.__esModule) {
|
|
13
|
-
return obj;
|
|
14
|
-
} else {
|
|
15
|
-
var newObj = {};
|
|
16
|
-
if (obj != null) {
|
|
17
|
-
for(var key in obj){
|
|
18
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
19
|
-
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
|
20
|
-
if (desc.get || desc.set) {
|
|
21
|
-
Object.defineProperty(newObj, key, desc);
|
|
22
|
-
} else {
|
|
23
|
-
newObj[key] = obj[key];
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
newObj.default = obj;
|
|
29
|
-
return newObj;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
10
|
+
const debug = require("debug")("expo:install:config-plugins");
|
|
32
11
|
const AUTO_PLUGINS = (0, _prebuildConfig).getAutoPlugins();
|
|
33
12
|
/**
|
|
34
13
|
* Resolve if a package has a config plugin.
|
|
@@ -63,10 +42,10 @@ function getNamedPlugins(plugins) {
|
|
|
63
42
|
return namedPlugins;
|
|
64
43
|
}
|
|
65
44
|
async function autoAddConfigPluginsAsync(projectRoot, exp, packages) {
|
|
66
|
-
|
|
45
|
+
debug("Checking config plugins...");
|
|
67
46
|
const currentPlugins = exp.plugins || [];
|
|
68
47
|
const normalized = getNamedPlugins(currentPlugins);
|
|
69
|
-
|
|
48
|
+
debug(`Existing plugins: ${normalized.join(", ")}`);
|
|
70
49
|
const plugins = packages.filter((pkg)=>{
|
|
71
50
|
if (normalized.includes(pkg)) {
|
|
72
51
|
// already included in plugins array
|
|
@@ -74,9 +53,9 @@ async function autoAddConfigPluginsAsync(projectRoot, exp, packages) {
|
|
|
74
53
|
}
|
|
75
54
|
// Check if the package has a valid plugin. Must be a well-made plugin for it to work with this.
|
|
76
55
|
const plugin = packageHasConfigPlugin(projectRoot, pkg);
|
|
77
|
-
|
|
56
|
+
debug(`Package "${pkg}" has plugin: ${!!plugin}` + (plugin ? ` (args: ${plugin.length})` : ""));
|
|
78
57
|
if (AUTO_PLUGINS.includes(pkg)) {
|
|
79
|
-
|
|
58
|
+
debug(`Package "${pkg}" is an auto plugin, skipping...`);
|
|
80
59
|
return false;
|
|
81
60
|
}
|
|
82
61
|
return !!plugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/install/utils/autoAddConfigPlugins.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport {\n normalizeStaticPlugin,\n resolveConfigPluginFunctionWithInfo,\n} from '@expo/config-plugins/build/utils/plugin-resolver';\nimport { getAutoPlugins } from '@expo/prebuild-config';\n\nimport
|
|
1
|
+
{"version":3,"sources":["../../../../src/install/utils/autoAddConfigPlugins.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport {\n normalizeStaticPlugin,\n resolveConfigPluginFunctionWithInfo,\n} from '@expo/config-plugins/build/utils/plugin-resolver';\nimport { getAutoPlugins } from '@expo/prebuild-config';\n\nimport { attemptAddingPluginsAsync } from '../../utils/modifyConfigPlugins';\n\nconst debug = require('debug')('expo:install:config-plugins') as typeof console.log;\n\nconst AUTO_PLUGINS = getAutoPlugins();\n\n/**\n * Resolve if a package has a config plugin.\n * For sanity, we'll only support config plugins that use the `app.config.js` entry file,\n * this is because a package like `lodash` could be a \"valid\" config plugin and break the prebuild process.\n *\n * @param projectRoot\n * @param packageName\n * @returns\n */\nfunction packageHasConfigPlugin(projectRoot: string, packageName: string) {\n try {\n const info = resolveConfigPluginFunctionWithInfo(projectRoot, packageName);\n if (info.isPluginFile) {\n return info.plugin;\n }\n } catch {}\n return false;\n}\n\n/**\n * Get a list of plugins that were are supplied as string module IDs.\n * @example\n * ```json\n * {\n * \"plugins\": [\n * \"expo-camera\",\n * [\"react-native-firebase\", ...]\n * ]\n * }\n * ```\n * ↓ ↓ ↓ ↓ ↓ ↓\n *\n * `['expo-camera', 'react-native-firebase']`\n *\n */\nexport function getNamedPlugins(plugins: NonNullable<ExpoConfig['plugins']>): string[] {\n const namedPlugins: string[] = [];\n for (const plugin of plugins) {\n try {\n // @ts-ignore\n const [normal] = normalizeStaticPlugin(plugin);\n if (typeof normal === 'string') {\n namedPlugins.push(normal);\n }\n } catch {\n // ignore assertions\n }\n }\n return namedPlugins;\n}\n\n/** Attempts to ensure that non-auto plugins are added to the `app.json` `plugins` array when modules with Expo Config Plugins are installed. */\nexport async function autoAddConfigPluginsAsync(\n projectRoot: string,\n exp: Pick<ExpoConfig, 'plugins'>,\n packages: string[]\n) {\n debug('Checking config plugins...');\n\n const currentPlugins = exp.plugins || [];\n const normalized = getNamedPlugins(currentPlugins);\n\n debug(`Existing plugins: ${normalized.join(', ')}`);\n\n const plugins = packages.filter((pkg) => {\n if (normalized.includes(pkg)) {\n // already included in plugins array\n return false;\n }\n // Check if the package has a valid plugin. Must be a well-made plugin for it to work with this.\n const plugin = packageHasConfigPlugin(projectRoot, pkg);\n\n debug(`Package \"${pkg}\" has plugin: ${!!plugin}` + (plugin ? ` (args: ${plugin.length})` : ''));\n\n if (AUTO_PLUGINS.includes(pkg)) {\n debug(`Package \"${pkg}\" is an auto plugin, skipping...`);\n return false;\n }\n\n return !!plugin;\n });\n\n await attemptAddingPluginsAsync(projectRoot, exp, plugins);\n}\n"],"names":["getNamedPlugins","autoAddConfigPluginsAsync","debug","require","AUTO_PLUGINS","getAutoPlugins","packageHasConfigPlugin","projectRoot","packageName","info","resolveConfigPluginFunctionWithInfo","isPluginFile","plugin","plugins","namedPlugins","normal","normalizeStaticPlugin","push","exp","packages","currentPlugins","normalized","join","filter","pkg","includes","length","attemptAddingPluginsAsync"],"mappings":"AAAA;;;;QAgDgBA,eAAe,GAAfA,eAAe;QAiBTC,yBAAyB,GAAzBA,yBAAyB;AA7DxC,IAAA,eAAkD,WAAlD,kDAAkD,CAAA;AAC1B,IAAA,eAAuB,WAAvB,uBAAuB,CAAA;AAEZ,IAAA,oBAAiC,WAAjC,iCAAiC,CAAA;AAE3E,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,6BAA6B,CAAC,AAAsB,AAAC;AAEpF,MAAMC,YAAY,GAAGC,CAAAA,GAAAA,eAAc,AAAE,CAAA,eAAF,EAAE,AAAC;AAEtC;;;;;;;;GAQG,CACH,SAASC,sBAAsB,CAACC,WAAmB,EAAEC,WAAmB,EAAE;IACxE,IAAI;QACF,MAAMC,IAAI,GAAGC,CAAAA,GAAAA,eAAmC,AAA0B,CAAA,oCAA1B,CAACH,WAAW,EAAEC,WAAW,CAAC,AAAC;QAC3E,IAAIC,IAAI,CAACE,YAAY,EAAE;YACrB,OAAOF,IAAI,CAACG,MAAM,CAAC;SACpB;KACF,CAAC,OAAM,EAAE;IACV,OAAO,KAAK,CAAC;CACd;AAkBM,SAASZ,eAAe,CAACa,OAA2C,EAAY;IACrF,MAAMC,YAAY,GAAa,EAAE,AAAC;IAClC,KAAK,MAAMF,MAAM,IAAIC,OAAO,CAAE;QAC5B,IAAI;YACF,aAAa;YACb,MAAM,CAACE,MAAM,CAAC,GAAGC,CAAAA,GAAAA,eAAqB,AAAQ,CAAA,sBAAR,CAACJ,MAAM,CAAC,AAAC;YAC/C,IAAI,OAAOG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AAA,0BAA3B,CAACpB,WAAW,EAAEW,GAAG,EAAEL,OAAO,CAAC,CAAC;CAC5D"}
|
package/build/src/log.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/log.ts"],"sourcesContent":["import chalk from 'chalk';\n\nexport function time(label?: string): void {\n console.time(label);\n}\n\nexport function timeEnd(label?: string): void {\n console.timeEnd(label);\n}\n\nexport function error(...message: string[]): void {\n console.error(...message);\n}\n\n/** Print an error and provide additional info (the stack trace) in debug mode. */\nexport function exception(e: Error): void {\n const { env } = require('./utils/env');\n error(chalk.red(e.toString()) + (env.EXPO_DEBUG ? '\\n' + chalk.gray(e.stack) : ''));\n}\n\nexport function warn(...message: string[]): void {\n console.warn(...message.map((value) => chalk.yellow(value)));\n}\n\nexport function log(...message: string[]): void {\n console.log(...message);\n}\n\nexport function debug(...message: any[]): void {\n if (require('./utils/env').env.EXPO_DEBUG) console.log(...message);\n}\n\n/** Clear the terminal of all text. */\nexport function clear(): void {\n process.stdout.write(process.platform === 'win32' ? '\\x1B[2J\\x1B[0f' : '\\x1B[2J\\x1B[3J\\x1B[H');\n}\n\n/** Log a message and exit the current process. If the `code` is non-zero then `console.error` will be used instead of `console.log`. */\nexport function exit(message: string | Error, code: number = 1): never {\n if (message instanceof Error) {\n exception(message);\n process.exit(code);\n }\n\n if (message) {\n if (code === 0) {\n log(message);\n } else {\n error(message);\n }\n }\n\n process.exit(code);\n}\n\n// The re-export makes auto importing easier.\nexport const Log = {\n time,\n timeEnd,\n error,\n exception,\n warn,\n log,\n debug,\n clear,\n exit,\n};\n"],"names":["time","timeEnd","error","exception","warn","log","debug","clear","exit","label","console","message","e","env","require","chalk","red","toString","EXPO_DEBUG","gray","stack","map","value","yellow","process","stdout","write","platform","code","Error","Log"],"mappings":"AAAA;;;;QAEgBA,IAAI,GAAJA,IAAI;QAIJC,OAAO,GAAPA,OAAO;QAIPC,KAAK,GAALA,KAAK;QAKLC,SAAS,GAATA,SAAS;QAKTC,IAAI,GAAJA,IAAI;QAIJC,GAAG,GAAHA,GAAG;
|
|
1
|
+
{"version":3,"sources":["../../src/log.ts"],"sourcesContent":["import chalk from 'chalk';\n\nexport function time(label?: string): void {\n console.time(label);\n}\n\nexport function timeEnd(label?: string): void {\n console.timeEnd(label);\n}\n\nexport function error(...message: string[]): void {\n console.error(...message);\n}\n\n/** Print an error and provide additional info (the stack trace) in debug mode. */\nexport function exception(e: Error): void {\n const { env } = require('./utils/env');\n error(chalk.red(e.toString()) + (env.EXPO_DEBUG ? '\\n' + chalk.gray(e.stack) : ''));\n}\n\nexport function warn(...message: string[]): void {\n console.warn(...message.map((value) => chalk.yellow(value)));\n}\n\nexport function log(...message: string[]): void {\n console.log(...message);\n}\n\n/** @deprecated use `debug` package with the `expo:` prefix instead. */\nexport function debug(...message: any[]): void {\n if (require('./utils/env').env.EXPO_DEBUG) console.log(...message);\n}\n\n/** Clear the terminal of all text. */\nexport function clear(): void {\n process.stdout.write(process.platform === 'win32' ? '\\x1B[2J\\x1B[0f' : '\\x1B[2J\\x1B[3J\\x1B[H');\n}\n\n/** Log a message and exit the current process. If the `code` is non-zero then `console.error` will be used instead of `console.log`. */\nexport function exit(message: string | Error, code: number = 1): never {\n if (message instanceof Error) {\n exception(message);\n process.exit(code);\n }\n\n if (message) {\n if (code === 0) {\n log(message);\n } else {\n error(message);\n }\n }\n\n process.exit(code);\n}\n\n// The re-export makes auto importing easier.\nexport const Log = {\n time,\n timeEnd,\n error,\n exception,\n warn,\n log,\n debug,\n clear,\n exit,\n};\n"],"names":["time","timeEnd","error","exception","warn","log","debug","clear","exit","label","console","message","e","env","require","chalk","red","toString","EXPO_DEBUG","gray","stack","map","value","yellow","process","stdout","write","platform","code","Error","Log"],"mappings":"AAAA;;;;QAEgBA,IAAI,GAAJA,IAAI;QAIJC,OAAO,GAAPA,OAAO;QAIPC,KAAK,GAALA,KAAK;QAKLC,SAAS,GAATA,SAAS;QAKTC,IAAI,GAAJA,IAAI;QAIJ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AIM,OAAO,CAAC,CAAC;CACpE;AAGM,SAASJ,KAAK,GAAS;IAC5BiB,OAAO,CAACC,MAAM,CAACC,KAAK,CAACF,OAAO,CAACG,QAAQ,KAAK,OAAO,GAAG,gBAAgB,GAAG,sBAAsB,CAAC,CAAC;CAChG;AAGM,SAASnB,IAAI,CAACG,OAAuB,EAAEiB,IAAY,GAAG,CAAC,EAAS;IACrE,IAAIjB,OAAO,YAAYkB,KAAK,EAAE;QAC5B1B,SAAS,CAACQ,OAAO,CAAC,CAAC;QACnBa,OAAO,CAAChB,IAAI,CAACoB,IAAI,CAAC,CAAC;KACpB;IAED,IAAIjB,OAAO,EAAE;QACX,IAAIiB,IAAI,KAAK,CAAC,EAAE;YACdvB,GAAG,CAACM,OAAO,CAAC,CAAC;SACd,MAAM;YACLT,KAAK,CAACS,OAAO,CAAC,CAAC;SAChB;KACF;IAEDa,OAAO,CAAChB,IAAI,CAACoB,IAAI,CAAC,CAAC;CACpB;AAGM,MAAME,GAAG,GAAG;IACjB9B,IAAI;IACJC,OAAO;IACPC,KAAK;IACLC,SAAS;IACTC,IAAI;IACJC,GAAG;IACHC,KAAK;IACLC,KAAK;IACLC,IAAI;CACL,AAAC;QAVWsB,GAAG,GAAHA,GAAG"}
|
|
@@ -9,7 +9,6 @@ var _paths = require("@expo/config/paths");
|
|
|
9
9
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
10
10
|
var _fs = _interopRequireDefault(require("fs"));
|
|
11
11
|
var _path = _interopRequireDefault(require("path"));
|
|
12
|
-
var Log = _interopRequireWildcard(require("../log"));
|
|
13
12
|
var _dir = require("../utils/dir");
|
|
14
13
|
var _mergeGitIgnorePaths = require("../utils/mergeGitIgnorePaths");
|
|
15
14
|
var _updatePackageJson = require("./updatePackageJson");
|
|
@@ -18,27 +17,7 @@ function _interopRequireDefault(obj) {
|
|
|
18
17
|
default: obj
|
|
19
18
|
};
|
|
20
19
|
}
|
|
21
|
-
|
|
22
|
-
if (obj && obj.__esModule) {
|
|
23
|
-
return obj;
|
|
24
|
-
} else {
|
|
25
|
-
var newObj = {};
|
|
26
|
-
if (obj != null) {
|
|
27
|
-
for(var key in obj){
|
|
28
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
29
|
-
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
|
30
|
-
if (desc.get || desc.set) {
|
|
31
|
-
Object.defineProperty(newObj, key, desc);
|
|
32
|
-
} else {
|
|
33
|
-
newObj[key] = obj[key];
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
newObj.default = obj;
|
|
39
|
-
return newObj;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
20
|
+
const debug = require("debug")("expo:prebuild:copyTemplateFiles");
|
|
42
21
|
/**
|
|
43
22
|
* Return true if the given platforms all have an internal `.gitignore` file.
|
|
44
23
|
*
|
|
@@ -70,7 +49,7 @@ async function copyTemplateFilesAsync(projectRoot, { pkg , templateDirectory , p
|
|
|
70
49
|
copyFilePaths
|
|
71
50
|
});
|
|
72
51
|
const hasPlatformSpecificGitIgnores = hasAllPlatformSpecificGitIgnores(templateDirectory, platforms);
|
|
73
|
-
|
|
52
|
+
debug(`All platforms have an internal gitignore: ${hasPlatformSpecificGitIgnores}`);
|
|
74
53
|
const gitignore = hasPlatformSpecificGitIgnores ? null : (0, _mergeGitIgnorePaths).mergeGitIgnorePaths(_path.default.join(projectRoot, ".gitignore"), _path.default.join(templateDirectory, ".gitignore"));
|
|
75
54
|
return {
|
|
76
55
|
...copyResults,
|
|
@@ -89,6 +68,8 @@ async function copyPathsFromTemplateAsync(/** File path to the project. */ proje
|
|
|
89
68
|
skippedPaths.push(copyFilePath);
|
|
90
69
|
}
|
|
91
70
|
}
|
|
71
|
+
debug(`Copied files:`, copiedPaths);
|
|
72
|
+
debug(`Skipped files:`, copiedPaths);
|
|
92
73
|
return {
|
|
93
74
|
copiedPaths,
|
|
94
75
|
skippedPaths
|
|
@@ -103,6 +84,7 @@ async function copyPathsFromTemplateAsync(/** File path to the project. */ proje
|
|
|
103
84
|
if (!bareEntryFile) {
|
|
104
85
|
targetPaths.push("index.js");
|
|
105
86
|
}
|
|
87
|
+
debug(`Files to copy:`, targetPaths);
|
|
106
88
|
return targetPaths;
|
|
107
89
|
}
|
|
108
90
|
function resolveBareEntryFile(projectRoot, main) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prebuild/copyTemplateFiles.ts"],"sourcesContent":["import { PackageJSONConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\nimport { MergeResults } from '@expo/config-plugins/build/utils/generateCode';\nimport { getBareExtensions, getFileWithExtensions } from '@expo/config/paths';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport * as Log from '../log';\nimport { copySync, directoryExistsAsync } from '../utils/dir';\nimport { mergeGitIgnorePaths } from '../utils/mergeGitIgnorePaths';\nimport { isPkgMainExpoAppEntry } from './updatePackageJson';\n\ntype CopyFilesResults = {\n /** Merge results for the root `.gitignore` file */\n gitignore: MergeResults | null;\n /** List of file paths that were copied from the template into the project. */\n copiedPaths: string[];\n /** List of file paths that were skipped due to a number of factors. */\n skippedPaths: string[];\n};\n\n/**\n * Return true if the given platforms all have an internal `.gitignore` file.\n *\n * @param projectRoot\n * @param platforms\n */\nfunction hasAllPlatformSpecificGitIgnores(projectRoot: string, platforms: ModPlatform[]): boolean {\n return platforms.reduce<boolean>(\n (p, platform) => p && fs.existsSync(path.join(projectRoot, platform, '.gitignore')),\n true\n );\n}\n\n/** Create a custom log message based on the copy file results. */\nexport function createCopyFilesSuccessMessage(\n platforms: ModPlatform[],\n { skippedPaths, gitignore }: CopyFilesResults\n): string {\n let message = `Created native project${platforms.length > 1 ? 's' : ''}`;\n\n if (skippedPaths.length) {\n message += chalk.dim(\n ` | ${skippedPaths.map((path) => chalk.bold(`/${path}`)).join(', ')} already created`\n );\n }\n if (!gitignore) {\n message += chalk.dim(` | gitignore skipped`);\n } else if (!gitignore.didMerge) {\n message += chalk.dim(` | gitignore already synced`);\n } else if (gitignore.didMerge && gitignore.didClear) {\n message += chalk.dim(` | synced gitignore`);\n }\n return message;\n}\n\n/** Copy template files into the project and possibly merge the `.gitignore` files. */\nexport async function copyTemplateFilesAsync(\n projectRoot: string,\n {\n pkg,\n templateDirectory,\n platforms,\n }: {\n /** Project `package.json` as JSON. */\n pkg: PackageJSONConfig;\n /** File path to the template directory. */\n templateDirectory: string;\n /** List of platforms to copy against. */\n platforms: ModPlatform[];\n }\n): Promise<CopyFilesResults> {\n const copyFilePaths = getFilePathsToCopy(projectRoot, pkg, platforms);\n\n const copyResults = await copyPathsFromTemplateAsync(projectRoot, {\n templateDirectory,\n copyFilePaths,\n });\n\n const hasPlatformSpecificGitIgnores = hasAllPlatformSpecificGitIgnores(\n templateDirectory,\n platforms\n );\n Log.debug(`All platforms have an internal gitignore: ${hasPlatformSpecificGitIgnores}`);\n const gitignore = hasPlatformSpecificGitIgnores\n ? null\n : mergeGitIgnorePaths(\n path.join(projectRoot, '.gitignore'),\n path.join(templateDirectory, '.gitignore')\n );\n\n return { ...copyResults, gitignore };\n}\n\nasync function copyPathsFromTemplateAsync(\n /** File path to the project. */\n projectRoot: string,\n {\n templateDirectory,\n copyFilePaths,\n }: {\n /** File path to the template project. */\n templateDirectory: string;\n /** List of relative paths to copy from the template to the project. */\n copyFilePaths: string[];\n }\n): Promise<Pick<CopyFilesResults, 'copiedPaths' | 'skippedPaths'>> {\n const copiedPaths = [];\n const skippedPaths = [];\n for (const copyFilePath of copyFilePaths) {\n const projectPath = path.join(projectRoot, copyFilePath);\n if (!(await directoryExistsAsync(projectPath))) {\n copiedPaths.push(copyFilePath);\n copySync(path.join(templateDirectory, copyFilePath), projectPath);\n } else {\n skippedPaths.push(copyFilePath);\n }\n }\n return { copiedPaths, skippedPaths };\n}\n\n/** Get a list of relative file paths to copy from the template folder. Example: `['ios', 'android', 'index.js']` */\nfunction getFilePathsToCopy(projectRoot: string, pkg: PackageJSONConfig, platforms: ModPlatform[]) {\n const targetPaths: string[] = [...platforms];\n\n const bareEntryFile = resolveBareEntryFile(projectRoot, pkg.main);\n // Only create index.js if we cannot resolve the existing entry point (after replacing the expo entry).\n if (!bareEntryFile) {\n targetPaths.push('index.js');\n }\n\n return targetPaths;\n}\n\nexport function resolveBareEntryFile(projectRoot: string, main: any) {\n // expo app entry is not needed for bare projects.\n if (isPkgMainExpoAppEntry(main)) {\n return null;\n }\n // Look at the `package.json`s `main` field for the main file.\n const resolvedMainField = main ?? './index';\n // Get a list of possible extensions for the main file.\n const extensions = getBareExtensions(['ios', 'android']);\n // Testing the main field against all of the provided extensions - for legacy reasons we can't use node module resolution as the package.json allows you to pass in a file without a relative path and expect it as a relative path.\n return getFileWithExtensions(projectRoot, resolvedMainField, extensions);\n}\n"],"names":["createCopyFilesSuccessMessage","copyTemplateFilesAsync","resolveBareEntryFile","Log","hasAllPlatformSpecificGitIgnores","projectRoot","platforms","reduce","p","platform","fs","existsSync","path","join","skippedPaths","gitignore","message","length","chalk","dim","map","bold","didMerge","didClear","pkg","templateDirectory","copyFilePaths","getFilePathsToCopy","copyResults","copyPathsFromTemplateAsync","hasPlatformSpecificGitIgnores","debug","mergeGitIgnorePaths","copiedPaths","copyFilePath","projectPath","directoryExistsAsync","push","copySync","targetPaths","bareEntryFile","main","isPkgMainExpoAppEntry","resolvedMainField","extensions","getBareExtensions","getFileWithExtensions"],"mappings":"AAAA;;;;QAoCgBA,6BAA6B,GAA7BA,6BAA6B;QAsBvBC,sBAAsB,GAAtBA,sBAAsB;QA6E5BC,oBAAoB,GAApBA,oBAAoB;AApIqB,IAAA,MAAoB,WAApB,oBAAoB,CAAA;AAC3D,IAAA,MAAO,kCAAP,OAAO,EAAA;AACV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEXC,IAAAA,GAA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,oOAAoO;IACpO,OAAOC,CAAAA,GAAAA,MAAqB,AAA4C,CAAA,sBAA5C,CAACzC,WAAW,EAAEsC,iBAAiB,EAAEC,UAAU,CAAC,CAAC;CAC1E"}
|
|
1
|
+
{"version":3,"sources":["../../../src/prebuild/copyTemplateFiles.ts"],"sourcesContent":["import { PackageJSONConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\nimport { MergeResults } from '@expo/config-plugins/build/utils/generateCode';\nimport { getBareExtensions, getFileWithExtensions } from '@expo/config/paths';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { copySync, directoryExistsAsync } from '../utils/dir';\nimport { mergeGitIgnorePaths } from '../utils/mergeGitIgnorePaths';\nimport { isPkgMainExpoAppEntry } from './updatePackageJson';\n\nconst debug = require('debug')('expo:prebuild:copyTemplateFiles') as typeof console.log;\n\ntype CopyFilesResults = {\n /** Merge results for the root `.gitignore` file */\n gitignore: MergeResults | null;\n /** List of file paths that were copied from the template into the project. */\n copiedPaths: string[];\n /** List of file paths that were skipped due to a number of factors. */\n skippedPaths: string[];\n};\n\n/**\n * Return true if the given platforms all have an internal `.gitignore` file.\n *\n * @param projectRoot\n * @param platforms\n */\nfunction hasAllPlatformSpecificGitIgnores(projectRoot: string, platforms: ModPlatform[]): boolean {\n return platforms.reduce<boolean>(\n (p, platform) => p && fs.existsSync(path.join(projectRoot, platform, '.gitignore')),\n true\n );\n}\n\n/** Create a custom log message based on the copy file results. */\nexport function createCopyFilesSuccessMessage(\n platforms: ModPlatform[],\n { skippedPaths, gitignore }: CopyFilesResults\n): string {\n let message = `Created native project${platforms.length > 1 ? 's' : ''}`;\n\n if (skippedPaths.length) {\n message += chalk.dim(\n ` | ${skippedPaths.map((path) => chalk.bold(`/${path}`)).join(', ')} already created`\n );\n }\n if (!gitignore) {\n message += chalk.dim(` | gitignore skipped`);\n } else if (!gitignore.didMerge) {\n message += chalk.dim(` | gitignore already synced`);\n } else if (gitignore.didMerge && gitignore.didClear) {\n message += chalk.dim(` | synced gitignore`);\n }\n return message;\n}\n\n/** Copy template files into the project and possibly merge the `.gitignore` files. */\nexport async function copyTemplateFilesAsync(\n projectRoot: string,\n {\n pkg,\n templateDirectory,\n platforms,\n }: {\n /** Project `package.json` as JSON. */\n pkg: PackageJSONConfig;\n /** File path to the template directory. */\n templateDirectory: string;\n /** List of platforms to copy against. */\n platforms: ModPlatform[];\n }\n): Promise<CopyFilesResults> {\n const copyFilePaths = getFilePathsToCopy(projectRoot, pkg, platforms);\n\n const copyResults = await copyPathsFromTemplateAsync(projectRoot, {\n templateDirectory,\n copyFilePaths,\n });\n\n const hasPlatformSpecificGitIgnores = hasAllPlatformSpecificGitIgnores(\n templateDirectory,\n platforms\n );\n debug(`All platforms have an internal gitignore: ${hasPlatformSpecificGitIgnores}`);\n const gitignore = hasPlatformSpecificGitIgnores\n ? null\n : mergeGitIgnorePaths(\n path.join(projectRoot, '.gitignore'),\n path.join(templateDirectory, '.gitignore')\n );\n\n return { ...copyResults, gitignore };\n}\n\nasync function copyPathsFromTemplateAsync(\n /** File path to the project. */\n projectRoot: string,\n {\n templateDirectory,\n copyFilePaths,\n }: {\n /** File path to the template project. */\n templateDirectory: string;\n /** List of relative paths to copy from the template to the project. */\n copyFilePaths: string[];\n }\n): Promise<Pick<CopyFilesResults, 'copiedPaths' | 'skippedPaths'>> {\n const copiedPaths = [];\n const skippedPaths = [];\n for (const copyFilePath of copyFilePaths) {\n const projectPath = path.join(projectRoot, copyFilePath);\n if (!(await directoryExistsAsync(projectPath))) {\n copiedPaths.push(copyFilePath);\n copySync(path.join(templateDirectory, copyFilePath), projectPath);\n } else {\n skippedPaths.push(copyFilePath);\n }\n }\n debug(`Copied files:`, copiedPaths);\n debug(`Skipped files:`, copiedPaths);\n return { copiedPaths, skippedPaths };\n}\n\n/** Get a list of relative file paths to copy from the template folder. Example: `['ios', 'android', 'index.js']` */\nfunction getFilePathsToCopy(projectRoot: string, pkg: PackageJSONConfig, platforms: ModPlatform[]) {\n const targetPaths: string[] = [...platforms];\n\n const bareEntryFile = resolveBareEntryFile(projectRoot, pkg.main);\n // Only create index.js if we cannot resolve the existing entry point (after replacing the expo entry).\n if (!bareEntryFile) {\n targetPaths.push('index.js');\n }\n\n debug(`Files to copy:`, targetPaths);\n return targetPaths;\n}\n\nexport function resolveBareEntryFile(projectRoot: string, main: any) {\n // expo app entry is not needed for bare projects.\n if (isPkgMainExpoAppEntry(main)) {\n return null;\n }\n // Look at the `package.json`s `main` field for the main file.\n const resolvedMainField = main ?? './index';\n // Get a list of possible extensions for the main file.\n const extensions = getBareExtensions(['ios', 'android']);\n // Testing the main field against all of the provided extensions - for legacy reasons we can't use node module resolution as the package.json allows you to pass in a file without a relative path and expect it as a relative path.\n return getFileWithExtensions(projectRoot, resolvedMainField, extensions);\n}\n"],"names":["createCopyFilesSuccessMessage","copyTemplateFilesAsync","resolveBareEntryFile","debug","require","hasAllPlatformSpecificGitIgnores","projectRoot","platforms","reduce","p","platform","fs","existsSync","path","join","skippedPaths","gitignore","message","length","chalk","dim","map","bold","didMerge","didClear","pkg","templateDirectory","copyFilePaths","getFilePathsToCopy","copyResults","copyPathsFromTemplateAsync","hasPlatformSpecificGitIgnores","mergeGitIgnorePaths","copiedPaths","copyFilePath","projectPath","directoryExistsAsync","push","copySync","targetPaths","bareEntryFile","main","isPkgMainExpoAppEntry","resolvedMainField","extensions","getBareExtensions","getFileWithExtensions"],"mappings":"AAAA;;;;QAqCgBA,6BAA6B,GAA7BA,6BAA6B;QAsBvBC,sBAAsB,GAAtBA,sBAAsB;QAgF5BC,oBAAoB,GAApBA,oBAAoB;AAxIqB,IAAA,MAAoB,WAApB,oBAAoB,CAAA;AAC3D,IAAA,MAAO,kCAAP,OAAO,EAAA;AACV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEwB,IAAA,IAAc,WAAd,cAAc,CAAA;AACzB,IAAA,oBAA8B,WAA9B,8BA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AI,GAAI,SAAS,AAAC;IAC5C,uDAAuD;IACvD,MAAMG,UAAU,GAAGC,CAAAA,GAAAA,MAAiB,AAAoB,CAAA,kBAApB,CAAC;QAAC,KAAK;QAAE,SAAS;KAAC,CAAC,AAAC;IACzD,oOAAoO;IACpO,OAAOC,CAAAA,GAAAA,MAAqB,AAA4C,CAAA,sBAA5C,CAACxC,WAAW,EAAEqC,iBAAiB,EAAEC,UAAU,CAAC,CAAC;CAC1E"}
|
|
@@ -38,6 +38,8 @@ const expoPrebuild = async (argv)=>{
|
|
|
38
38
|
"--help": Boolean,
|
|
39
39
|
"--clean": Boolean,
|
|
40
40
|
"--npm": Boolean,
|
|
41
|
+
"--pnpm": Boolean,
|
|
42
|
+
"--yarn": Boolean,
|
|
41
43
|
"--no-install": Boolean,
|
|
42
44
|
"--template": String,
|
|
43
45
|
"--platform": String,
|
|
@@ -52,7 +54,9 @@ const expoPrebuild = async (argv)=>{
|
|
|
52
54
|
_chalk.default`<dir> Directory of the Expo project. {dim Default: Current working directory}`,
|
|
53
55
|
`--no-install Skip installing npm packages and CocoaPods`,
|
|
54
56
|
`--clean Delete the native folders and regenerate them before applying changes`,
|
|
55
|
-
_chalk.default`--npm Use npm to install dependencies. {dim Default when
|
|
57
|
+
_chalk.default`--npm Use npm to install dependencies. {dim Default when package-lock.json exists}`,
|
|
58
|
+
_chalk.default`--yarn Use Yarn to install dependencies. {dim Default when yarn.lock exists}`,
|
|
59
|
+
_chalk.default`--pnpm Use pnpm to install dependencies. {dim Default when pnpm-lock.yaml exists}`,
|
|
56
60
|
`--template <template> Project template to clone from. File path pointing to a local tar file or a github repo`,
|
|
57
61
|
_chalk.default`-p, --platform <all|android|ios> Platforms to sync: ios, android, all. {dim Default: all}`,
|
|
58
62
|
`--skip-dependency-update <dependencies> Preserves versions of listed packages in package.json (comma separated list)`,
|
|
@@ -62,7 +66,7 @@ const expoPrebuild = async (argv)=>{
|
|
|
62
66
|
// Load modules after the help prompt so `npx expo prebuild -h` shows as fast as possible.
|
|
63
67
|
const [// ./prebuildAsync
|
|
64
68
|
{ prebuildAsync }, // ./resolveOptions
|
|
65
|
-
{ resolvePlatformOption , resolveSkipDependencyUpdate }, // ../utils/errors
|
|
69
|
+
{ resolvePlatformOption , resolvePackageManagerOptions , resolveSkipDependencyUpdate }, // ../utils/errors
|
|
66
70
|
{ logCmdError }, ] = await Promise.all([
|
|
67
71
|
Promise.resolve().then(function() {
|
|
68
72
|
return _interopRequireWildcard(require("./prebuildAsync"));
|
|
@@ -74,16 +78,18 @@ const expoPrebuild = async (argv)=>{
|
|
|
74
78
|
return _interopRequireWildcard(require("../utils/errors"));
|
|
75
79
|
}),
|
|
76
80
|
]);
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
return (()=>{
|
|
82
|
+
return prebuildAsync((0, _args).getProjectRoot(args), {
|
|
83
|
+
// Parsed options
|
|
84
|
+
clean: args["--clean"],
|
|
85
|
+
packageManager: resolvePackageManagerOptions(args),
|
|
86
|
+
install: !args["--no-install"],
|
|
87
|
+
platforms: resolvePlatformOption(args["--platform"]),
|
|
88
|
+
// TODO: Parse
|
|
89
|
+
skipDependencyUpdate: resolveSkipDependencyUpdate(args["--skip-dependency-update"]),
|
|
90
|
+
template: args["--template"]
|
|
91
|
+
});
|
|
92
|
+
})().catch(logCmdError);
|
|
87
93
|
};
|
|
88
94
|
exports.expoPrebuild = expoPrebuild;
|
|
89
95
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prebuild/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\n\nimport { Command } from '../../bin/cli';\nimport { assertArgs, getProjectRoot, printHelp } from '../utils/args';\n\nexport const expoPrebuild: Command = async (argv) => {\n const args = assertArgs(\n {\n // Types\n '--help': Boolean,\n '--clean': Boolean,\n '--npm': Boolean,\n '--no-install': Boolean,\n '--template': String,\n '--platform': String,\n '--skip-dependency-update': String,\n // Aliases\n '-h': '--help',\n '-p': '--platform',\n '-t': '--type',\n },\n argv\n );\n\n if (args['--help']) {\n printHelp(\n `Create native iOS and Android project files for building natively`,\n chalk`npx expo prebuild {dim <dir>}`,\n [\n chalk`<dir> Directory of the Expo project. {dim Default: Current working directory}`,\n `--no-install Skip installing npm packages and CocoaPods`,\n `--clean Delete the native folders and regenerate them before applying changes`,\n chalk`--npm Use npm to install dependencies. {dim Default when Yarn
|
|
1
|
+
{"version":3,"sources":["../../../src/prebuild/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\n\nimport { Command } from '../../bin/cli';\nimport { assertArgs, getProjectRoot, printHelp } from '../utils/args';\n\nexport const expoPrebuild: Command = async (argv) => {\n const args = assertArgs(\n {\n // Types\n '--help': Boolean,\n '--clean': Boolean,\n '--npm': Boolean,\n '--pnpm': Boolean,\n '--yarn': Boolean,\n '--no-install': Boolean,\n '--template': String,\n '--platform': String,\n '--skip-dependency-update': String,\n // Aliases\n '-h': '--help',\n '-p': '--platform',\n '-t': '--type',\n },\n argv\n );\n\n if (args['--help']) {\n printHelp(\n `Create native iOS and Android project files for building natively`,\n chalk`npx expo prebuild {dim <dir>}`,\n [\n chalk`<dir> Directory of the Expo project. {dim Default: Current working directory}`,\n `--no-install Skip installing npm packages and CocoaPods`,\n `--clean Delete the native folders and regenerate them before applying changes`,\n chalk`--npm Use npm to install dependencies. {dim Default when package-lock.json exists}`,\n chalk`--yarn Use Yarn to install dependencies. {dim Default when yarn.lock exists}`,\n chalk`--pnpm Use pnpm to install dependencies. {dim Default when pnpm-lock.yaml exists}`,\n `--template <template> Project template to clone from. File path pointing to a local tar file or a github repo`,\n chalk`-p, --platform <all|android|ios> Platforms to sync: ios, android, all. {dim Default: all}`,\n `--skip-dependency-update <dependencies> Preserves versions of listed packages in package.json (comma separated list)`,\n `-h, --help Usage info`,\n ].join('\\n')\n );\n }\n\n // Load modules after the help prompt so `npx expo prebuild -h` shows as fast as possible.\n const [\n // ./prebuildAsync\n { prebuildAsync },\n // ./resolveOptions\n { resolvePlatformOption, resolvePackageManagerOptions, resolveSkipDependencyUpdate },\n // ../utils/errors\n { logCmdError },\n ] = await Promise.all([\n import('./prebuildAsync'),\n import('./resolveOptions'),\n import('../utils/errors'),\n ]);\n\n return (() => {\n return prebuildAsync(getProjectRoot(args), {\n // Parsed options\n clean: args['--clean'],\n\n packageManager: resolvePackageManagerOptions(args),\n install: !args['--no-install'],\n platforms: resolvePlatformOption(args['--platform']),\n // TODO: Parse\n skipDependencyUpdate: resolveSkipDependencyUpdate(args['--skip-dependency-update']),\n template: args['--template'],\n });\n })().catch(logCmdError);\n};\n"],"names":["expoPrebuild","argv","args","assertArgs","Boolean","String","printHelp","chalk","join","prebuildAsync","resolvePlatformOption","resolvePackageManagerOptions","resolveSkipDependencyUpdate","logCmdError","Promise","all","getProjectRoot","clean","packageManager","install","platforms","skipDependencyUpdate","template","catch"],"mappings":"AAAA;;;;;;AACkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAG6B,IAAA,KAAe,WAAf,eAAe,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9D,MAAMA,YAAY,GAAY,OAAOC,IAAI,GAAK;IACnD,MAAMC,IAAI,GAAGC,CAAAA,GAAAA,KAAU,AAkBtB,CAAA,WAlBsB,CACrB;QACE,QAAQ;QACR,QAAQ,EAAEC,OAAO;QACjB,SAAS,EAAEA,OAAO;QAClB,OAAO,EAAEA,OAAO;QAChB,QAAQ,EAAEA,OAAO;QACjB,QAAQ,EAAEA,OAAO;QACjB,cAAc,EAAEA,OAAO;QACvB,YAAY,EAAEC,MAAM;QACpB,YAAY,EAAEA,MAAM;QACpB,0BAA0B,EAAEA,MAAM;QAClC,UAAU;QACV,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,QAAQ;KACf,EACDJ,IAAI,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,YAAY,CAAC,CAAC;YACpD,cAAc;YACdmB,oBAAoB,EAAET,2BAA2B,CAACV,IAAI,CAAC,0BAA0B,CAAC,CAAC;YACnFoB,QAAQ,EAAEpB,IAAI,CAAC,YAAY,CAAC;SAC7B,CAAC,CAAC;KACJ,CAAC,EAAE,CAACqB,KAAK,CAACV,WAAW,CAAC,CAAC;CACzB,AAAC;QAnEWb,YAAY,GAAZA,YAAY"}
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.prebuildAsync = prebuildAsync;
|
|
6
|
-
var
|
|
6
|
+
var _installAsync = require("../install/installAsync");
|
|
7
|
+
var _env = require("../utils/env");
|
|
7
8
|
var _nodeModules = require("../utils/nodeModules");
|
|
8
9
|
var _ora = require("../utils/ora");
|
|
9
10
|
var _profile = require("../utils/profile");
|
|
@@ -33,6 +34,7 @@ function _interopRequireWildcard(obj) {
|
|
|
33
34
|
return newObj;
|
|
34
35
|
}
|
|
35
36
|
}
|
|
37
|
+
const debug = require("debug")("expo:prebuild");
|
|
36
38
|
async function prebuildAsync(projectRoot, options) {
|
|
37
39
|
if (options.clean) {
|
|
38
40
|
const { maybeBailOnGitStatusAsync } = await Promise.resolve().then(function() {
|
|
@@ -65,16 +67,14 @@ async function prebuildAsync(projectRoot, options) {
|
|
|
65
67
|
skipDependencyUpdate: options.skipDependencyUpdate
|
|
66
68
|
});
|
|
67
69
|
// Install node modules
|
|
68
|
-
const packageManager = (0, _nodeModules).resolvePackageManager({
|
|
69
|
-
install: options.install,
|
|
70
|
-
npm: options.packageManager === "npm",
|
|
71
|
-
yarn: options.packageManager === "yarn"
|
|
72
|
-
});
|
|
73
70
|
if (options.install) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
var ref;
|
|
72
|
+
if (hasNewDependencies && ((ref = options.packageManager) == null ? void 0 : ref.npm)) {
|
|
73
|
+
await (0, _nodeModules).clearNodeModulesAsync(projectRoot);
|
|
74
|
+
}
|
|
75
|
+
await (0, _installAsync).installAsync([], {
|
|
76
|
+
...options.packageManager,
|
|
77
|
+
silent: !_env.env.EXPO_DEBUG
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
// Apply Expo config to native projects
|
|
@@ -97,10 +97,9 @@ async function prebuildAsync(projectRoot, options) {
|
|
|
97
97
|
});
|
|
98
98
|
podsInstalled = await installCocoaPodsAsync(projectRoot);
|
|
99
99
|
} else {
|
|
100
|
-
|
|
100
|
+
debug("Skipped pod install");
|
|
101
101
|
}
|
|
102
102
|
return {
|
|
103
|
-
packageManager,
|
|
104
103
|
nodeInstall: !!options.install,
|
|
105
104
|
podInstall: !podsInstalled,
|
|
106
105
|
platforms: options.platforms,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prebuild/prebuildAsync.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\n\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/prebuild/prebuildAsync.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\n\nimport { installAsync } from '../install/installAsync';\nimport { env } from '../utils/env';\nimport { clearNodeModulesAsync } from '../utils/nodeModules';\nimport { logNewSection } from '../utils/ora';\nimport { profile } from '../utils/profile';\nimport { clearNativeFolder, promptToClearMalformedNativeProjectsAsync } from './clearNativeFolder';\nimport { configureProjectAsync } from './configureProjectAsync';\nimport { ensureConfigAsync } from './ensureConfigAsync';\nimport { assertPlatforms, ensureValidPlatforms, resolveTemplateOption } from './resolveOptions';\nimport { updateFromTemplateAsync } from './updateFromTemplate';\n\nconst debug = require('debug')('expo:prebuild') as typeof console.log;\n\nexport type PrebuildResults = {\n /** Expo config. */\n exp: ExpoConfig;\n /** Indicates if the process created new files. */\n hasNewProjectFiles: boolean;\n /** The platforms that were prebuilt. */\n platforms: ModPlatform[];\n /** Indicates if pod install was run. */\n podInstall: boolean;\n /** Indicates if node modules were installed. */\n nodeInstall: boolean;\n};\n\n/**\n * Entry point into the prebuild process, delegates to other helpers to perform various steps.\n *\n * 0. Attempt to clean the project folders.\n * 1. Create native projects (ios, android).\n * 2. Install node modules.\n * 3. Apply config to native projects.\n * 4. Install CocoaPods.\n */\nexport async function prebuildAsync(\n projectRoot: string,\n options: {\n /** Should install node modules and cocoapods. */\n install?: boolean;\n /** List of platforms to prebuild. */\n platforms: ModPlatform[];\n /** Should delete the native folders before attempting to prebuild. */\n clean?: boolean;\n /** URL or file path to the prebuild template. */\n template?: string;\n /** Name of the node package manager to install with. */\n packageManager?: {\n npm?: boolean;\n yarn?: boolean;\n pnpm?: boolean;\n };\n /** List of node modules to skip updating. */\n skipDependencyUpdate?: string[];\n }\n): Promise<PrebuildResults | null> {\n if (options.clean) {\n const { maybeBailOnGitStatusAsync } = await import('../utils/git');\n // Clean the project folders...\n if (await maybeBailOnGitStatusAsync()) {\n return null;\n }\n // Clear the native folders before syncing\n await clearNativeFolder(projectRoot, options.platforms);\n } else {\n // Check if the existing project folders are malformed.\n await promptToClearMalformedNativeProjectsAsync(projectRoot, options.platforms);\n }\n\n // Warn if the project is attempting to prebuild an unsupported platform (iOS on Windows).\n options.platforms = ensureValidPlatforms(options.platforms);\n // Assert if no platforms are left over after filtering.\n assertPlatforms(options.platforms);\n\n // Get the Expo config, create it if missing.\n const { exp, pkg } = await ensureConfigAsync(projectRoot, { platforms: options.platforms });\n\n // Create native projects from template.\n const { hasNewProjectFiles, needsPodInstall, hasNewDependencies } = await updateFromTemplateAsync(\n projectRoot,\n {\n exp,\n pkg,\n template: options.template != null ? resolveTemplateOption(options.template) : undefined,\n platforms: options.platforms,\n skipDependencyUpdate: options.skipDependencyUpdate,\n }\n );\n\n // Install node modules\n if (options.install) {\n if (hasNewDependencies && options.packageManager?.npm) {\n await clearNodeModulesAsync(projectRoot);\n }\n\n await installAsync([], {\n ...options.packageManager,\n silent: !env.EXPO_DEBUG,\n });\n }\n\n // Apply Expo config to native projects\n const configSyncingStep = logNewSection('Config syncing');\n try {\n await profile(configureProjectAsync)(projectRoot, {\n platforms: options.platforms,\n });\n configSyncingStep.succeed('Config synced');\n } catch (error) {\n configSyncingStep.fail('Config sync failed');\n throw error;\n }\n\n // Install CocoaPods\n let podsInstalled: boolean = false;\n // err towards running pod install less because it's slow and users can easily run npx pod-install afterwards.\n if (options.platforms.includes('ios') && options.install && needsPodInstall) {\n const { installCocoaPodsAsync } = await import('../utils/cocoapods');\n\n podsInstalled = await installCocoaPodsAsync(projectRoot);\n } else {\n debug('Skipped pod install');\n }\n\n return {\n nodeInstall: !!options.install,\n podInstall: !podsInstalled,\n platforms: options.platforms,\n hasNewProjectFiles,\n exp,\n };\n}\n"],"names":["prebuildAsync","debug","require","projectRoot","options","clean","maybeBailOnGitStatusAsync","clearNativeFolder","platforms","promptToClearMalformedNativeProjectsAsync","ensureValidPlatforms","assertPlatforms","exp","pkg","ensureConfigAsync","hasNewProjectFiles","needsPodInstall","hasNewDependencies","updateFromTemplateAsync","template","resolveTemplateOption","undefined","skipDependencyUpdate","install","packageManager","npm","clearNodeModulesAsync","installAsync","silent","env","EXPO_DEBUG","configSyncingStep","logNewSection","profile","configureProjectAsync","succeed","error","fail","podsInstalled","includes","installCocoaPodsAsync","nodeInstall","podInstall"],"mappings":"AAAA;;;;QAsCsBA,aAAa,GAAbA,aAAa;AAnCN,IAAA,aAAyB,WAAzB,yBAAyB,CAAA;AAClC,IAAA,IAAc,WAAd,cAAc,CAAA;AACI,IAAA,YAAsB,WAAtB,sBAAsB,CAAA;AAC9B,IAAA,IAAc,WAAd,cAAc,CAAA;AACpB,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;AACmC,IAAA,kBAAqB,WAArB,qBAAqB,CAAA;AAC5D,IAAA,sBAAyB,WAAzB,yBAAyB,CAAA;AAC7B,IAAA,kBAAqB,WAArB,qBAAqB,CAAA;AACsB,IAAA,eAAkB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,CAAC,CAAC;QAC7C,MAAMD,KAAK,CAAC;KACb;IAED,oBAAoB;IACpB,IAAIE,aAAa,GAAY,KAAK,AAAC;IACnC,8GAA8G;IAC9G,IAAIlC,OAAO,CAACI,SAAS,CAAC+B,QAAQ,CAAC,KAAK,CAAC,IAAInC,OAAO,CAACmB,OAAO,IAAIP,eAAe,EAAE;QAC3E,MAAM,EAAEwB,qBAAqB,CAAA,EAAE,GAAG,MAAM;mDAAO,oBAAoB;UAAC,AAAC;QAErEF,aAAa,GAAG,MAAME,qBAAqB,CAACrC,WAAW,CAAC,CAAC;KAC1D,MAAM;QACLF,KAAK,CAAC,qBAAqB,CAAC,CAAC;KAC9B;IAED,OAAO;QACLwC,WAAW,EAAE,CAAC,CAACrC,OAAO,CAACmB,OAAO;QAC9BmB,UAAU,EAAE,CAACJ,aAAa;QAC1B9B,SAAS,EAAEJ,OAAO,CAACI,SAAS;QAC5BO,kBAAkB;QAClBH,GAAG;KACJ,CAAC;CACH"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
+
exports.resolvePackageManagerOptions = resolvePackageManagerOptions;
|
|
5
6
|
exports.resolveTemplateOption = resolveTemplateOption;
|
|
6
7
|
exports.resolveSkipDependencyUpdate = resolveSkipDependencyUpdate;
|
|
7
8
|
exports.resolvePlatformOption = resolvePlatformOption;
|
|
@@ -40,6 +41,22 @@ function _interopRequireWildcard(obj) {
|
|
|
40
41
|
return newObj;
|
|
41
42
|
}
|
|
42
43
|
}
|
|
44
|
+
function resolvePackageManagerOptions(args) {
|
|
45
|
+
const managers = {
|
|
46
|
+
npm: args["--npm"],
|
|
47
|
+
yarn: args["--yarn"],
|
|
48
|
+
pnpm: args["--pnpm"]
|
|
49
|
+
};
|
|
50
|
+
if ([
|
|
51
|
+
managers.npm,
|
|
52
|
+
managers.pnpm,
|
|
53
|
+
managers.yarn,
|
|
54
|
+
!!args["--no-install"]
|
|
55
|
+
].filter(Boolean).length > 1) {
|
|
56
|
+
throw new _errors.CommandError("BAD_ARGS", "Specify at most one of: --no-install, --npm, --pnpm, --yarn");
|
|
57
|
+
}
|
|
58
|
+
return managers;
|
|
59
|
+
}
|
|
43
60
|
function resolveTemplateOption(template) {
|
|
44
61
|
if ((0, _url).validateUrl(template)) {
|
|
45
62
|
return template;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prebuild/resolveOptions.ts"],"sourcesContent":["import { ModPlatform } from '@expo/config-plugins';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport * as Log from '../log';\nimport { CommandError } from '../utils/errors';\nimport { validateUrl } from '../utils/url';\n\n/** Resolves a template option as a URL or file path pointing to a tar file. */\nexport function resolveTemplateOption(template: string) {\n if (validateUrl(template)) {\n return template;\n }\n const templatePath = path.resolve(template);\n assert(fs.existsSync(templatePath), 'template file does not exist: ' + templatePath);\n assert(\n fs.statSync(templatePath).isFile(),\n 'template must be a tar file created by running `npm pack` in a project: ' + templatePath\n );\n\n return templatePath;\n}\n\n/** Resolves dependencies to skip from a string joined by `,`. Example: `react-native,expo,lodash` */\nexport function resolveSkipDependencyUpdate(value: any) {\n if (!value || typeof value !== 'string') {\n return [];\n }\n return value.split(',');\n}\n\n/** Returns an array of platforms based on the input platform identifier and runtime constraints. */\nexport function resolvePlatformOption(\n platform: string = 'all',\n { loose }: { loose?: boolean } = {}\n): ModPlatform[] {\n switch (platform) {\n case 'ios':\n return ['ios'];\n case 'android':\n return ['android'];\n case 'all':\n if (loose || process.platform !== 'win32') {\n return ['android', 'ios'];\n }\n return ['android'];\n default:\n throw new CommandError(`Unsupported platform \"${platform}\". Options are: ios, android, all`);\n }\n}\n\n/** Warns and filters out unsupported platforms based on the runtime constraints. Essentially this means no iOS on Windows devices. */\nexport function ensureValidPlatforms(platforms: ModPlatform[]): ModPlatform[] {\n // Skip ejecting for iOS on Windows\n if (process.platform === 'win32' && platforms.includes('ios')) {\n Log.warn(\n chalk`⚠️ Skipping generating the iOS native project files. Run {bold expo eject} again from macOS or Linux to generate the iOS project.\\n`\n );\n return platforms.filter((platform) => platform !== 'ios');\n }\n return platforms;\n}\n\n/** Asserts platform length must be greater than zero. */\nexport function assertPlatforms(platforms: ModPlatform[]) {\n if (!platforms?.length) {\n throw new CommandError('At least one platform must be enabled when syncing');\n }\n}\n"],"names":["resolveTemplateOption","resolveSkipDependencyUpdate","resolvePlatformOption","ensureValidPlatforms","assertPlatforms","Log","template","validateUrl","templatePath","path","resolve","assert","fs","existsSync","statSync","isFile","value","split","platform","loose","process","
|
|
1
|
+
{"version":3,"sources":["../../../src/prebuild/resolveOptions.ts"],"sourcesContent":["import { ModPlatform } from '@expo/config-plugins';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport * as Log from '../log';\nimport { CommandError } from '../utils/errors';\nimport { validateUrl } from '../utils/url';\n\nexport function resolvePackageManagerOptions(args: any) {\n const managers: Record<string, boolean> = {\n npm: args['--npm'],\n yarn: args['--yarn'],\n pnpm: args['--pnpm'],\n };\n\n if (\n [managers.npm, managers.pnpm, managers.yarn, !!args['--no-install']].filter(Boolean).length > 1\n ) {\n throw new CommandError(\n 'BAD_ARGS',\n 'Specify at most one of: --no-install, --npm, --pnpm, --yarn'\n );\n }\n\n return managers;\n}\n\n/** Resolves a template option as a URL or file path pointing to a tar file. */\nexport function resolveTemplateOption(template: string) {\n if (validateUrl(template)) {\n return template;\n }\n const templatePath = path.resolve(template);\n assert(fs.existsSync(templatePath), 'template file does not exist: ' + templatePath);\n assert(\n fs.statSync(templatePath).isFile(),\n 'template must be a tar file created by running `npm pack` in a project: ' + templatePath\n );\n\n return templatePath;\n}\n\n/** Resolves dependencies to skip from a string joined by `,`. Example: `react-native,expo,lodash` */\nexport function resolveSkipDependencyUpdate(value: any) {\n if (!value || typeof value !== 'string') {\n return [];\n }\n return value.split(',');\n}\n\n/** Returns an array of platforms based on the input platform identifier and runtime constraints. */\nexport function resolvePlatformOption(\n platform: string = 'all',\n { loose }: { loose?: boolean } = {}\n): ModPlatform[] {\n switch (platform) {\n case 'ios':\n return ['ios'];\n case 'android':\n return ['android'];\n case 'all':\n if (loose || process.platform !== 'win32') {\n return ['android', 'ios'];\n }\n return ['android'];\n default:\n throw new CommandError(`Unsupported platform \"${platform}\". Options are: ios, android, all`);\n }\n}\n\n/** Warns and filters out unsupported platforms based on the runtime constraints. Essentially this means no iOS on Windows devices. */\nexport function ensureValidPlatforms(platforms: ModPlatform[]): ModPlatform[] {\n // Skip ejecting for iOS on Windows\n if (process.platform === 'win32' && platforms.includes('ios')) {\n Log.warn(\n chalk`⚠️ Skipping generating the iOS native project files. Run {bold expo eject} again from macOS or Linux to generate the iOS project.\\n`\n );\n return platforms.filter((platform) => platform !== 'ios');\n }\n return platforms;\n}\n\n/** Asserts platform length must be greater than zero. */\nexport function assertPlatforms(platforms: ModPlatform[]) {\n if (!platforms?.length) {\n throw new CommandError('At least one platform must be enabled when syncing');\n }\n}\n"],"names":["resolvePackageManagerOptions","resolveTemplateOption","resolveSkipDependencyUpdate","resolvePlatformOption","ensureValidPlatforms","assertPlatforms","Log","args","managers","npm","yarn","pnpm","filter","Boolean","length","CommandError","template","validateUrl","templatePath","path","resolve","assert","fs","existsSync","statSync","isFile","value","split","platform","loose","process","platforms","includes","warn","chalk"],"mappings":"AAAA;;;;QAUgBA,4BAA4B,GAA5BA,4BAA4B;QAoB5BC,qBAAqB,GAArBA,qBAAqB;QAerBC,2BAA2B,GAA3BA,2BAA2B;QAQ3BC,qBAAqB,GAArBA,qBAAqB;QAoBrBC,oBAAoB,GAApBA,oBAAoB;QAYpBC,eAAe,GAAfA,eAAe;AApFZ,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACT,IAAA,MAAO,kCAAP,OAAO,EAAA;AACV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,KAAM,k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AM,IAAIC,OAAY,aAAA,CAAC,oDAAoD,CAAC,CAAC;KAC9E;CACF"}
|
|
@@ -39,6 +39,7 @@ function _interopRequireWildcard(obj) {
|
|
|
39
39
|
return newObj;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
+
const debug = require("debug")("expo:prebuild:resolveTemplate");
|
|
42
43
|
async function cloneTemplateAsync({ templateDirectory , template , exp , ora }) {
|
|
43
44
|
if (template) {
|
|
44
45
|
await resolveTemplateArgAsync(templateDirectory, ora, exp.name, template);
|
|
@@ -97,7 +98,7 @@ async function downloadAndExtractRepoAsync(root, { username , name , branch , fi
|
|
|
97
98
|
const projectName = _path.default.basename(root);
|
|
98
99
|
const strip = filePath ? filePath.split("/").length + 1 : 1;
|
|
99
100
|
const url = `https://codeload.github.com/${username}/${name}/tar.gz/${branch}`;
|
|
100
|
-
|
|
101
|
+
debug("Downloading tarball from:", url);
|
|
101
102
|
await (0, _npm).extractNpmTarballFromUrlAsync(url, {
|
|
102
103
|
cwd: root,
|
|
103
104
|
name: projectName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prebuild/resolveTemplate.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport fetch from 'node-fetch';\nimport { Ora } from 'ora';\nimport path from 'path';\nimport semver from 'semver';\n\nimport * as Log from '../log';\nimport { AbortCommandError, CommandError } from '../utils/errors';\nimport {\n downloadAndExtractNpmModuleAsync,\n extractLocalNpmTarballAsync,\n extractNpmTarballFromUrlAsync,\n} from '../utils/npm';\nimport { isUrlOk } from '../utils/url';\n\ntype RepoInfo = {\n username: string;\n name: string;\n branch: string;\n filePath: string;\n};\n\nexport async function cloneTemplateAsync({\n templateDirectory,\n template,\n exp,\n ora,\n}: {\n templateDirectory: string;\n template?: string;\n exp: Pick<ExpoConfig, 'name' | 'sdkVersion'>;\n ora: Ora;\n}) {\n if (template) {\n await resolveTemplateArgAsync(templateDirectory, ora, exp.name, template);\n } else {\n const templatePackageName = await getTemplateNpmPackageName(exp.sdkVersion);\n await downloadAndExtractNpmModuleAsync(templatePackageName, {\n cwd: templateDirectory,\n name: exp.name,\n });\n }\n}\n\n/** Given an `sdkVersion` like `44.0.0` return a fully qualified NPM package name like: `expo-template-bare-minimum@sdk-44` */\nfunction getTemplateNpmPackageName(sdkVersion?: string): string {\n // When undefined or UNVERSIONED, we use the latest version.\n if (!sdkVersion || sdkVersion === 'UNVERSIONED') {\n Log.log('Using an unspecified Expo SDK version. The latest template will be used.');\n return `expo-template-bare-minimum@latest`;\n }\n return `expo-template-bare-minimum@sdk-${semver.major(sdkVersion)}`;\n}\n\nasync function getRepoInfo(url: any, examplePath?: string): Promise<RepoInfo | undefined> {\n const [, username, name, t, _branch, ...file] = url.pathname.split('/');\n const filePath = examplePath ? examplePath.replace(/^\\//, '') : file.join('/');\n\n // Support repos whose entire purpose is to be an example, e.g.\n // https://github.com/:username/:my-cool-example-repo-name.\n if (t === undefined) {\n const infoResponse = await fetch(`https://api.github.com/repos/${username}/${name}`);\n if (infoResponse.status !== 200) {\n return;\n }\n const info = await infoResponse.json();\n return { username, name, branch: info['default_branch'], filePath };\n }\n\n // If examplePath is available, the branch name takes the entire path\n const branch = examplePath\n ? `${_branch}/${file.join('/')}`.replace(new RegExp(`/${filePath}|/$`), '')\n : _branch;\n\n if (username && name && branch && t === 'tree') {\n return { username, name, branch, filePath };\n }\n return undefined;\n}\n\nfunction hasRepo({ username, name, branch, filePath }: RepoInfo) {\n const contentsUrl = `https://api.github.com/repos/${username}/${name}/contents`;\n const packagePath = `${filePath ? `/${filePath}` : ''}/package.json`;\n\n return isUrlOk(contentsUrl + packagePath + `?ref=${branch}`);\n}\n\nasync function downloadAndExtractRepoAsync(\n root: string,\n { username, name, branch, filePath }: RepoInfo\n): Promise<void> {\n const projectName = path.basename(root);\n\n const strip = filePath ? filePath.split('/').length + 1 : 1;\n\n const url = `https://codeload.github.com/${username}/${name}/tar.gz/${branch}`;\n Log.debug('Downloading tarball from:', url);\n await extractNpmTarballFromUrlAsync(url, {\n cwd: root,\n name: projectName,\n strip,\n fileList: [`${name}-${branch}${filePath ? `/${filePath}` : ''}`],\n });\n}\n\nexport async function resolveTemplateArgAsync(\n templateDirectory: string,\n oraInstance: Ora,\n appName: string,\n template: string,\n templatePath?: string\n) {\n let repoInfo: RepoInfo | undefined;\n\n if (template) {\n // @ts-ignore\n let repoUrl: URL | undefined;\n\n try {\n // @ts-ignore\n repoUrl = new URL(template);\n } catch (error: any) {\n if (error.code !== 'ERR_INVALID_URL') {\n oraInstance.fail(error);\n throw error;\n }\n }\n\n if (!repoUrl) {\n const templatePath = path.resolve(template);\n if (!fs.existsSync(templatePath)) {\n throw new CommandError(`template file does not exist: ${templatePath}`);\n }\n\n await extractLocalNpmTarballAsync(templatePath, { cwd: templateDirectory, name: appName });\n return templateDirectory;\n }\n\n if (repoUrl.origin !== 'https://github.com') {\n oraInstance.fail(\n `Invalid URL: ${chalk.red(\n `\"${template}\"`\n )}. Only GitHub repositories are supported. Please use a GitHub URL and try again.`\n );\n throw new AbortCommandError();\n }\n\n repoInfo = await getRepoInfo(repoUrl, templatePath);\n\n if (!repoInfo) {\n oraInstance.fail(\n `Found invalid GitHub URL: ${chalk.red(`\"${template}\"`)}. Please fix the URL and try again.`\n );\n throw new AbortCommandError();\n }\n\n const found = await hasRepo(repoInfo);\n\n if (!found) {\n oraInstance.fail(\n `Could not locate the repository for ${chalk.red(\n `\"${template}\"`\n )}. Please check that the repository exists and try again.`\n );\n throw new AbortCommandError();\n }\n }\n\n if (repoInfo) {\n oraInstance.text = chalk.bold(\n `Downloading files from repo ${chalk.cyan(template)}. This might take a moment.`\n );\n\n await downloadAndExtractRepoAsync(templateDirectory, repoInfo);\n }\n\n return true;\n}\n"],"names":["cloneTemplateAsync","resolveTemplateArgAsync","Log","templateDirectory","template","exp","ora","name","templatePackageName","getTemplateNpmPackageName","sdkVersion","downloadAndExtractNpmModuleAsync","cwd","log","semver","major","getRepoInfo","url","examplePath","username","t","_branch","file","pathname","split","filePath","replace","join","undefined","infoResponse","fetch","status","info","json","branch","RegExp","hasRepo","contentsUrl","packagePath","isUrlOk","downloadAndExtractRepoAsync","root","projectName","path","basename","strip","length","debug","extractNpmTarballFromUrlAsync","fileList","oraInstance","appName","templatePath","repoInfo","repoUrl","URL","error","code","fail","resolve","fs","existsSync","CommandError","extractLocalNpmTarballAsync","origin","chalk","red","AbortCommandError","found","text","bold","cyan"],"mappings":"AAAA;;;;QAwBsBA,kBAAkB,GAAlBA,kBAAkB;QAmFlBC,uBAAuB,GAAvBA,uBAAuB;AA1G3B,IAAA,MAAO,kCAAP,OAAO,EAAA;AACV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACD,IAAA,UAAY,kCAAZ,YAAY,EAAA;AAEb,IAAA,KAAM,kCAAN,MAAM,EAAA;AACJ,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AAEfC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACiC,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;AAK1D,IAAA,IAAc,WAAd,cAAc,CAAA;AACG,IAAA,IAAc,WAAd,cAAc,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAS/B,eAAeF,kBAAkB,CAAC,EACvCG,iBAAiB,CAAA,EACjBC,QAAQ,CAAA,EACRC,GAAG,CAAA,EACHC,GAAG,CAAA,EAMJ,EAAE;IACD,IAAIF,QAAQ,EAAE;QACZ,MAAMH,uBAAuB,CAACE,iBAAiB,EAAEG,GAAG,EAAED,GAAG,CAACE,IAAI,EAAEH,QAAQ,CAAC,CAAC;KAC3E,MAAM;QACL,MAAMI,mBAAmB,GAAG,MAAMC,yBAAyB,CAACJ,GAAG,CAACK,UAAU,CAAC,AAAC;QAC5E,MAAMC,CAAAA,GAAAA,IAAgC,AAGpC,CAAA,iCAHoC,CAACH,mBAAmB,EAAE;YAC1DI,GAAG,EAAET,iBAAiB;YACtBI,IAAI,E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K,QAAA,CAACK,IAAI,CAC3B,CAAC,4BAA4B,EAAEL,MAAK,QAAA,CAACM,IAAI,CAACnE,QAAQ,CAAC,CAAC,2BAA2B,CAAC,CACjF,CAAC;QAEF,MAAMoC,2BAA2B,CAACrC,iBAAiB,EAAEkD,QAAQ,CAAC,CAAC;KAChE;IAED,OAAO,IAAI,CAAC;CACb"}
|
|
1
|
+
{"version":3,"sources":["../../../src/prebuild/resolveTemplate.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport fetch from 'node-fetch';\nimport { Ora } from 'ora';\nimport path from 'path';\nimport semver from 'semver';\n\nimport * as Log from '../log';\nimport { AbortCommandError, CommandError } from '../utils/errors';\nimport {\n downloadAndExtractNpmModuleAsync,\n extractLocalNpmTarballAsync,\n extractNpmTarballFromUrlAsync,\n} from '../utils/npm';\nimport { isUrlOk } from '../utils/url';\n\nconst debug = require('debug')('expo:prebuild:resolveTemplate') as typeof console.log;\n\ntype RepoInfo = {\n username: string;\n name: string;\n branch: string;\n filePath: string;\n};\n\nexport async function cloneTemplateAsync({\n templateDirectory,\n template,\n exp,\n ora,\n}: {\n templateDirectory: string;\n template?: string;\n exp: Pick<ExpoConfig, 'name' | 'sdkVersion'>;\n ora: Ora;\n}) {\n if (template) {\n await resolveTemplateArgAsync(templateDirectory, ora, exp.name, template);\n } else {\n const templatePackageName = await getTemplateNpmPackageName(exp.sdkVersion);\n await downloadAndExtractNpmModuleAsync(templatePackageName, {\n cwd: templateDirectory,\n name: exp.name,\n });\n }\n}\n\n/** Given an `sdkVersion` like `44.0.0` return a fully qualified NPM package name like: `expo-template-bare-minimum@sdk-44` */\nfunction getTemplateNpmPackageName(sdkVersion?: string): string {\n // When undefined or UNVERSIONED, we use the latest version.\n if (!sdkVersion || sdkVersion === 'UNVERSIONED') {\n Log.log('Using an unspecified Expo SDK version. The latest template will be used.');\n return `expo-template-bare-minimum@latest`;\n }\n return `expo-template-bare-minimum@sdk-${semver.major(sdkVersion)}`;\n}\n\nasync function getRepoInfo(url: any, examplePath?: string): Promise<RepoInfo | undefined> {\n const [, username, name, t, _branch, ...file] = url.pathname.split('/');\n const filePath = examplePath ? examplePath.replace(/^\\//, '') : file.join('/');\n\n // Support repos whose entire purpose is to be an example, e.g.\n // https://github.com/:username/:my-cool-example-repo-name.\n if (t === undefined) {\n const infoResponse = await fetch(`https://api.github.com/repos/${username}/${name}`);\n if (infoResponse.status !== 200) {\n return;\n }\n const info = await infoResponse.json();\n return { username, name, branch: info['default_branch'], filePath };\n }\n\n // If examplePath is available, the branch name takes the entire path\n const branch = examplePath\n ? `${_branch}/${file.join('/')}`.replace(new RegExp(`/${filePath}|/$`), '')\n : _branch;\n\n if (username && name && branch && t === 'tree') {\n return { username, name, branch, filePath };\n }\n return undefined;\n}\n\nfunction hasRepo({ username, name, branch, filePath }: RepoInfo) {\n const contentsUrl = `https://api.github.com/repos/${username}/${name}/contents`;\n const packagePath = `${filePath ? `/${filePath}` : ''}/package.json`;\n\n return isUrlOk(contentsUrl + packagePath + `?ref=${branch}`);\n}\n\nasync function downloadAndExtractRepoAsync(\n root: string,\n { username, name, branch, filePath }: RepoInfo\n): Promise<void> {\n const projectName = path.basename(root);\n\n const strip = filePath ? filePath.split('/').length + 1 : 1;\n\n const url = `https://codeload.github.com/${username}/${name}/tar.gz/${branch}`;\n debug('Downloading tarball from:', url);\n await extractNpmTarballFromUrlAsync(url, {\n cwd: root,\n name: projectName,\n strip,\n fileList: [`${name}-${branch}${filePath ? `/${filePath}` : ''}`],\n });\n}\n\nexport async function resolveTemplateArgAsync(\n templateDirectory: string,\n oraInstance: Ora,\n appName: string,\n template: string,\n templatePath?: string\n) {\n let repoInfo: RepoInfo | undefined;\n\n if (template) {\n // @ts-ignore\n let repoUrl: URL | undefined;\n\n try {\n // @ts-ignore\n repoUrl = new URL(template);\n } catch (error: any) {\n if (error.code !== 'ERR_INVALID_URL') {\n oraInstance.fail(error);\n throw error;\n }\n }\n\n if (!repoUrl) {\n const templatePath = path.resolve(template);\n if (!fs.existsSync(templatePath)) {\n throw new CommandError(`template file does not exist: ${templatePath}`);\n }\n\n await extractLocalNpmTarballAsync(templatePath, { cwd: templateDirectory, name: appName });\n return templateDirectory;\n }\n\n if (repoUrl.origin !== 'https://github.com') {\n oraInstance.fail(\n `Invalid URL: ${chalk.red(\n `\"${template}\"`\n )}. Only GitHub repositories are supported. Please use a GitHub URL and try again.`\n );\n throw new AbortCommandError();\n }\n\n repoInfo = await getRepoInfo(repoUrl, templatePath);\n\n if (!repoInfo) {\n oraInstance.fail(\n `Found invalid GitHub URL: ${chalk.red(`\"${template}\"`)}. Please fix the URL and try again.`\n );\n throw new AbortCommandError();\n }\n\n const found = await hasRepo(repoInfo);\n\n if (!found) {\n oraInstance.fail(\n `Could not locate the repository for ${chalk.red(\n `\"${template}\"`\n )}. Please check that the repository exists and try again.`\n );\n throw new AbortCommandError();\n }\n }\n\n if (repoInfo) {\n oraInstance.text = chalk.bold(\n `Downloading files from repo ${chalk.cyan(template)}. This might take a moment.`\n );\n\n await downloadAndExtractRepoAsync(templateDirectory, repoInfo);\n }\n\n return true;\n}\n"],"names":["cloneTemplateAsync","resolveTemplateArgAsync","Log","debug","require","templateDirectory","template","exp","ora","name","templatePackageName","getTemplateNpmPackageName","sdkVersion","downloadAndExtractNpmModuleAsync","cwd","log","semver","major","getRepoInfo","url","examplePath","username","t","_branch","file","pathname","split","filePath","replace","join","undefined","infoResponse","fetch","status","info","json","branch","RegExp","hasRepo","contentsUrl","packagePath","isUrlOk","downloadAndExtractRepoAsync","root","projectName","path","basename","strip","length","extractNpmTarballFromUrlAsync","fileList","oraInstance","appName","templatePath","repoInfo","repoUrl","URL","error","code","fail","resolve","fs","existsSync","CommandError","extractLocalNpmTarballAsync","origin","chalk","red","AbortCommandError","found","text","bold","cyan"],"mappings":"AAAA;;;;QA0BsBA,kBAAkB,GAAlBA,kBAAkB;QAmFlBC,uBAAuB,GAAvBA,uBAAuB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