natal开源项目

我要开发同款
匿名用户2021年11月17日
50阅读
开发技术JavaScript
所属分类应用工具、终端/远程登录
授权协议MIT License

作品详情

NatalBootstrapClojureScript-basedReactNativeapps

DanMotzenbecker,MITLicense@dcmotz

Natalisasimplecommand-lineutilitythatautomatesmostoftheprocessofsettingupaReactNativeapprunningonClojureScript.

Itstandsfirmlyontheshouldersofgiants,specificallythoseofMikeFikeswhocreatedAmblyandthedocumentationonsettingupaClojureScriptReactNativeapp.

Usage

Beforegettingstarted,makesureyouhavetherequireddependenciesinstalled.

Then,installtheCLIusingnpm:

$npminstall-gnatal

Tobootstrapanewapp,runnatalinitwithyourapp'snameasanargument:

$natalinitFutureApp

Ifyourapp'snameismorethanasingleword,besuretotypeitinCamelCase.AcorrespondinghyphenatedClojurenamespacewillbecreated.

BydefaultNatalwillcreateasimpleskeletonbasedonthecurrentstableversionofOm(akaOmNow).Ifyou'dliketobaseyourappuponOmNext,youcanspecifyaReactinterfacetemplateduringinit:

$natalinitFutureApp--interfaceom-next

Keepinmindyourappisn'tlimitedtotheReactinterfacesNatalprovidestemplatesfor;thesearejustforconvenience.

Ifallgoeswellyourappshouldcompileandbootinthesimulator.

FromthereyoucanbeginaninteractiveworkflowbystartingtheREPL.

$cdfuture-app$rlwrapnatalrepl

(Ifyoudon'thaverlwrapinstalled,youcansimplyrunnatalrepl,butusingrlwrapallowstheuseofarrowkeys).

Iftherearenoissues,theREPLshouldconnecttothesimulatorautomatically.Tomanuallychoosewhichdeviceitconnectsto,youcanrunrlwrapnatalrepl--choose.

Attheprompt,tryloadingyourapp'snamespace:

(in-ns'future-app.core)

ChangesyoumakeviatheREPLorbychangingyour.cljsfilesshouldappearliveinthesimulator.

Trythiscommandasanexample:

(swap!app-stateassoc:text"HelloNativeWorld")

WhentheREPLconnectstothesimulatoritwillbegintoautomaticallylogsuccessmessages,warnings,anderrorswheneveryouupdateyour.cljsfiles.

Tips

HavingrlwrapinstalledisoptionalbuthighlyrecommendedsinceitmakestheREPLamuchnicerexperiencewitharrowkeys.

Don'tpress⌘-Rinthesimulator;codechangesshouldbereflectedautomatically.SeethisissueinAmblyfordetails.

RunningmultipleReactNativeappsatoncecancauseproblemswiththeReactPackagersotrytoavoiddoingso.

YoucanlaunchyourapponthesimulatorwithoutopeningXcodebyrunningnatallaunchinyourapp'srootdirectory.

BydefaultnewNatalprojectswilllaunchontheiPhone6simulator.Tochangewhichdevicenatallaunchuses,youcanrunnatallistdevicestoseealistofavailablesimulators,thenselectonebyrunningnatalsetdevicewiththeindexofthedeviceonthelist.

TochangeadvancedsettingsrunnatalxcodetoquicklyopentheXcodeproject.

TheXcode-freeworkflowisforconvenience.Ifyou'reencounteringappcrashes,youshouldopentheXcodeprojectandrunitfromtheretoviewerrors.

Youcanrunanycommandwith--verboseor-vtoseeoutputthatmaybehelpfulindiagnosingerrors.

Dependencies

AsNatalistheorchestrationofmanyindividualtools,therearequiteafewdependencies.Ifyou'vepreviouslydoneReactNativeorClojuredevelopment,youshouldhopefullyhavemostinstalledalready.Platformdependenciesarelistedundertheirrespectivetools.

npm>=1.4Node.js>=4.0.0Leiningen>=2.5.3Java8CocoaPods>=0.38.2Ruby>=2.0.0Xcode(+CommandLineTools)>=6.3OSX>=10.10Watchman>=3.7.0rlwrap>=0.42(optionalbutrecommendedforREPLuse)react-native-cli>=0.1.7(installwithnpminstall-greact-native-cli)UpdatingNatal

YoucangetthelatestversionofNatalbyrunningnpminstall-gnatalagain.

AspirationsXcode-freeworkflowwithCLItoolsTemplatesforotherClojureScriptReactwrappersAutomaticwrappingofallReactNativecomponentfunctionsforClojureScriptAutomaticallytailcompilationlogandreporterrorstoREPLAutomaticallyrunReactpackagerinbackgroundWorkingdevtoolsAutomaticbundlingforofflinedeviceusageandAppStoredistributionAndroidsupportAutomaticsetupofJSmodulesExampleappsbootstrappedwithNatal

OmNextappwithPythonserverbyDavidMohl,demonstratedinatalkattheTokyoiOSMeetup.

ZoobornsbyJearvonDharrie,demonstratedinatalkatClojure/conj2015.

Coda

Contributionsarewelcome.

FormoreClojureScriptReactNativeresourcesvisitcljsrn.org.

Ifyou'relookingforasimpleClojureScriptwrapperaroundtheReactNativeAPI,checkoutthecompanionlibraryNatalShell.ItisincludedbydefaultinprojectsgeneratedbyNatal.

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论