- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试为我的组织创建一个自定义的 JHipster 蓝图。
我开始了我的旅程:
mkdir mygenerator && cd mygenerator
jhipster generate-blueprint
至此,我用VS Code打开生成的蓝图工程,发现第一个问题,部分jhipster包无法解析:
我还注意到为我创建的生成器与 JHipster Github 中现有的生成器有细微差别,例如 jhipster-dotnetcore , generator-jhipster-quarkus , generator-jhipster-nodejs : 返回的函数是 async
而在引用的 repos 中,它们是常规函数(同步):
get [INITIALIZING_PRIORITY]() {
return {
async initializingTemplateTask() {},
};
}
在这个 Jhipster 版本中有什么不同吗?或者如果我以与 jhipster-dotnetcore 相同的方式返回则没有问题。 :
get initializing() {
return {
...super._initializing(),
setupServerConsts() {
this.packagejs = packagejs;
...
我假设这个细节并不重要,然后是异步函数并写下我的 prompting
从用户/开发人员那里获取一些输入以替换模板文件中的值的函数:
get [PROMPTING_PRIORITY]() {
return {
...super._prompting(),
async promptingTemplateTask() {
const choices = [
{
name: 'OAuth 2.0 Protocol',
value: 'oauth2',
},
{
name: 'CAS Protocol',
value: 'cas',
},
];
const PROMPTS = {
type: 'list',
name: 'authenticationProtocol',
message: 'Which authentication protocol do you want to use?',
choices,
default: 'oauth2',
};
const done = this.async();
if (choices.length > 0) {
this.prompt(PROMPTS).then(prompt => {
this.authenticationProtocol = this.jhipsterConfig.authenticationProtocol = prompt.authenticationProtocol;
done();
});
} else {
done();
}
},
};
}
<%_ if (authenticationProtocol == 'oauth2') { _%>
security:
enable-csrf: true
oauth2:
client:
clientId: ${this.baseName}
clientSecret: Z3ByZXBmdGVy
accessTokenUri: http://localhost:8443/oauth2.0/accessToken
userAuthorizationUri: http://localhost:8443/oauth2.0/authorize
tokenName: oauth_token
authenticationScheme: query
clientAuthenticationScheme: form
logoutUri: http://localhost:8443/logout
clientSuccessUri: http://localhost:4200/#/login-success
resource:
userInfoUri: http://localhost:8443/oauth2.0/profile
<%_ } _%>
thymeleaf:
mode: HTML
templates/src/test/java/resources/config/application.yml.ejs
所有这一切都完成了,我已经完成了接下来的步骤:
npm link
在蓝图目录中。mkdir appmygenerator && cd appmygenerator
jhipster --blueprint mygenerator --skip-git --skip-install --skip-user-management --skip-client
回答所有问题。这里有一些惊喜:
What is the base name of your application?
后我收到此警告:[DEP0148] DeprecationWarning: Use of deprecated folder mapping "./lib/util/" in the "exports" field module resolution of the package at /...<my-generator-path>/node_modules/yeoman-environment/package.json. Update this package.json to use a subpath pattern like "./lib/util/*"
Do you want to make it reactive with Spring WebFlux?
直到 Which other technologies would you like to use?
.CAS Protocol Run-async wrapped function (sync) returned a promise but async() callback must be executed to resolve
我对提示功能做了一些更改:删除了 super._prompting()
的调用希望解决第 2 项,并删除了 async
希望解决第3项。
嗯……显然已经解决了。但是当 JHipster(或 Yeoman)尝试处理模板时我得到一个新错误:
An error occured while running jhipster:server#writeFiles
ERROR! /home/fabianorodrigo/Downloads/my-blueprint/generators/server/templates/src/test/resources/config/application.yml.ejs:47
45| favicon:
46| enabled: false
>> 47| <%_ if (authenticationProtocol == 'oauth2') { _%>
48| security:
49| enable-csrf: true
50| oauth2:
authenticationProtocol is not defined
为什么未定义 authenticationProtocol?我被困在这里了。我注意到的是,在我上面引用的所有 Jhipster 生成器中,提示函数设置属性,如“this.[property] = [value]”和“this.jhipsterConfig.[property] = [value] "并且在模板中引用了它们(只是属性的名称)并且它有效。
我错过了什么?为什么即使我在提示的函数中设置了属性“this.authenticationProtocol”,它也没有出现在模板中?
最佳答案
yeoman-test
是测试所必需的。无法解析模块路径
是 bug at eslint-plugin-import 我还注意到,为我创建的生成器与 JHipster Github 中现有的生成器(例如 jhipster-dotnetcore、generator-jhipster-quarkus、generator-jhipster-nodejs)有细微差别。
这些蓝图很旧(蓝图支持对于 v8/esm 的变化非常快)并且是完整的服务器/后端替代品,看来您正在尝试添加 cas
支持。用例完全不同。在这个 Jhipster 版本中是否有任何区别,或者如果我以与 jhipster-dotnetcore 相同的方式返回则没有问题?
是的,get [INITIALIZING_PRIORITY]()
是新的表示法,INITIALIZING_PRIORITY
可能是 >initializing
而不是 initializing
。解释是here . JHipster v8 将不支持旧的表示法。...super._prompting(),
用于询问原始提示,因为这是一个 side-by-side blueprint , 提示将被复制。[DEP0148] DeprecationWarning:使用已弃用的文件夹映射“./lib/util/”
是 yeoman 环境中的错误,应在下一版本中修复。CAS Protocol Run-async wrapped function (sync) returned a promise but async() callback must be executed to resolve
因为您正在使用带有 const done = this 的异步函数。异步(); done();
在一起。this.async()
是在 Promises 成为 js 默认值之前通过回调支持异步。有一些使用新符号的蓝图可以用作灵感:native , ionic , jooq和 entity-audit .
我没有看到任何关于写入优先级的信息,所以看起来您正在覆盖现有模板,而原始生成器将写入它。因此,您应该将配置注入(inject)原始生成器。
最终结果应该是这样的:
get [INITIALIZING_PRIORITY]() {
return {
async initializingTemplateTask() {
this.info('this blueprint adds support to cas authentication protocol');
},
};
}
get [PROMPTING_PRIORITY]() {
return {
async promptingTemplateTask() {
await this.prompt({
type: 'list',
name: 'authenticationProtocol',
message: 'Which authentication protocol do you want to use?',
choices: [
{
name: 'OAuth 2.0 Protocol',
value: 'oauth2',
},
{
name: 'CAS Protocol',
value: 'cas',
},
],
default: 'oauth2',
}, this.blueprintStorage); // <- `this.blueprintStorage` tells the prompt function to store the configuration inside `.yo-rc.json` at the blueprint namespace.
},
};
}
get [CONFIGURING_PRIORITY]() {
return {
configuringTemplateTask() {
// Store the default configuration
this.blueprintConfig.authenticationProtocol = this.blueprintConfig.authenticationProtocol || 'oauth2';
},
};
}
get [LOADING_PRIORITY]() {
return {
loadingTemplateTask() {
// Load the stored configuration, the prompt can be skipped so this needs to be in another priority.
this.authenticationProtocol = this.blueprintConfig.authenticationProtocol;
// Inject the configuration into the original generator. If you are writing the template by yourself, this may be not necessary.
this.options.jhipsterContext.authenticationProtocol = this.blueprintConfig.authenticationProtocol;
},
};
}
关于jhipster - 如何创建自定义蓝图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73705785/
好的,所以我编辑了以下... 只需将以下内容放入我的 custom.css #rt-utility .rt-block {CODE HERE} 但是当我尝试改变... 与 #rt-sideslid
在表格 View 中,我有一个自定义单元格(在界面生成器中高度为 500)。在该单元格中,我有一个 Collection View ,我按 (10,10,10,10) 固定到边缘。但是在 tablev
对于我的无能,我很抱歉,但总的来说,我对 Cocoa、Swift 和面向对象编程还很陌生。我的主要来源是《Cocoa Programming for OS X》(第 5 版),以及 Apple 的充满
我正在使用 meta-tegra 为我的 NVIDIA Jetson Nano 构建自定义图像。我需要 PyTorch,但没有它的配方。我在设备上构建了 PyTorch,并将其打包到设备上的轮子中。现
在 jquery 中使用 $.POST 和 $.GET 时,有没有办法将自定义变量添加到 URL 并发送它们?我尝试了以下方法: $.ajax({type:"POST", url:"file.php?
Traefik 已经默认实现了很多中间件,可以满足大部分我们日常的需求,但是在实际工作中,用户仍然还是有自定义中间件的需求,为解决这个问题,官方推出了一个 Traefik Pilot[1] 的功
我想让我的 CustomTextInputLayout 将 Widget.MaterialComponents.TextInputLayout.OutlinedBox 作为默认样式,无需在 XML 中
我在 ~/.emacs 中有以下自定义函数: (defun xi-rgrep (term) (grep-compute-defaults) (interactive "sSearch Te
我有下表: 考虑到每个月的权重,我的目标是在 5 个月内分散 10,000 个单位。与 10,000 相邻的行是我最好的尝试(我在这上面花了几个小时)。黄色是我所追求的。 我试图用来计算的逻辑如下:计
我的表单中有一个字段,它是文件类型。当用户点击保存图标时,我想自然地将文件上传到服务器并将文件名保存在数据库中。我尝试通过回显文件名来测试它,但它似乎不起作用。另外,如何将文件名添加到数据库中?是在模
我有一个 python 脚本来发送电子邮件,它工作得很好,但问题是当我检查我的电子邮件收件箱时。 我希望该用户名是自定义用户名,而不是整个电子邮件地址。 最佳答案 发件人地址应该使用的格式是: You
我想减小 ggcorrplot 中标记的大小,并减少文本和绘图之间的空间。 library(ggcorrplot) data(mtcars) corr <- round(cor(mtcars), 1)
GTK+ noob 问题在这里: 是否可以自定义 GtkFileChooserButton 或 GtkFileChooserDialog 以删除“位置”部分(左侧)和顶部的“位置”输入框? 我实际上要
我正在尝试在主页上使用 ajax 在 magento 中使用 ajax 显示流行的产品列表,我可以为 5 或“N”个产品执行此操作,但我想要的是将分页工具栏与结果集一起添加. 这是我添加的以显示流行产
我正在尝试使用 PasswordResetForm 内置函数。 由于我想要自定义表单字段,因此我编写了自己的表单: class FpasswordForm(PasswordResetForm):
据我了解,新的 Angular 7 提供了拖放功能。我搜索了有关 DnD 的 Tree 组件,但没有找到与树相关的内容。 我在 Stackblitz 上找到的一个工作示例.对比drag'ndrop功能
我必须开发一个自定义选项卡控件并决定使用 WPF/XAML 创建它,因为我无论如何都打算学习它。完成后应该是这样的: 到目前为止,我取得了很好的进展,但还有两个问题: 只有第一个/最后一个标签项应该有
我要定制xtable用于导出到 LaTeX。我知道有些问题是关于 xtable在这里,但我找不到我要找的具体东西。 以下是我的表的外观示例: my.table <- data.frame(Specif
用ejs在这里显示日期 它给我结果 Tue Feb 02 2016 16:02:24 GMT+0530 (IST) 但是我需要表现为 19th January, 2016 如何在ejs中执行此操作?
我想问在 JavaFX 中使用自定义对象制作 ListView 的最佳方法,我想要一个每个项目如下所示的列表: 我搜了一下,发现大部分人都是用细胞工厂的方法来做的。有没有其他办法?例如使用客户 fxm
我是一名优秀的程序员,十分优秀!