UNPKG

create-react-native-library

Version:
82 lines (76 loc) 3.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.printErrorHelp = printErrorHelp; exports.printLocalLibNextSteps = printLocalLibNextSteps; exports.printNonLocalLibNextSteps = printNonLocalLibNextSteps; exports.printUsedRNVersion = printUsedRNVersion; var _path = _interopRequireDefault(require("path")); var _dedent = _interopRequireDefault(require("dedent")); var _kleur = _interopRequireDefault(require("kleur")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } function printNonLocalLibNextSteps(config) { const platforms = { ios: { name: 'iOS', color: 'cyan' }, android: { name: 'Android', color: 'green' }, ...(config.example === 'expo' || config.tools.includes('vite') ? { web: { name: 'Web', color: 'blue' } } : null) }; console.log((0, _dedent.default)(` ${_kleur.default.magenta(`${_kleur.default.bold('Get started')} with the project`)}${_kleur.default.gray(':')} ${_kleur.default.gray('$')} yarn ${Object.entries(platforms).map(([script, { name, color }]) => ` ${_kleur.default[color](`Run the example app on ${_kleur.default.bold(name)}`)}${_kleur.default.gray(':')} ${_kleur.default.gray('$')} yarn example ${script}`).join('\n')} ${_kleur.default.yellow(`See ${_kleur.default.bold('CONTRIBUTING.md')} for more details. Good luck!`)} `)); } function printLocalLibNextSteps({ folder, config, linkedLocalLibrary, addedNitro, packageManager }) { console.log((0, _dedent.default)(` ${_kleur.default.magenta(`${_kleur.default.bold('Get started')} with the project`)}${_kleur.default.gray(':')} ${(linkedLocalLibrary ? `- Run ${_kleur.default.blue(`${packageManager} install`)} to link the library\n` : `- Link the library at ${_kleur.default.blue(_path.default.relative(process.cwd(), folder))} based on your project setup\n`) + (config.project.moduleConfig === 'nitro-modules' && !addedNitro ? `- Run ${_kleur.default.blue(`${packageManager} add react-native-nitro-modules`)} to install nitro modules \n` : '') + `- Run ${_kleur.default.blue('pod install --project-directory=ios')} to install dependencies with CocoaPods\n` + `- Run ${_kleur.default.blue('npx react-native run-android')} or ${_kleur.default.blue('npx react-native run-ios')} to build and run the app\n` + `- Import from ${_kleur.default.blue(config.project.slug)} and use it in your app.`} ${_kleur.default.yellow(`Good luck!`)} `)); } function printErrorHelp(message, error) { console.log('\n'); if (message) { console.log(message); } else { console.log(`An unknown error occurred. See ${_kleur.default.blue('--help')} for usage guide.`); } if (error) { console.log('\n'); throw error; } } function printUsedRNVersion(version, config) { if (config.example === 'vanilla' || config.example === 'test-app') { console.log(`${_kleur.default.blue('ℹ')} Using untested ${_kleur.default.cyan(`react-native@${version}`)} for the example`); } else if (config.example != null) { console.warn(`${_kleur.default.yellow('⚠')} Ignoring --react-native-version for unsupported example type: ${_kleur.default.cyan(config.example)}`); } else { console.warn(`${_kleur.default.yellow('⚠')} Ignoring --react-native-version for library without example app`); } } //# sourceMappingURL=inform.js.map