Frustratingly probably a simple resolution, but I cannot see the problem I'm having with my new templates in my custom blueprint, they are not found, but they are there.
Generated a blueprint template with jhipster generate-blueprint
. Added some new files to the generators/server/templates
folder.
Possibly related to how and when to use npm run update-snapshots
in a blueprint development cycle.
After adding the new templates, I run npm run update-snapshots
and run fails with:
...
1) SubGenerator server of devhipster JHipster blueprint
run
"before all" hook for "should succeed":
Error: Template file helm/Chart.lock was not found at ~/Development/devhipster/generators/server/templates,~/Development/devhipster/node_modules/generator-jhipster/generators/server/templates
at renderTemplate (node_modules/generator-jhipster/generators/generator-base.js:2521:17)
at ~/Development/devhipster/node_modules/generator-jhipster/generators/generator-base.js:2681:69
at Array.map (<anonymous>)
at default.writeFiles (node_modules/generator-jhipster/generators/generator-base.js:2681:53)
at default.writingTemplateTask (file://~/Development/devhipster/generators/server/generator.mjs:21:20)
at Object.<anonymous> (node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:1091:23)
at ~/Development/devhipster/node_modules/run-async/index.js:49:25
at new Promise (<anonymous>)
at ~/Development/devhipster/node_modules/run-async/index.js:26:19
at ~/Development/devhipster/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:1092:9
at new Promise (<anonymous>)
at default.executeTask (node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:1063:12)
at runLoop.add.once (node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:1043:14)
at Immediate.<anonymous> (node_modules/grouped-queue/lib/subqueue.js:48:34)
at processImmediate (node:internal/timers:466:21)
The file is there. I can see it at ~/Development/devhipster/generators/server/templates/helm/Chart.lock
The generator.mjs
for the server uses the following priority and code...
...
...
get [WRITING_PRIORITY]() {
return {
async writingTemplateTask() {
await this.writeFiles({
sections: {
files: [{
templates: ['helm/Chart.lock'],
}],
},
context: this,
});
},
};
}
...
...
Little more than a replacement of the template-file-server
that was there.
diff --git a/generators/server/generator.mjs b/generators/server/generator.mjs
index f15e19f2..88b0518e 100644
--- a/generators/server/generator.mjs
+++ b/generators/server/generator.mjs
@@ -20,7 +20,9 @@ export default class extends ServerGenerator {
async writingTemplateTask() {
await this.writeFiles({
sections: {
- files: [{ templates: ['template-file-server'] }],
+ files: [{
+ templates: ['helm/Chart.lock'],
+ }],
},
context: this,
});
It's a vexing gap in the dev workflow documentation and how using snapshots fits into that workflow, especially as changes are committed and pipelines deploy the blueprint for consumtion.