mirror of
https://github.com/TECHNOFAB11/ergogen.git
synced 2025-12-11 23:50:05 +01:00
Template dependency injection
This commit is contained in:
parent
1da40bce6f
commit
886c22937d
12 changed files with 39 additions and 8 deletions
|
|
@ -1 +1 @@
|
|||
Could not read config file "test/"!
|
||||
Ambiguous config in bundle!
|
||||
1
test/cli/bad_template/command
Normal file
1
test/cli/bad_template/command
Normal file
|
|
@ -0,0 +1 @@
|
|||
node src/cli.js test/cli/bad_template/input --clean
|
||||
1
test/cli/bad_template/error
Normal file
1
test/cli/bad_template/error
Normal file
|
|
@ -0,0 +1 @@
|
|||
Unknown dependency "nonexistent_require" among the requirements of injection "bad_template"!
|
||||
10
test/cli/bad_template/input/config.yaml
Normal file
10
test/cli/bad_template/input/config.yaml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
points.zones.matrix:
|
||||
outlines:
|
||||
box:
|
||||
- what: rectangle
|
||||
where: true
|
||||
size: 18
|
||||
pcbs:
|
||||
bad_template:
|
||||
outlines.edge.outline: box
|
||||
template: bad_template
|
||||
1
test/cli/bad_template/input/templates/bad_template.js
Normal file
1
test/cli/bad_template/input/templates/bad_template.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
const bad = require('nonexistent_require')
|
||||
|
|
@ -1 +1 @@
|
|||
Custom template override. The secret is 42.
|
||||
Custom template override. The secret is 42. MakerJS is 0.17.0. Ergogen is 4.0.5.
|
||||
BIN
test/fixtures/bundle.zip
vendored
BIN
test/fixtures/bundle.zip
vendored
Binary file not shown.
|
|
@ -1,6 +1,9 @@
|
|||
const m = require('makerjs')
|
||||
const version = require('package.json').version
|
||||
|
||||
module.exports = {
|
||||
convert_outline: () => {},
|
||||
body: params => {
|
||||
return `Custom template override. The secret is ${params.custom.secret}.`
|
||||
return `Custom template override. The secret is ${params.custom.secret}. MakerJS is ${m.version}. Ergogen is ${version}.`
|
||||
}
|
||||
}
|
||||
|
|
@ -203,7 +203,7 @@ for (let w of cli_what) {
|
|||
if (ex === 'should_have_thrown') {
|
||||
throw new Error('This command should have thrown!')
|
||||
}
|
||||
const actual_error = ex.stderr.toString().split('\n')[0]
|
||||
const actual_error = ex.stderr.toString()
|
||||
if (dump) {
|
||||
fs.writeFileSync(path.join(t, 'error'), actual_error)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue