UNPKG

3.05 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = void 0;
7
8function _path() {
9 const data = _interopRequireDefault(require("path"));
10
11 _path = function () {
12 return data;
13 };
14
15 return data;
16}
17
18function _fs() {
19 const data = _interopRequireDefault(require("fs"));
20
21 _fs = function () {
22 return data;
23 };
24
25 return data;
26}
27
28function _process() {
29 const data = _interopRequireDefault(require("process"));
30
31 _process = function () {
32 return data;
33 };
34
35 return data;
36}
37
38function _chalk() {
39 const data = _interopRequireDefault(require("chalk"));
40
41 _chalk = function () {
42 return data;
43 };
44
45 return data;
46}
47
48function _cliTools() {
49 const data = require("@react-native-community/cli-tools");
50
51 _cliTools = function () {
52 return data;
53 };
54
55 return data;
56}
57
58function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
59
60/**
61 * Copyright (c) Facebook, Inc. and its affiliates.
62 *
63 * This source code is licensed under the MIT license found in the
64 * LICENSE file in the root directory of this source tree.
65 *
66 * @format
67 */
68function printRunInstructions(projectDir, projectName) {
69 let iosInstructions = '';
70 let desktopInstructions = '';
71
72 if (_process().default.platform === 'darwin') {
73 const iosProjectDir = _path().default.resolve(projectDir, 'ios');
74
75 const iosPodsFile = _path().default.resolve(iosProjectDir, `${projectName}.xcworkspace`);
76
77 const isUsingPods = _fs().default.existsSync(iosPodsFile);
78
79 const relativeXcodeProjectPath = _path().default.relative('..', isUsingPods ? iosPodsFile : _path().default.resolve(iosProjectDir, `${projectName}.xcodeproj`));
80
81 iosInstructions = `
82 ${_chalk().default.cyan(`Run instructions for ${_chalk().default.bold('iOS')}`)}:
83 • cd "${projectDir}" && npx react-native run-ios
84 ${_chalk().default.dim('- or -')}
85 • Open ${relativeXcodeProjectPath} in Xcode or run "xed -b ios"
86 • Hit the Run button
87 `;
88 desktopInstructions = `
89 ${_chalk().default.magenta(`Run instructions for ${_chalk().default.bold('macOS')}`)}:
90 • See ${_chalk().default.underline('https://aka.ms/ReactNativeGuideMacOS')} for the latest up-to-date instructions.
91 `;
92 }
93
94 if (_process().default.platform === 'win32') {
95 desktopInstructions = `
96 ${_chalk().default.cyan(`Run instructions for ${_chalk().default.bold('Windows')}`)}:
97 • See ${_chalk().default.underline('https://aka.ms/ReactNativeGuideWindows')} for the latest up-to-date instructions.
98 `;
99 }
100
101 const androidInstructions = `
102 ${_chalk().default.green(`Run instructions for ${_chalk().default.bold('Android')}`)}:
103 • Have an Android emulator running (quickest way to get started), or a device connected.
104 • cd "${projectDir}" && npx react-native run-android
105 `;
106
107 _cliTools().logger.log(`
108 ${androidInstructions}${iosInstructions}${desktopInstructions}
109 `);
110}
111
112var _default = printRunInstructions;
113exports.default = _default;
114
115//# sourceMappingURL=printRunInstructions.js.map
\No newline at end of file