【Hacker News搬运】Show HN:One-一个新的React框架,统一了web、原生和本地优先
-
Title: Show HN: One – A new React framework unifying web, native and local-first
Show HN:One-一个新的React框架,统一了web、原生和本地优先
Text: Hey HN, I'm Nate, the creator of Tamagui.<p>One is a React framework that does two things differently in hopes of simplifying how we build websites and apps:<p>1. It unifies React Native and React web with typed file system routing by making Vite able to serve RN. This lets you share (or diverge) your code in a simpler way for cross-platform apps.<p>2. We've partnered with Zero (<a href="https://zerosync.dev" rel="nofollow">https://zerosync.dev</a>) to make local-first work well. We've been building a solution in One that makes Zero supporting server rendering, without waterfalls, and with seamless server/client handoff.<p>---<p>Honestly - I'm a bit hesitant to post One here.<p>HN has really soured on frontend/frameworks. And I get it. We've collectively complicated the hell out of things.<p>That's why I decided to build One. I loved Rails, it made me as a young developer able to finally realize way more ambitious projects than I'd ever done before. I also liked the promise (not implementation) of Meteor - it felt like the clear future, I guess just a bit too early (and a bit too scope-creeped).<p>I worked at Uniswap and built Tamagui and so spent a lot of time building cross-platform apps that share code. Uniswap is built on Tamagui and I think proves you <i>can</i> make really high quality UX while sharing a lot of code - but it's insanely hard and requires a huge team. My goal with One is to make what is now possible but hard dramatically easier.<p>And I think the path to there goes through local-first, because it makes building super responsive apps much, much simpler, and Zero is the first library to actually pull it off in a way that doesn't bloat your bundle or have very limiting constraints.<p>I happened to live down the street from Aaron, one of the founders of Zero, in our tiny town in Hawaii. We talked a lot about Zero over the last couple years, and I found it really admirable how he consistently chose the "harder but better" path in building it. It really shaped into something incredible, and that convinced me to actually launch One, which at the time was more of an experiment.<p>I can see a lot of potential criticism - do we need yet another framework, this is too shiny and vaporware-y, this is just more complexity and abstraction, etc. Happy to respond to those comments if they come.<p>I'm just building out something that I've been wanting for a long time. Opinionated enough to let me move fast like Rails, but leaning on the great work of team Zero so that we don't end up with the scope creep of Meteor. And honestly, it's just really fun to hack on.
嘿,HN,我;m Nate,Tamagui的创造者<p> 一个是React框架,它做了两件不同的事情,希望简化我们构建网站和应用程序的方式:<p>1。它通过使Vite能够为RN提供服务,将React Native和React web与类型化文件系统路由相结合。这使您能够以更简单的方式为跨平台应用程序共享(或分流)代码<p> 2。我们;我与Zero(<a href=“https:”zerosync.dev“rel=”nofollow“>https:”zerosync.dev</a>)合作,使本地优先工作良好。我们;我一直在One中构建一个解决方案,使Zero支持服务器渲染,没有瀑布,并且具有无缝的服务器;客户端切换<p> ---<p>老实说,我;我有点犹豫是否要在这里发布一个<p> HN确实对前端感到不满;框架。我明白了;我们一起把事情搞得一团糟<p> 那;这就是为什么我决定建造一个。我喜欢Rails,它让我作为一名年轻的开发人员最终能够实现比我更雄心勃勃的项目;d以前做过。我也喜欢Meteor的承诺(而不是实现)——它感觉就像一个清晰的未来,我想只是有点太早了(而且有点太吓人了)<p> 我在Uniswap工作并构建了Tamagui,因此花了很多时间构建共享代码的跨平台应用程序。Uniswap建立在Tamagui之上,我认为这证明了你可以在共享大量代码的同时实现真正高质量的用户体验,但它;这太难了,需要一个庞大的团队。我在One的目标是让现在可能但困难的事情变得容易得多<p> 我认为实现这一目标的途径是首先通过本地,因为它使构建超级响应的应用程序变得非常简单,Zero是第一个以一种不依赖本地的方式实现它的库;不要让你的包膨胀,也不要有非常有限的限制<p> 我碰巧住在夏威夷小镇上,离零创始人之一亚伦不远。在过去几年里,我们谈了很多关于Zero的事情,我发现他始终如一地选择";更难但更好";建造它的道路。它真的形成了令人难以置信的东西,这说服了我真的推出了One,这在当时更像是一个实验<p> 我可以看到很多潜在的批评——我们是否需要另一个框架,这个框架太过闪亮和空洞,只是更复杂和抽象,等等。如果有人提出这些评论,我很乐意回应<p> 我;我只是在构建一些东西;我早就想要了。足够的意见让我像Rails一样快速行动,但依靠Zero团队的出色工作,这样我们就不会;不会以流星的范围蔓延而告终。老实说,它;这真的很有趣。
Url: https://onestack.dev
由于我是一个AI,无法直接访问外部网站,包括 `https://onestack.dev`。不过,我可以提供一些关于如何使用JinaReader来抓取和分析网站内容的步骤,以及如何处理非中文内容的翻译。 ### 使用JinaReader抓取网站内容 1. **安装JinaReader**: 首先,你需要确保JinaReader在你的环境中安装并配置好。这通常涉及到安装Python环境以及JinaReader所需的依赖。 2. **抓取网页**: 使用JinaReader的API或命令行工具来抓取网页内容。以下是一个基本的Python脚本示例,使用JinaReader抓取网页: ```python from jina import Document, Client # 创建一个Jina客户端 client = Client() # 创建一个Document对象,包含要抓取的URL document = Document(url="https://onestack.dev") # 使用JinaReader处理文档 client.add(document) # 输出抓取的内容 print(document.text)
- 分析内容:
一旦抓取到内容,你可以使用JinaReader的内置功能或自定义管道来分析文本。例如,你可以使用情感分析、关键词提取等。
翻译非中文内容
如果抓取到的内容不是中文,你需要使用翻译服务。以下是一些步骤:
-
选择翻译服务:
你可以使用如Google Translate API、百度翻译API等在线翻译服务。 -
设置翻译API:
根据所选服务的文档,设置API密钥,并在代码中调用API。 -
翻译内容:
在抓取到内容后,使用翻译API将其翻译成中文。以下是一个使用Google Translate API的Python示例:from googletrans import Translator # 创建翻译器对象 translator = Translator() # 翻译抓取到的非中文内容 translation = translator.translate(document.text, src='auto', dest='zh-cn') # 输出翻译后的内容 print(translation.text)
请注意,上述代码示例仅为概念验证,实际应用时可能需要处理异常、认证以及可能的API限制。你需要根据JinaReader和翻译API的具体文档来调整和实现。
## Post by: nwienert ### Comments: **pyromaker**: I'm definitely getting too old. Back when I was just learning Backbonejs, I gulped up every single framework that came out, tried them all, every language, every variation, server side, client side, mobile, hybrid.<p>In the end, after all that journey, I settled into Laravel Backend and Vue3. Every app I create now is just a copy-and-paste of what I've done before. The tech stack disappears into the background and I try to actually build the features that I want to build.<p>I'm definitely old because I see this great work called "one" and I look at the video and I get immediatey turned off by so many "new things". It's me - definitely me. It's maybe for a different generation of devs. > **pyromaker**: 我;我肯定是太老了。当我刚刚学习Backbonejs的时候,我吞下了每一个出现的框架,尝试了它们,每种语言,每种变体,服务器端,客户端,移动端,混合端。<p>最后,在这段旅程之后,我适应了Laravel后端和Vue3。我现在创建的每个应用程序都只是我创建的应用程序的复制和粘贴;我以前做过。技术栈消失在背景中,我试图实际构建我想要构建的功能<p> 我;我确实很老了,因为我看到这部伟大的作品叫做《;一个";我看了视频,马上就被这么多人拒之门外";新事物";。它;是我,绝对是我;这可能适用于不同一代的开发者。 **josephg**: Wonderful work, but this doesn’t look like local first software to me. It looks like server first software with live updates and caching.<p>Don’t get me wrong, that’s super cool - but if you’re going to claim it’s local first software, I want to see the principles of local first software at play. And I don’t think Zero delivers that - at least as I understand it from its website.<p>Like, “the network is optional” and “the long now” and “you (the user) retains ultimate control”. It just looks like an excellent server sync system with client side caching. What if the data I need isn’t in the cache? What happens when I edit things offline then come online later? What happens if the company shuts down and the server gets turned off permanently? Will the app still work?<p>Local first software can handle these cases too.<p>[1] <a href="https://www.inkandswitch.com/local-first/" rel="nofollow">https://www.inkandswitch.com/local-first/</a> > **josephg**: 做得很好,但在我看来,这并不是本地第一软件。它看起来像是具有实时更新和缓存的服务器第一软件<p> 别误会我的意思,这太酷了——但如果你要声称这是本地优先软件,我想看看本地优先软件的原则在发挥作用。我不认为Zero能做到这一点——至少我从它的网站上了解到了这一点<p> 比如,“网络是可选的”、“现在很长”和“你(用户)保留最终控制权”。它看起来就像一个具有客户端缓存的优秀服务器同步系统。如果我需要的数据不在缓存中怎么办?当我离线编辑内容后再上线时会发生什么?如果公司关闭,服务器永久关闭,会发生什么?这个应用程序还能用吗<p> 本地优先软件也可以处理这些情况<p> [1]<a href=“https:”www.inkandswitch.com“本地优先”rel=“nofollow”>https:”/;www.inkandswitch.com;本地优先</一 **monocularvision**: As a native iOS mobile developer, I was curious so I got into the TestFlight and downloaded the demo app. Thoughts:<p>* Overall, not bad. Using React Native is far better than trying to mimic platform UI in the web, which is always terrible. * When tapping on an item on the “Feed”, the transition is made to the details _and then_ the navigation bar has a sudden title transition. This is weird. * The button in the upper left to switch between light and dark mode is nice but it should default to the system setting. It did not for me. * The Notifications tab content isn’t scrollable at all on my phone. Seems like a bug. * If you tap on an item in Notifications you navigate deeper in, but when you hit back you are back on the Feed tab.<p>Coming from native app development, it has the normal uncanny valley feeling that React Native gives off but for normal users they may not notice it as much. > **monocularvision**: 作为一名本地iOS移动开发人员,我很好奇,所以我进入了TestFlight并下载了演示应用程序。思考:<p>*总体而言,还不错。使用React Native比试图在web中模仿平台UI要好得多,后者总是很糟糕。*当点击“Feed”上的项目时,会切换到详细信息,然后导航栏会突然切换到标题。这很奇怪。*左上角用于在亮模式和暗模式之间切换的按钮很好,但它应该默认为系统设置。它不适合我。*通知选项卡内容在我的手机上根本无法滚动。看起来像个虫子。*如果你点击通知中的一个项目,你会导航到更深的位置,但当你回击时,你会回到Feed标签页。<p>来自原生应用程序开发,它有React native发出的正常的恐怖谷感觉,但对于普通用户来说,他们可能不会那么注意到。 **davedx**: Just want to say as a fellow dev who loved the glory days of Rails and then later Meteor (I actually launched a production app on HN that used Meteor!), best of luck! I'm not really in the market for a universal app framework like this but will definitely keep it in mind for future work. > **davedx**: 只是想说,作为一个喜欢Rails和后来的Meteor的辉煌日子的开发人员(我实际上在HN上推出了一个使用Meteor的生产应用程序!),祝你好运!我;我并不是真的在市场上寻找这样一个通用的应用程序框架,但我肯定会在未来的工作中牢记这一点。 **cabalamat**: > Creating websites and apps is simply too complex<p>And the solution, of course, is a framework on top of a framework on top of JS and the DOM. OK, maybe I'm being too harsh. > **cabalamat**: >;创建网站和应用程序太复杂了<p>当然,解决方案是一个基于JS和DOM的框架之上的框架。好吧,也许我;我太苛刻了。
- 分析内容: