diff --git a/.gitignore b/.gitignore index c6bba59..ee50711 100644 --- a/.gitignore +++ b/.gitignore @@ -128,3 +128,6 @@ dist .yarn/build-state.yml .yarn/install-state.gz .pnp.* + +# example.js spec folder +/spec diff --git a/builder.cjs b/builder.cjs index 91911a5..22234c4 100644 --- a/builder.cjs +++ b/builder.cjs @@ -22,7 +22,7 @@ class HyperdispatchNamespace { module.exports = class Hyperdispatch { constructor (schema, dispatchJson, { offset, dispatchDir = null, schemaDir = null } = {}) { - if (dispatchJson && dispatchJson.offset !== offset) { + if (dispatchJson && offset && dispatchJson.offset !== offset) { throw new Error('Cannot change the hyperdispatch offset once it has been defined once') } this.schema = schema diff --git a/package.json b/package.json index afe99d6..874e0a0 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ } }, "scripts": { - "test": "standard && brittle test/index.js" + "test": "standard && brittle test/index.js && npm run example:rebuild", + "example:rebuild": "node example.js && node example.js" }, "repository": { "type": "git",