我有一个带有 TurbeRepo monorepo 的 PNPM,使用了这个模板。在这个 monorepo 中,我有一个使用ui-shared包(本地共享代码,实际上不是 npm 包)的 NextJS 应用程序。
它ui-shared是按照类似的方式制作的,但我的包裹当然要大得多。index.ts使用导出所有组件和共享实用程序的a 。
构建时ui-shared它成功构建,但是当我构建 Nextjs 应用程序时,ui-shared构建失败,因为它无法解析tsconfig. 因此,经过几天的侦探工作,我成功地找出了我认为的问题所在。当构建下一个应用程序时,它也会构建 ,ui-shared但会失败,因为现在的路径基于 nextjs 而不是库本身。我不确定这是原因,但我相信是这样,而且我不知道如何解决这个问题
(我将指的是共享包或包ui-shared)
构建共享包成功
\nESM \xe2\x9a\xa1\xef\xb8\x8f Build success in 112ms\nESM dist/index.mjs 220.69 KB\nDTS Build start\nDTS \xe2\x9a\xa1\xef\xb8\x8f Build success in 4792ms\nRun Code Online (Sandbox Code Playgroud)\npackage.json 的部分内容
\n "main": "./src/index.ts",\n "module": "./dist/index.mjs",\n "types": "./src/index.ts",\n "scripts": {\n "lint": "eslint …Run Code Online (Sandbox Code Playgroud) 我的处境有点奇怪。在过去的两周里,我一直在尝试调试为什么我在 monorepo 内的项目之间丢失类型。我的后端公开了我的客户端使用的类型,但由于某种原因,某些类型只是无法传播并成为any. 这使得我有一段时间无法在这个项目上开发任何东西。我根据该问题制作了一个示例存储库以进一步展示它。
该项目的构建Yarn Workspaces和结构如下
apps/site,导入 tRPC 的 NextJS 客户端AppRouterapps/backend,暴露的 Express 后端AppRouterapps/config,这是tsconfig整个项目中使用的基础packages/frontend-shared,对于这个问题来说并不重要,共享 UI 组件问题可以在客户端内部找到apps/site/src/lib/ApiProvider.ts
// The type is imported directly from backend, here we use type alias to make it cleaner
import type { AppRouter, EmailType, ProfileType, Test } from "@company/backend/trpc";
export type { AppRouter } from "@company/backend/trpc";
import { inferProcedureOutput } from "@trpc/server";
// The type is inferred to …Run Code Online (Sandbox Code Playgroud) 我有一个应用程序,它在域、数据和表示层之间有明确的区别。我有从我的服务器获取的数据模型,该数据模型被转换为域模型,并被传递到演示文稿以用于绑定等。我一直在尝试本地化我的项目。我有发布帖子时显示的文字。例如。“一小时前”、“几分钟前” ...
我想本地化它并翻译它,但我无法在没有上下文的情况下从数据类访问字符串资源。我想避免到处传递上下文。通常如何处理这种情况?这似乎是 的一个非常常见的用例getString,但看来我错了。
android localization android-context kotlin android-resources
尝试在 Android Studio 中运行检测测试会导致
Test running failed: Process crashed.
Run Code Online (Sandbox Code Playgroud)
在 logcat 中有更详细的说明
E: FATAL EXCEPTION: main
Process: com.nikolam.colorme.debug, PID: 19841
java.lang.NoSuchMethodError: No static method registerDefaultInstance(Ljava/lang/Class;Lcom/google/protobuf/GeneratedMessageLite;)V in class Lcom/google/protobuf/GeneratedMessageLite; or its super classes (declaration of 'com.google.protobuf.GeneratedMessageLite' appears in /data/app/com.nikolam.colorme.debug.test-lZqsu6pVWp2DVtFzU1uYgg==/base.apk)
at com.google.firebase.perf.v1.ApplicationInfo.<clinit>(ApplicationInfo.java:1085)
at com.google.firebase.perf.v1.ApplicationInfo.newBuilder(ApplicationInfo.java:533)
at com.google.firebase.perf.transport.TransportManager.<init>(TransportManager.java:139)
at com.google.firebase.perf.transport.TransportManager.<clinit>(TransportManager.java:91)
at com.google.firebase.perf.transport.TransportManager.getInstance(TransportManager.java:149)
at com.google.firebase.perf.internal.AppStateMonitor.getInstance(AppStateMonitor.java:64)
at com.google.firebase.perf.provider.FirebasePerfProvider.attachInfo(FirebasePerfProvider.java:65)
at android.app.ActivityThread.installProvider(ActivityThread.java:6983)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6528)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6445)
at android.app.ActivityThread.access$1300(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Run Code Online (Sandbox Code Playgroud)
我发现的最接近的事情是github 上的这个问题,但我尝试了多种设置,将 protobuf …
我有一个单一活动、多功能模块的设置,如下所示:
/app - 包含继承材料设计样式资源的主模块,以及活动 /menu - 仅包含片段和视图模型/其他模块的模块功能...
我试图在 Android 测试中单独运行我的 Fragment,这会导致 Material 组件(在本例中为 CardView)必须将 Material Theme 作为其样式的错误。这确实有道理,但我尝试过。
现在我得到这个错误
android.view.InflateException: Binary XML file line #21 in com.nikolam.menu.test:layout/menu_item: Binary XML file line #21 in com.nikolam.menu.test:layout/menu_item: Error inflating class com.google.android.material.card.MaterialCardView
Caused by: android.view.InflateException: Binary XML file line #21 in com.nikolam.menu.test:layout/menu_item: Error inflating class com.google.android.material.card.MaterialCardView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:854)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1006)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
at android.view.LayoutInflater.inflate(LayoutInflater.java:682)
at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
at com.nikolam.menu.ui.menu.adapter.MenuAdapter.onCreateViewHolder(MenuAdapter.kt:27)
at com.nikolam.menu.ui.menu.adapter.MenuAdapter.onCreateViewHolder(MenuAdapter.kt:16)
at androidx.recyclerview.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:7266)
at …Run Code Online (Sandbox Code Playgroud) 我现在非常困惑,并且正在努力使用 AWS。我创建了一个副驾驶应用程序,创建了服务,后来想删除它。我似乎手动删除了一些东西,现在我留下了一个无法操作的堆栈集,我无法删除它。由于堆栈必须为空,但堆栈实例无法操作,所以我无法对其执行任何操作
我有两个角色,执行和管理,这是执行角色
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"cloudformation:*",
"s3:*",
"sns:*"
],
"Resource": "*",
"Effect": "Allow",
"Sid": "StackSetRequiredPermissions"
},
{
"Action": [
"kms:*"
],
"Resource": "*",
"Effect": "Allow",
"Sid": "ManageKMSKeys"
},
{
"Action": [
"ecr:DescribeImageScanFindings",
"ecr:GetLifecyclePolicyPreview",
"ecr:CreateRepository",
"ecr:GetDownloadUrlForLayer",
"ecr:GetAuthorizationToken",
"ecr:ListTagsForResource",
"ecr:ListImages",
"ecr:DeleteLifecyclePolicy",
"ecr:DeleteRepository",
"ecr:SetRepositoryPolicy",
"ecr:BatchGetImage",
"ecr:DescribeImages",
"ecr:DescribeRepositories",
"ecr:BatchCheckLayerAvailability",
"ecr:GetRepositoryPolicy",
"ecr:GetLifecyclePolicy",
"ecr:TagResource"
],
"Resource": "*",
"Effect": "Allow",
"Sid": "ManageECRRepos"
}
]
}
Run Code Online (Sandbox Code Playgroud)
这是管理员
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"cloudformation:*",
"s3:*",
"sns:*"
],
"Resource": "*",
"Effect": …Run Code Online (Sandbox Code Playgroud) android ×3
next.js ×2
typescript ×2
amazon-iam ×1
dependencies ×1
firebase ×1
gradle ×1
kotlin ×1
localization ×1
monorepo ×1
pnpm ×1
reactjs ×1
trpc.io ×1
zod ×1