diff --git a/roadmap.md b/roadmap.md index 596bef1..b5a3241 100644 --- a/roadmap.md +++ b/roadmap.md @@ -6,12 +6,18 @@ ### Major -- Un-exclude kicad8 template during default kicad version switch! +- Straightforward-ize `extends` behaviour for tagging (see #129) +- Un-exclude kicad8 template from coverage during default kicad version switch! - Merge, generalize, uniform-ize and externalize footprints! - onnx-like incremental opset versioning - Template for creating them, built-in variables they can use, documentation, external links, etc. - Add access to whole set of points + filtering logic, so they can implement their own connection logic as well maybe (see daisy chaining) + - Maybe ordering for the filter (so every instance can know that it really is the next in line) + - Add `chain` to footprint API similarly to how `local_net` behaves, only for daisy chaining + - Also, rename `local_net` to `local`, probably - Also considering how (or, on which layer) they define their silks, universal mirroring behaviour (see ixy/xy/sxy note), etc. + - When breaking anyway, remove a lot of footprints from built-in status + - And make sure the external infrastructure + bundling support is there to make up for it ### Minor diff --git a/src/prepare.js b/src/prepare.js index 48edd7f..8bb0ff5 100644 --- a/src/prepare.js +++ b/src/prepare.js @@ -69,11 +69,12 @@ exports.inherit = config => traverse(config, config, [], (target, key, val, root const list = [val] while (candidates.length) { const path = candidates.shift() - const other = u.deepcopy(u.deep(root, path)) + const other = u.deep(root, path) a.assert(other, `"${path}" (reached from "${breadcrumbs.join('.')}.$extends") does not name a valid inheritance target!`) let parents = other.$extends || [] if (a.type(parents)() !== 'array') parents = [parents] candidates = candidates.concat(parents) + a.assert(!list.includes(other), `"${path}" (reached from "${breadcrumbs.join('.')}.$extends") leads to a circular dependency!`) list.unshift(other) } val = extend.apply(null, list) diff --git a/test/cli/bundle/reference/pcbs/custom_template.kicad_pcb b/test/cli/bundle/reference/pcbs/custom_template.kicad_pcb index ba3a662..d0bd7a0 100644 --- a/test/cli/bundle/reference/pcbs/custom_template.kicad_pcb +++ b/test/cli/bundle/reference/pcbs/custom_template.kicad_pcb @@ -1 +1 @@ -Custom template override. The secret is 42. MakerJS is 0.17.0. Ergogen is 4.0.5. \ No newline at end of file +Custom template override. The secret is 42. MakerJS is loaded. Ergogen is loaded. \ No newline at end of file diff --git a/test/fixtures/bundle.zip b/test/fixtures/bundle.zip index e0ef2e8..495c121 100644 Binary files a/test/fixtures/bundle.zip and b/test/fixtures/bundle.zip differ diff --git a/test/fixtures/bundle/templates/custom_template.js b/test/fixtures/bundle/templates/custom_template.js index d70f50a..2ea0c40 100644 --- a/test/fixtures/bundle/templates/custom_template.js +++ b/test/fixtures/bundle/templates/custom_template.js @@ -4,6 +4,6 @@ const version = require('package.json').version module.exports = { convert_outline: () => {}, body: params => { - return `Custom template override. The secret is ${params.custom.secret}. MakerJS is ${m.version}. Ergogen is ${version}.` + return `Custom template override. The secret is ${params.custom.secret}. MakerJS is ${m.version.length ? 'loaded' : ''}. Ergogen is ${version.length ? 'loaded' : ''}.` } } \ No newline at end of file diff --git a/test/unit/prepare.js b/test/unit/prepare.js index 0b416f5..b80ec7c 100644 --- a/test/unit/prepare.js +++ b/test/unit/prepare.js @@ -61,6 +61,12 @@ describe('Prepare', function() { y: 2, z: 3 }) + // should be able to detect circular dependencies and error out + p.inherit.bind(this, { + a: { + $extends: 'a' + } + }).should.throw('circular dependency') }) it('parameterize', function() {