我升级到react-scriptsv5,但构建失败并显示一条无用的消息:
Creating an optimized production build...
Failed to compile.
Module not found: Error: Can't resolve '...' in '/project/src'
Run Code Online (Sandbox Code Playgroud)
src正如您所看到的,它仅告诉我目录(实际上是整个项目)存在问题。
如何增加该脚本的详细程度?
这是我在 GitHub 存储库上的简单操作:
name: CI
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get /my_account/my_infra
run: |
sudo mkdir /my_account
sudo chmod -R 777 /my_account
cd /my_account
git clone https://github.com/my_account/my_infra
- name: Get /my_account/my_repo
run: |
cd /my_account
git clone https://github.com/my_account/my_repo
- name: Run my build script
run: |
cd /my_account/my_infra
./build.sh /my_account/my_repo
Run Code Online (Sandbox Code Playgroud)
由于 GitHub 不提供跨多个类似存储库重用操作的方法,因此我提出了创建一个基本存储库的想法,然后将该基本存储库与当前存储库一起下载,然后从该基本存储库运行自定义 shell 脚本,传递我当前的repo 作为参数。
这很完美。这样我就可以在许多类似的存储库中重复使用我的基础存储库。我可以重用近 500 行构建脚本,而不是为 50 个存储库重复自己(这意味着 25000 行 CI/CD 代码)。
但是,现在我需要访问一些资源(例如登录我的 docker hub 帐户)来拉取和推送内容。
是否可以在我的 中使用 GitHub …
我有一个 GitHub 帐户。
我有一个私人组织。还有一些私人存储库。
我想在我的私人组织中为我的私人存储库定义一个操作。
private_org\private_rpo
我可以检查我的private_repo使用情况${{ github.token }}和action/checkout@2。
但是,我无法在该存储库的操作中查看我的其他存储库。
这是我的代码:
- name: Get private_org/private_repo using actions/checkout@v2
uses: actions/checkout@v2
with:
repository: private_org/private_repo
token: ${{ github.token }}
path: private_org/private_repo
- name: Get private_org/private_repo_2 using actions/checkout@v2
uses: actions/checkout@v2
with:
repository: private_org/private_repo_2
token: ${{ github.pat }}
path: private_org/private_repo_2
Run Code Online (Sandbox Code Playgroud)
我在我的帐户(开发人员设置)中创建了一个 PAT,并pat在private_org/private_repo.
然而,action/checkout@2抱怨说:
运行 actions/checkout@v2
错误:需要输入但未提供:令牌
我应该如何解决这个问题?我应该在哪里定义我的pat秘密?如何在此私有存储库的操作中签出我的其他私有存储库?
我有一个存储库,并且有一个代码生成器,可以在某些目录中生成 GitHub Actions。
例如:
- repo_root
- .github/workflows
- site.yml <= this is a relative symlink to site's build.yml
- blog.yml <= this is a relative symlink to blog's build.yml
- site
- .github/workflows/build.yml
- blog
- .github/workflows/build.yml
Run Code Online (Sandbox Code Playgroud)
我已经使用此命令创建了这些符号链接,我可以验证它们是否正确(通过cat或 通过ls -lah):
ln -s -f -r /repo/site/.github/workflows/build.yml /repo/.github/workflows/build.yml
Run Code Online (Sandbox Code Playgroud)
但是,它们在 GitHub 中不被识别为操作,并且会立即失败。
有可能吗?
我有许多不同的技术在我的本地计算机上为 API 和站点提供服务。我希望能够通过人类可读的名称而不是端口来查看它们。
例如,我有:
这个清单还在继续。
当然,记住所有这些端口是不可能的。因此我想为他们设置一个反向代理:
我知道我必须将这些主机头添加到/etc/hosts文件中。我还阅读了如何将 nginx 配置为一个域的反向代理 。
我不知道如何为许多网站做到这一点。并且仅作为反向代理,不作为服务器。
这是我的 JSON:
{
firstName: 'Somebody',
lastName: 'Else'
}
Run Code Online (Sandbox Code Playgroud)
我将其反序列化为JsonElement使用以下选项:
var options = new JsonSerializerOptions {
WriteIndented = true,
PropertyNameCaseInsensitive = true,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
};
Run Code Online (Sandbox Code Playgroud)
但后来我想搜索属性,它变得区分大小写。
element.GetProperty("FirstName") // this returns null
element.GetProperty("firstName") // this returns 'Somebody'
Run Code Online (Sandbox Code Playgroud)
如何强制GetProperty方法不区分大小写?
我将我的项目从 CRA 迁移到了 Vite。
当我运行时,npm run dev我收到此错误:
The following dependencies are imported but could not be resolved:
@mui/icons-material/Article (imported by /Blog/Admin/Exports.jsx)
@mui/icons-material/Comment (imported by /Social/Admin/Comment/View.jsx)
@mui/icons-material/TextSnippet (imported by /Contents/Admin/Page/List.jsx)
@mui/icons-material/FindInPage (imported by /Contents/Admin/Page/List.jsx)
@mui/icons-material/AccountTree (imported by /Taxonomy/Admin/Hierarchy/Manage.jsx)
@mui/icons-material/LocalOffer (imported by /Taxonomy/Admin/Tag/Manage.jsx)
@mui/icons-material/NoteAlt (imported by /Forms/Admin/Form/List.jsx)
@mui/icons-material/EventNote (imported by /Logs/Admin/Exports.jsx)
@mui/icons-material/Navigation (imported by /Navigation/Admin/Exports.jsx)
@mui/icons-material/Abc (imported by /Contents/Admin/Exports.jsx)
@mui/icons-material/Fingerprint (imported by /Entities/Admin/Exports.jsx)
@mui/icons-material/Support (imported by /Ticketing/Admin/Exports.jsx)
@mui/icons-material/Shuffle (imported by /Entities/Admin/EntityType/List.jsx)
@mui/icons-material/Delete (imported by /Logs/Admin/List.jsx)
@mui/icons-material/Search (imported by /Contents/Admin/Image/List.jsx)
@mui/icons-material/Done …Run Code Online (Sandbox Code Playgroud) 我正在使用 ASP.NET Core 和System.Text.Json.
这是我的示例操作方法:
[HttpGet]
public object Person()
{
dynamic relatedItems = new ExpandoObject();
relatedItems.LastName = "Last";
var result = new
{
FirstName = "First",
RelatedItems = relatedItems
};
return result;
}
Run Code Online (Sandbox Code Playgroud)
这是我得到的回应:
{
firstName: "First",
relatedItems: {
LastName: "Last"
}
}
Run Code Online (Sandbox Code Playgroud)
正如你所看到的,LastName它是动态属性的一个属性,没有被骆驼化。
我怎样才能让所有东西都装在骆驼箱里回来?
更新。这个答案不是我的答案。正如你所看到的,我已经拥有firstName正确骆驼化的财产。
这是一个典型的tailwind.config.js文件:
module.exports = {
content: [
"./pages/**/*.{js,ts,jsx,tsx}",
"./components/**/*.{js,ts,jsx,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}
Run Code Online (Sandbox Code Playgroud)
由于我们正在创建一个基础架构,因此我们希望将此文件拆分为两个配置文件,并在 nextjs 构建之前重新加入/重新编译它们。
例如,我们希望tailwind.config.base.js它是集中的并包含:
content: [
"./pages/**/*.js",
"./components/**/*.js",
"./base/**/*.js",
"./contents/**/*.js",
"./modules/**/*.js"
// Here we have a chance to centralize our directory structure
// We can also prevent common mistakes
// And we can ensure that all projects use js and not typescript
],
plugins: [
require('@tailwindcss/typography')
// Here we have the chance to give all of our projects a …Run Code Online (Sandbox Code Playgroud) c# ×2
github ×2
next.js ×2
reactjs ×2
.net ×1
asp.net-core ×1
camelcasing ×1
html ×1
image ×1
json ×1
material-ui ×1
nginx ×1
shell ×1
tailwind-css ×1
vite ×1